-
-
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
revive complains about missing package comment since golangci-lint 1.44.1 #2610
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
You have 'package-comments' enabled check, but if it's just not works as it suppose to I suggest to visit 'revive' linter repo, and leave bug report there. |
Thanks for looking! I agree it sounds like revive might have an issue, but see this output which makes me think it might be how golangci-lint is using it: wstorey@penguin:~/foo$ ls
bar.go foo.go go.mod
wstorey@penguin:~/foo$ cat bar.go
package foo
// Bar returns bar.
func Bar() string { return "bar" }
wstorey@penguin:~/foo$ cat foo.go
// Package foo is a nice package.
package foo
// Foo returns foo.
func Foo() string { return "foo" }
wstorey@penguin:~/foo$ golangci-lint version
golangci-lint has version 1.44.2 built from d58dbde5 on 2022-02-17T20:58:06Z
wstorey@penguin:~/foo$ golangci-lint run
bar.go:1:1: package-comments: should have a package comment, unless it's in another file for this package (revive)
package foo
// Bar returns bar.
func Bar() string { return "bar" }
wstorey@penguin:~/foo$ ~/t/golangci-lint-1.44.0-linux-amd64/golangci-lint version
golangci-lint has version 1.44.0 built from 617470fa on 2022-01-25T11:31:17Z
wstorey@penguin:~/foo$ ~/t/golangci-lint-1.44.0-linux-amd64/golangci-lint run
wstorey@penguin:~/foo$ and wstorey@penguin:~/foo$ ~/t/revive -version
Version: 1.1.4
Commit: d4fbc9244093baaa4cdbcc310fde154a01dfc172
Built 2022-02-15T22:59:06Z by goreleaser
wstorey@penguin:~/foo$ ~/t/revive ./...
wstorey@penguin:~/foo$ |
I changed your sample (removed the package comment in Foo.go), I recreate a quick revive configuration file. $ cat revive.toml
ignoreGeneratedHeader = false
severity = "warning"
confidence = 0.8
errorCode = 1
warningCode = 2
[rule.package-comments] $ revive -config revive.toml ./... |
@ldez can you check with confidence 0.1? |
Yes, my problem was related to confidence. cat revive.toml
ignoreGeneratedHeader = false
severity = "error"
confidence = 0.2
errorCode = 1
warningCode = 2
[rule.package-comments] $ revive -config revive.toml ./...
foo.go:1:1: should have a package comment, unless it's in another file for this package
bar.go:1:1: should have a package comment, unless it's in another file for this package And with the original example: revive -config revive.toml ./...
bar.go:1:1: should have a package comment, unless it's in another file for this package So the weird behavior is not related to golangci-lint. |
The difference between v1.44.0 and v1.44.1 is related to the default confidence. |
the workaround is to define [linters-settings.revive]
severity = "warning"
confidence = 0.8 linters-settings:
revive:
severity: warning
confidence: 0.8
|
Welcome
Description of the problem
I am seeing errors like this since updating to golangci-lint 1.44.2. I tested 1.44.1 and the issue is there as well. 1.44.0 is fine. I also tried running revive 1.1.4 standalone and I could not reproduce it.
For example in this test run in my project: https://github.com/maxmind/geoipupdate/runs/5292690662?check_suite_focus=true
The packages in question have a package comment in another file in the package.
I also noticed it complained that
main
did not have a package comment, which doesn't seem necessary either, though seems less of an issue.Version of golangci-lint
Configuration file
Go environment
Verbose output of running
Code example or link to a public repository
https://github.com/maxmind/geoipupdate
The text was updated successfully, but these errors were encountered: