-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
The gofumpt linting rule implicitly assumes that Go 1.19 is being used #3175
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
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
I should also add that this appears to be sensitive to the version of Go used when building golangci-lint.
I'll see if I can fix the problem and raise a pull request; your project is really well-organised so it looks like a tractable problem. |
(Ed.: See the message below for a comment that explains the whole situation, since there's slightly more to it.) The issue looks to be that gofumpt -d main.go
gofumpt -lang "1.19" -d main.go
gofumpt -lang "1.18" -d main.go I don't think there's anything golangci-lint can do about this. I'll close the issue and move things over to the gofumpt repository. Sorry for wasting your time! |
I've now finished my digging around. The underlying issue is that the behaviour of It isn't clear how this can be solved without dramatically extending gofumpt to fully "impersonate" other versions of Go (which isn't feasible). For my own case, I've pinned golangci-lint to the last version built with Go 1.18 (v1.47.3), which works. Hopefully this comment is useful to someone else! Thanks, by the way, for your work on golangci-lint. It's an invaluable tool. |
(Ed.: See the message below for a comment that explains the whole situation.)
Welcome
Description of the problem
In short, I believe the gofumpt linting rule implicitly assumes that Go 1.19 is being used; this makes it awkward to work with the linting rule when using Go 1.18, since a parallel toolchain needs to exist just to pass files through
gofumpt
.The below contains examples that should reproduce the problem.
The behaviour of
gofumpt
depends on the minor version of GoFirstly: the behaviour of
gofumpt
depends on the version of Go being used. For example, take the following files:Then run:
golangci-lint
implicitly assumes that Go 1.19 is being used with the gofumpt linting ruleAs well as the files above, add the following file:
Then:
Version of golangci-lint
The reproducing example above used, at the time of writing, version 1.49.0 built from cc2d97f on 2022-08-24T10:24:37Z.
Configuration file
See above.
Go environment
This is captured within the containers above.
Verbose output of running
This is captured within the containers above.
Code example or link to a public repository
See above.
The text was updated successfully, but these errors were encountered: