-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
nolintlint: "allow no explanation" broken since v1.31.0 #1566
Comments
Hello, I don't see any changes on nolintlint between v1.30.0 and v1.31.0: I tried to create the report with v1.30.0 but there is no report. (I also tried with v1.29.0) Could you provide a code example? |
Yes, that's why I'm reporting this issue Here is a code sample: package foo
import "sync"
func foo() { //nolint:unused,deadcode
var mu sync.Mutex
mu.Lock()
mu.Unlock() //nolint:staticcheck
} With golangci-lint v1.30.0: $ /home/pierre/go/pkg/golangci-lint/v1.30.0/golangci-lint -v run
INFO [config_reader] Config search paths: [./ /home/pierre/gosrc/github.com/xxx/golang-libraries /home/pierre/gosrc/github.com/xxx /home/pierre/gosrc/github.com /home/pierre/gosrc /home/pierre /home /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 26 linters: [asciicheck bodyclose deadcode depguard errcheck exportloopref gocritic gocyclo godot goerr113 gofmt gofumpt goimports golint gosimple govet ineffassign misspell nakedret nolintlint staticcheck structcheck unconvert unparam unused varcheck]
INFO [loader] Go packages loading at mode 575 (deps|types_sizes|compiled_files|exports_file|files|imports|name) took 339.61536ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 28.848484ms
INFO [linters context/goanalysis] analyzers took 55.070695101s with top 10 stages: buildir: 20.120179537s, buildssa: 6.73736716s, unconvert: 2.2801639s, gocritic: 1.732114317s, inspect: 1.591059712s, fact_deprecated: 1.564588276s, goimports: 1.435186059s, gofumpt: 1.431137375s, unparam: 1.093742404s, findcall: 815.953598ms
INFO [linters context/goanalysis] analyzers took 4.790057642s with top 10 stages: buildir: 4.134919134s, U1000: 655.138508ms
INFO [runner] Issues before processing: 185, after processing: 5
INFO [runner] Processors filtering stat (out/in): filename_unadjuster: 185/185, path_prettifier: 185/185, skip_dirs: 185/185, max_same_issues: 5/5, cgo: 185/185, autogenerated_exclude: 185/185, identifier_marker: 185/185, nolint: 5/185, uniq_by_line: 5/5, severity-rules: 5/5, skip_files: 185/185, exclude-rules: 185/185, diff: 5/5, source_code: 5/5, exclude: 185/185, max_per_file_from_linter: 5/5, max_from_linter: 5/5, path_shortener: 5/5, path_prefixer: 5/5, sort_results: 5/5
INFO [runner] processing took 18.857354ms with stages: nolint: 11.774195ms, identifier_marker: 4.243026ms, path_prettifier: 1.233804ms, autogenerated_exclude: 1.025312ms, skip_dirs: 425.223µs, cgo: 74.976µs, filename_unadjuster: 46.004µs, source_code: 26.916µs, uniq_by_line: 2.715µs, path_shortener: 1.862µs, max_same_issues: 968ns, max_per_file_from_linter: 698ns, exclude: 315ns, skip_files: 290ns, diff: 260ns, severity-rules: 178ns, sort_results: 177ns, max_from_linter: 173ns, exclude-rules: 169ns, path_prefixer: 93ns
INFO [runner] linters took 4.982791242s with stages: goanalysis_metalinter: 4.337452436s, unused: 626.391297ms
foo/foo.go:5:14: directive `//nolint:unused,deadcode` should provide explanation such as `//nolint:unused,deadcode // this is why` (nolintlint)
func foo() { //nolint:unused,deadcode
^
foo/foo.go:8:14: directive `//nolint:staticcheck` should provide explanation such as `//nolint:staticcheck // this is why` (nolintlint)
mu.Unlock() //nolint:staticcheck
^
INFO File cache stats: 370 entries of total size 752.6KiB
INFO Memory: 55 samples, avg is 479.2MB, max is 745.6MB
INFO Execution took 5.355913258s With golangci-lint v1.31.0: $ /home/pierre/go/pkg/golangci-lint/v1.31.0/golangci-lint -v run
INFO [config_reader] Config search paths: [./ /home/pierre/gosrc/github.com/xxx/golang-libraries /home/pierre/gosrc/github.com/xxx /home/pierre/gosrc/github.com /home/pierre/gosrc /home/pierre /home /]
INFO [config_reader] Used config file .golangci.yml
INFO [lintersdb] Active 26 linters: [asciicheck bodyclose deadcode depguard errcheck exportloopref gocritic gocyclo godot goerr113 gofmt gofumpt goimports golint gosimple govet ineffassign misspell nakedret nolintlint staticcheck structcheck unconvert unparam unused varcheck]
INFO [loader] Go packages loading at mode 575 (files|deps|exports_file|imports|name|types_sizes|compiled_files) took 336.069307ms
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 10.685933ms
INFO [linters context/goanalysis] analyzers took 1m38.268075127s with top 10 stages: buildir: 20.327705409s, buildssa: 7.189830674s, unconvert: 2.708765339s, gocritic: 2.117544207s, gofmt: 2.116390408s, gofumpt: 1.899475029s, golint: 1.816105463s, fact_deprecated: 1.669929366s, inspect: 1.669397434s, misspell: 1.472912402s
INFO [linters context/goanalysis] analyzers took 5.10636342s with top 10 stages: buildir: 4.287906332s, U1000: 818.457088ms
INFO [runner] Issues before processing: 90, after processing: 0
INFO [runner] Processors filtering stat (out/in): filename_unadjuster: 90/90, skip_files: 90/90, skip_dirs: 90/90, cgo: 90/90, exclude-rules: 90/90, nolint: 0/90, identifier_marker: 90/90, path_prettifier: 90/90, autogenerated_exclude: 90/90, exclude: 90/90
INFO [runner] processing took 15.241814ms with stages: nolint: 12.836075ms, identifier_marker: 1.016901ms, path_prettifier: 605.119µs, autogenerated_exclude: 597.325µs, skip_dirs: 165.807µs, cgo: 11.412µs, filename_unadjuster: 4.808µs, max_same_issues: 1.101µs, uniq_by_line: 607ns, diff: 432ns, source_code: 317ns, max_from_linter: 302ns, skip_files: 259ns, sort_results: 256ns, path_shortener: 235ns, severity-rules: 210ns, exclude-rules: 199ns, max_per_file_from_linter: 179ns, exclude: 179ns, path_prefixer: 91ns
INFO [runner] linters took 5.29990061s with stages: goanalysis_metalinter: 4.611727345s, unused: 672.396532ms
INFO File cache stats: 368 entries of total size 750.9KiB
INFO Memory: 58 samples, avg is 479.9MB, max is 749.2MB
INFO Execution took 5.651591992s Same config file as the one I shared above. |
After a lot of tries, I found a lead:
Currently, I use go1.15.6, but if I use go1.14.13 when I'm building a binary from the tag, I'm able to reproduce. I also tried with go1.15 and I had the same problem as go1.15.6 So it seems related to the go version. Maybe it's not related to nolintlint. |
I'm using the binary from the release for both versions. Currently my Go version is 1.16beta1, but I got the same issue with 1.15.6.
I didn't noticed any other issue. |
I think I find the root cause... |
I talk about go version used to compile golangci-lint. |
I find the root cause, now I'm sure at 100%: golang/go@5a550b6#diff-f56160fd9fcea272966a8a1d692ad9f49206fdd8dbcbfe384865a98cd9bc2749R158 The |
@ldez Thank you for identifying the root cause. I can put up a fix for this if you like but if you'd rather create one yourself, I'm happy to leave it to one of you. Just let me know either way. Thanks. |
I already fixed the problem in #1571 |
thank you very much ! 👍 |
Version of golangci-lint
Config file
Go environment
Verbose output of running
The "allow no explanation" feature of
nolintlint
is broken since v1.31.0.With v1.30.0 it's reporting "nolint" with no explanation.
With v1.31.0, it's not reporting anymore.
The text was updated successfully, but these errors were encountered: