Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: golangci/golangci-lint
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: sylvia7788/golangci-lint
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 4 commits
  • 4 files changed
  • 2 contributors

Commits on Aug 23, 2022

  1. contextcheck: re-enable for go1.18

    sylvia7788 authored and ldez committed Aug 23, 2022
    Copy the full SHA
    7c680e9 View commit details
  2. Copy the full SHA
    b6b99b5 View commit details
  3. contextcheck: remove disable-fact config

    sylvia7788 authored and ldez committed Aug 23, 2022
    Copy the full SHA
    94a9c43 View commit details
  4. review

    ldez committed Aug 23, 2022
    Copy the full SHA
    8576746 View commit details
Showing with 13 additions and 9 deletions.
  1. +1 −1 go.mod
  2. +2 −2 go.sum
  3. +9 −4 pkg/golinters/contextcheck.go
  4. +1 −2 pkg/lint/lintersdb/manager.go
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -90,7 +90,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
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -302,8 +302,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").