Closed
Description
Welcome
- Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
- Yes, I've searched similar issues on GitHub and didn't find any.
- Yes, I've included all information below (version, config, etc).
- Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)
Description of the problem
I just upgraded to golangci-lint v1.48.0.
It seems that gofmt
can now conflict with nolintlint
. For example, I have this code:
//nolint:maintidx
func something() { ... }
When I run golangci-lint run
the gofmt
linter complains and says the file is not formatted properly.
filename:line: File is not `gofmt`-ed with `-s` (gofmt)
//nolint: maintidx
If I fix it (using --fix
or manually), and run again, I get
filename:line: directive `// nolint: maintidx` should be written without leading space as `//nolint: maintidx` (nolintlint)
// nolint: maintidx
I have other //nolint:
directives that are not impacted. It seems to be only this one, because it is on a function definition instead of in a function block. I think gofmt
is considering it a godoc comment (even though the function is not exported).
Version of golangci-lint
$ golangci-lint --version
# Paste output here
Configuration file
$ cat .golangci.yml
# paste output here
Go environment
golangci-lint v1.48.0
golang v1.18.1
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here