File tree Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ require (
7373 github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
7474 github.com/shirou/gopsutil/v3 v3.21.12
7575 github.com/sirupsen/logrus v1.8.1
76+ github.com/sivchari/containedctx v1.0.1
7677 github.com/sivchari/tenv v1.4.7
7778 github.com/sonatard/noctx v0.0.1
7879 github.com/sourcegraph/go-diff v0.6.1
Original file line number Diff line number Diff line change 1+ package golinters
2+
3+ import (
4+ "github.com/sivchari/containedctx"
5+ "golang.org/x/tools/go/analysis"
6+
7+ "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
8+ )
9+
10+ func NewContainedCtx () * goanalysis.Linter {
11+ a := containedctx .Analyzer
12+
13+ return goanalysis .NewLinter (
14+ a .Name ,
15+ a .Doc ,
16+ []* analysis.Analyzer {a },
17+ nil ,
18+ ).WithLoadMode (goanalysis .LoadModeSyntax )
19+ }
Original file line number Diff line number Diff line change @@ -183,6 +183,11 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
183183 WithPresets (linter .PresetPerformance , linter .PresetBugs ).
184184 WithURL ("https://github.com/timakin/bodyclose" ),
185185
186+ linter .NewConfig (golinters .NewContainedCtx ()).
187+ WithSince ("1.44.0" ).
188+ WithPresets (linter .PresetStyle ).
189+ WithURL ("https://github.com/sivchari/containedctx" ),
190+
186191 linter .NewConfig (golinters .NewContextCheck ()).
187192 WithSince ("v1.43.0" ).
188193 WithPresets (linter .PresetBugs ).
Original file line number Diff line number Diff line change 1+ // args: -Econtainedctx
2+ package testdata
3+
4+ import "context"
5+
6+ type ok struct {
7+ i int
8+ s string
9+ }
10+
11+ type ng struct {
12+ ctx context.Context // ERROR "found a struct that contains a context.Context field"
13+ }
14+
15+ type empty struct {}
You can’t perform that action at this time.
0 commit comments