-
Notifications
You must be signed in to change notification settings - Fork 42
godoclint: enable via golangci-lint v2.5.0 #2371
Description
This is a follow up to my last issue (#1558).
Godoc-Lint v0.10.0 is now shipped as part of Golangci-lint v2.5.0. Since this repo uses the @latest version, I recommend using the linter through Golangci-lint to improve the CI performance (since all linters would share the same driver and pre/post-analysis), and easier maintenance.
I'm going to show the changes required for this to help with the maintainers' time in case they were interested in doing so. Needless to say I have already tested the changes locally.
Required changes
Currently, the Godoc-Lint is used in all_test.go:
Lines 185 to 190 in 2ff8248
| func TestGodocLint(t *testing.T) { | |
| rungo(t, "run", "github.com/godoc-lint/godoc-lint/cmd/[email protected]", | |
| // TODO(https://github.com/googleapis/librarian/issues/1510): fix test | |
| "-exclude", "internal/sidekick", | |
| "./...") | |
| } |
This test function should be removed in favour of updating .golangci.yaml as below. Note that the exclusion of internal/sidekick and test files (which was already the default behavior of the linter) are also added.
version: "2"
linters:
# See https://golangci-lint.run/usage/linters for details.
default: none
enable:
- containedctx
- contextcheck
- fatcontext
- godoclint
- godot
- govet
- ineffassign
- misspell
- staticcheck
- unparam
- unused
- usetesting
exclusions:
rules:
- path: _test\.go$
linters:
- godoclint
# TODO(https://github.com/googleapis/librarian/issues/1510): fix test
- path: internal/sidekick
linters:
- godoclintI'd be happy to contribute with a PR if that helps.
cc @julieqiu