Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code to pass lint #1479

Merged
merged 1 commit into from
Sep 19, 2021
Merged

Conversation

black-desk
Copy link
Contributor

hope it works

@black-desk
Copy link
Contributor Author

Yeah!

@mjarkk
Copy link
Contributor

mjarkk commented Sep 16, 2021

Do you have documentation on the go:build comments it doesn't seem to break anything but i'm not sure why go fmt wants it.

@black-desk
Copy link
Contributor Author

Do you have documentation on the go:build comments it doesn't seem to break anything but i'm not sure why go fmt wants it.

try run find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;

You will find out gofmt really wants this. I have no idea too :)

@black-desk black-desk force-pushed the format-code branch 2 times, most recently from 9cc839e to 66d0fd2 Compare September 16, 2021 14:34
@fsmiamoto
Copy link
Contributor

fsmiamoto commented Sep 19, 2021

This is a new change from Go 1.17 that makes gofmt enforce the new style of build constraints - https://golang.org/doc/go1.17#vet

The rationale of the changes is explained here: https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md

If a file contains only // +build lines, gofmt will add an equivalent //go:build line above them.

We should be good with this one :)

@fsmiamoto
Copy link
Contributor

But I guess this shows that maybe we should consider pinning the go version on the Lint workflow.
At least for me, it can be really annoying having to dig through Go changes unexpectedly.

@mjarkk
Copy link
Contributor

mjarkk commented Sep 19, 2021

@fsmiamoto thanks for the information!
I'll merge this for now so we can keep running the last go version

@mjarkk mjarkk merged commit 60c87b3 into jesseduffield:master Sep 19, 2021
@mjarkk
Copy link
Contributor

mjarkk commented Sep 19, 2021

@fsmiamoto i agree these unexpected linting errors are annoying but personally i would prefer always linting the code with the latest go version.
This overcomes that a user running the latest go version has a different result when trying to simulate why the ci linting failed locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants