Skip to content

Commit

Permalink
contextcheck: remove disable-fact config
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvia7788 committed Aug 20, 2022
1 parent 616395d commit 3a47f8d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 20 deletions.
7 changes: 0 additions & 7 deletions .golangci.reference.yml
Expand Up @@ -1847,11 +1847,6 @@ linters-settings:
# Default: true
strict-append: true

contextcheck:
# If you use contextcheck in docker ci, and feel a little bit slow, you can turn on this option.
# Default: false
disable-fact: true

# The custom section can be used to define linter plugins to be loaded at runtime.
# See README documentation for more info.
custom:
Expand Down Expand Up @@ -1970,7 +1965,6 @@ linters:
- whitespace
- wrapcheck
- wsl
- contextcheck

# Enable all available linters.
# Default: false
Expand Down Expand Up @@ -2073,7 +2067,6 @@ linters:
- whitespace
- wrapcheck
- wsl
- contextcheck

# Enable presets.
# https://golangci-lint.run/usage/linters
Expand Down
5 changes: 0 additions & 5 deletions pkg/config/linters_settings.go
Expand Up @@ -184,7 +184,6 @@ type LintersSettings struct {
Whitespace WhitespaceSettings
Wrapcheck WrapcheckSettings
WSL WSLSettings
ContextCheck ContextCheckSettings

Custom map[string]CustomLinterSettings
}
Expand Down Expand Up @@ -657,10 +656,6 @@ type WSLSettings struct {
ForceCaseTrailingWhitespaceLimit int `mapstructure:"force-case-trailing-whitespace"`
}

type ContextCheckSettings struct {
DisableFact bool `mapstructure:"disable-fact"`
}

// CustomLinterSettings encapsulates the meta-data of a private linter.
// For example, a private linter may be added to the golangci config file as shown below.
//
Expand Down
6 changes: 1 addition & 5 deletions pkg/golinters/contextcheck.go
Expand Up @@ -4,16 +4,12 @@ import (
"github.com/sylvia7788/contextcheck"
"golang.org/x/tools/go/analysis"

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

func NewContextCheck(settings *config.ContextCheckSettings) *goanalysis.Linter {
func NewContextCheck() *goanalysis.Linter {
conf := contextcheck.Configuration{}
if settings != nil {
conf.DisableFact = settings.DisableFact
}
analyzer := contextcheck.NewAnalyzer(conf)
return goanalysis.NewLinter(
"contextcheck",
Expand Down
4 changes: 1 addition & 3 deletions pkg/lint/lintersdb/manager.go
Expand Up @@ -170,7 +170,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
whitespaceCfg *config.WhitespaceSettings
wrapcheckCfg *config.WrapcheckSettings
wslCfg *config.WSLSettings
contextcheckCfg *config.ContextCheckSettings
)

if m.cfg != nil {
Expand Down Expand Up @@ -242,7 +241,6 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
whitespaceCfg = &m.cfg.LintersSettings.Whitespace
wrapcheckCfg = &m.cfg.LintersSettings.Wrapcheck
wslCfg = &m.cfg.LintersSettings.WSL
contextcheckCfg = &m.cfg.LintersSettings.ContextCheck

if govetCfg != nil {
govetCfg.Go = m.cfg.Run.Go
Expand Down Expand Up @@ -298,7 +296,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
WithPresets(linter.PresetStyle).
WithURL("https://github.com/sivchari/containedctx"),

linter.NewConfig(golinters.NewContextCheck(contextcheckCfg)).
linter.NewConfig(golinters.NewContextCheck()).
WithSince("v1.43.0").
WithPresets(linter.PresetBugs).
WithLoadForGoAnalysis().
Expand Down

0 comments on commit 3a47f8d

Please sign in to comment.