Skip to content

Commit

Permalink
contextcheck: bump to v1.0.6 && re-enable (#3102)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvia7788 committed Aug 23, 2022
1 parent 58809c3 commit cc2d97f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -91,7 +91,7 @@ require (
github.com/ssgreg/nlreturn/v2 v2.2.1
github.com/stbenjam/no-sprintf-host-port v0.1.1
github.com/stretchr/testify v1.8.0
github.com/sylvia7788/contextcheck v1.0.4
github.com/sylvia7788/contextcheck v1.0.6
github.com/tdakkota/asciicheck v0.1.1
github.com/tetafro/godot v1.4.11
github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions pkg/golinters/contextcheck.go
Expand Up @@ -5,13 +5,18 @@ import (
"golang.org/x/tools/go/analysis"

"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
"github.com/golangci/golangci-lint/pkg/lint/linter"
)

func NewContextCheck() *goanalysis.Linter {
analyzer := contextcheck.NewAnalyzer(contextcheck.Configuration{})

return goanalysis.NewLinter(
"contextcheck",
"check the function whether use a non-inherited context",
[]*analysis.Analyzer{contextcheck.NewAnalyzer()},
analyzer.Name,
analyzer.Doc,
[]*analysis.Analyzer{analyzer},
nil,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
).WithContextSetter(func(lintCtx *linter.Context) {
analyzer.Run = contextcheck.NewRun(lintCtx.Packages, false)
}).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
3 changes: 1 addition & 2 deletions pkg/lint/lintersdb/manager.go
Expand Up @@ -304,8 +304,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithSince("v1.43.0").
WithPresets(linter.PresetBugs).
WithLoadForGoAnalysis().
WithURL("https://github.com/sylvia7788/contextcheck").
WithNoopFallback(m.cfg),
WithURL("https://github.com/sylvia7788/contextcheck"),

linter.NewConfig(golinters.NewCyclop(cyclopCfg)).
WithSince("v1.37.0").
Expand Down

0 comments on commit cc2d97f

Please sign in to comment.