Skip to content

Commit

Permalink
govet: add directive and slog passes (#4028)
Browse files Browse the repository at this point in the history
Co-authored-by: Fernandez Ludovic <[email protected]>
  • Loading branch information
johejo and ldez authored Aug 19, 2023
1 parent 2741ab2 commit a5eaf9f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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

0 comments on commit a5eaf9f

Please sign in to comment.