Skip to content
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

govet: add directive and slog passes #4028

Merged
merged 3 commits into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .golangci.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,7 @@ linters-settings:
- copylocks
- deepequalerrors
- defers
- directive
- errorsas
- fieldalignment
- findcall
Expand All @@ -1078,6 +1079,7 @@ linters-settings:
- shadow
- shift
- sigchanyzer
- slog
- sortslice
- stdmethods
- stringintconv
Expand Down Expand Up @@ -1107,6 +1109,8 @@ linters-settings:
- composites
- copylocks
- deepequalerrors
- defers
- directive
- errorsas
- fieldalignment
- findcall
Expand All @@ -1122,6 +1126,7 @@ linters-settings:
- shadow
- shift
- sigchanyzer
- slog
- sortslice
- stdmethods
- stringintconv
Expand Down
8 changes: 7 additions & 1 deletion pkg/golinters/govet.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
_ "golang.org/x/tools/go/analysis/passes/ctrlflow" // unused, internal analyzer
"golang.org/x/tools/go/analysis/passes/deepequalerrors"
"golang.org/x/tools/go/analysis/passes/defers"
"golang.org/x/tools/go/analysis/passes/directive"
"golang.org/x/tools/go/analysis/passes/errorsas"
"golang.org/x/tools/go/analysis/passes/fieldalignment"
"golang.org/x/tools/go/analysis/passes/findcall"
Expand All @@ -32,6 +33,7 @@ import (
"golang.org/x/tools/go/analysis/passes/shadow"
"golang.org/x/tools/go/analysis/passes/shift"
"golang.org/x/tools/go/analysis/passes/sigchanyzer"
"golang.org/x/tools/go/analysis/passes/slog"
"golang.org/x/tools/go/analysis/passes/sortslice"
"golang.org/x/tools/go/analysis/passes/stdmethods"
"golang.org/x/tools/go/analysis/passes/stringintconv"
Expand Down Expand Up @@ -62,6 +64,7 @@ var (
copylock.Analyzer,
deepequalerrors.Analyzer,
defers.Analyzer,
directive.Analyzer,
errorsas.Analyzer,
fieldalignment.Analyzer,
findcall.Analyzer,
Expand All @@ -77,6 +80,7 @@ var (
shadow.Analyzer,
shift.Analyzer,
sigchanyzer.Analyzer,
slog.Analyzer,
sortslice.Analyzer,
stdmethods.Analyzer,
stringintconv.Analyzer,
Expand All @@ -91,7 +95,7 @@ var (
unusedwrite.Analyzer,
}

// https://github.com/golang/go/blob/9f834a559c9ed6cdf883e29b36e21e5f956df74f/src/cmd/vet/main.go#L46-L76
// https://github.com/golang/go/blob/c19c4c566c63818dfd059b352e52c4710eecf14d/src/cmd/vet/main.go#L47-L78
defaultAnalyzers = []*analysis.Analyzer{
asmdecl.Analyzer,
assign.Analyzer,
Expand All @@ -101,6 +105,7 @@ var (
cgocall.Analyzer,
composite.Analyzer,
copylock.Analyzer,
directive.Analyzer,
errorsas.Analyzer,
framepointer.Analyzer,
httpresponse.Analyzer,
Expand All @@ -111,6 +116,7 @@ var (
printf.Analyzer,
shift.Analyzer,
sigchanyzer.Analyzer,
slog.Analyzer,
stdmethods.Analyzer,
stringintconv.Analyzer,
structtag.Analyzer,
Expand Down