File tree Expand file tree Collapse file tree 4 files changed +13
-9
lines changed Expand file tree Collapse file tree 4 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ require (
9191 github.com/ssgreg/nlreturn/v2 v2.2.1
9292 github.com/stbenjam/no-sprintf-host-port v0.1.1
9393 github.com/stretchr/testify v1.8.0
94- github.com/sylvia7788/contextcheck v1.0.4
94+ github.com/sylvia7788/contextcheck v1.0.6
9595 github.com/tdakkota/asciicheck v0.1.1
9696 github.com/tetafro/godot v1.4.11
9797 github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144
Original file line number Diff line number Diff line change @@ -5,13 +5,18 @@ import (
55 "golang.org/x/tools/go/analysis"
66
77 "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
8+ "github.com/golangci/golangci-lint/pkg/lint/linter"
89)
910
1011func NewContextCheck () * goanalysis.Linter {
12+ analyzer := contextcheck .NewAnalyzer (contextcheck.Configuration {})
13+
1114 return goanalysis .NewLinter (
12- "contextcheck" ,
13- "check the function whether use a non-inherited context" ,
14- []* analysis.Analyzer {contextcheck . NewAnalyzer () },
15+ analyzer . Name ,
16+ analyzer . Doc ,
17+ []* analysis.Analyzer {analyzer },
1518 nil ,
16- ).WithLoadMode (goanalysis .LoadModeTypesInfo )
19+ ).WithContextSetter (func (lintCtx * linter.Context ) {
20+ analyzer .Run = contextcheck .NewRun (lintCtx .Packages , false )
21+ }).WithLoadMode (goanalysis .LoadModeTypesInfo )
1722}
Original file line number Diff line number Diff line change @@ -304,8 +304,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
304304 WithSince ("v1.43.0" ).
305305 WithPresets (linter .PresetBugs ).
306306 WithLoadForGoAnalysis ().
307- WithURL ("https://github.com/sylvia7788/contextcheck" ).
308- WithNoopFallback (m .cfg ),
307+ WithURL ("https://github.com/sylvia7788/contextcheck" ),
309308
310309 linter .NewConfig (golinters .NewCyclop (cyclopCfg )).
311310 WithSince ("v1.37.0" ).
You can’t perform that action at this time.
0 commit comments