File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ require (
3636 github.com/go-xmlfmt/xmlfmt v1.1.2
3737 github.com/gofrs/flock v0.8.1
3838 github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2
39- github.com/golangci/depguard/v2 v2.0.2-0.20230601235138-ed68d3771f48
39+ github.com/golangci/depguard/v2 v2.0.2-0.20230602133032-4f22f8585733
4040 github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a
4141 github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe
4242 github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2
Original file line number Diff line number Diff line change 66
77 "github.com/golangci/golangci-lint/pkg/config"
88 "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
9+ "github.com/golangci/golangci-lint/pkg/lint/linter"
910)
1011
1112func NewDepguard (settings * config.DepGuardSettings ) * goanalysis.Linter {
@@ -32,15 +33,19 @@ func NewDepguard(settings *config.DepGuardSettings) *goanalysis.Linter {
3233 }
3334 }
3435
35- a , err := depguard .NewAnalyzer (& conf )
36- if err != nil {
37- linterLogger .Fatalf ("depguard: create analyzer: %v" , err )
38- }
36+ a := depguard .NewCoreAnalyzer (depguard.CoreSettings {})
3937
4038 return goanalysis .NewLinter (
4139 a .Name ,
4240 a .Doc ,
4341 []* analysis.Analyzer {a },
4442 nil ,
45- ).WithLoadMode (goanalysis .LoadModeSyntax )
43+ ).WithContextSetter (func (lintCtx * linter.Context ) {
44+ coreSettings , err := conf .Compile ()
45+ if err != nil {
46+ lintCtx .Log .Errorf ("create analyzer: %v" , err )
47+ }
48+
49+ a .Run = coreSettings .Run
50+ }).WithLoadMode (goanalysis .LoadModeSyntax )
4651}
You can’t perform that action at this time.
0 commit comments