-
Notifications
You must be signed in to change notification settings - Fork 63
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
golangci-lint: enable more linters and address linting issues #191
Conversation
3ca8e8f
to
6c393c4
Compare
I am ok with almost all of these, although I am not crazy about the if err := foobar(); err != nil Then Bottom line, I think err should be handled differently then other shadowed vars. But I am willing to live with the changes. LGTM |
6c393c4
to
4ef886f
Compare
Yes, I'm slightly on the fence on that one as well;
I don't think the linter itself has a config for this, but perhaps a string match exclusion would work (see https://golangci-lint.run/usage/false-positives/#exclude-issue-by-text) |
Tests are failing for go-fumpt? |
I probably need to rebase see #189 (comment) |
4ef886f
to
d33149a
Compare
release notes: https://github.com/golangci/golangci-lint/releases/tag/v1.50.0 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
d33149a
to
4dcd790
Compare
- The whitespace linter overlaps with gofumpt, so doesn't bring much. - Enable govet's shadow check to check for shadowed variables. - Add a short description to each linter. pkg/pwalk/pwalk_test.go:78:8: shadow: declaration of "err" shadows declaration at line 69 (govet) fi, err := os.CreateTemp(dir, "f-") ^ pkg/pwalkdir/pwalkdir_test.go:82:8: shadow: declaration of "err" shadows declaration at line 73 (govet) fi, err := os.CreateTemp(dir, "f-") ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
go-selinux/selinux_linux.go:1089:2: var-naming: don't use underscores in Go names; var exclude_paths should be excludePaths (revive) go-selinux/selinux_linux.go:622:1: receiver-naming: receiver name l1 should be consistent with previous receiver name l for level (revive) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
go-selinux/selinux.go:27:2: error-naming: error var InvalidLabel should have name of the form ErrFoo (revive) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
By default, output is limited to 50 issues per linter, and 3 "same" issues. When enabling a new linter, this requires multiple runs of the linter to get a list of all issues. Let's assume we don't introduce "many" new issues at a time, and just show all the issues that were found. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
4dcd790
to
40803cc
Compare
Rebased, and tweaked the settings to ignore "err" for shadowing 👍 PTAL |
pkg/pwalk/pwalk.go:120:15: fieldalignment: struct with 24 pointer bytes could be 16 (govet) type walkArgs struct { ^ pkg/pwalk/pwalk_test.go:136:18: fieldalignment: struct with 24 pointer bytes could be 16 (govet) benchmarks := []struct { ^ pkg/pwalk/pwalk_test.go:146:15: fieldalignment: struct with 24 pointer bytes could be 16 (govet) walkers := []struct { ^ pkg/pwalkdir/pwalkdir.go:113:15: fieldalignment: struct with 32 pointer bytes could be 24 (govet) type walkArgs struct { ^ pkg/pwalkdir/pwalkdir_test.go:140:18: fieldalignment: struct with 24 pointer bytes could be 16 (govet) benchmarks := []struct { ^ pkg/pwalkdir/pwalkdir_test.go:150:15: fieldalignment: struct with 24 pointer bytes could be 16 (govet) walkers := []struct { ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Oh! Had one more change staged in another branch; just pushed that one as well. |
go-selinux/selinux_linux.go:37:19: fieldalignment: struct with 40 pointer bytes could be 16 (govet) type selinuxState struct { ^ go-selinux/selinux_linux.go:46:12: fieldalignment: struct with 16 pointer bytes could be 8 (govet) type level struct { ^ go-selinux/selinux_linux.go:56:19: fieldalignment: struct with 88 pointer bytes could be 80 (govet) type defaultSECtx struct { ^ go-selinux/selinux_linux_test.go:310:13: fieldalignment: struct with 64 pointer bytes could be 56 (govet) tests := []struct { ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2d54c3a
to
ba8946a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@kolyshkin @giuseppe @vrothberg PTAL
Nice work @thaJeztah |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
(more coming after this, but I have ETOOMANYBRANCHES already)