golangci/golangci-lint · error
enable-all and enabled-checks options must not be combined
Error message
enable-all and enabled-checks options must not be combined
What it means
With gocritic enable-all enabled, listing enabled-checks is rejected because it conflicts with the semantics of turning everything on. validateOptionsCombinations throws this to prevent ambiguous configurations where inclusion lists and bulk enable coexist.
Solutions
- Remove enabled-checks when enable-all is set
- Use disabled-checks with enable-all to turn off specific checks instead
- Drop enable-all if per-check opt-in (enabled-checks) is the desired behavior
- Verify config with 'golangci-lint config verify' before CI runs
Example fix
// before (.golangci.yml)
gocritic:
enable-all: true
enabled-checks:
- rangeValCopy
// after
gocritic:
enable-all: true
disabled-checks:
- hugeParam Defensive patterns
Strategy: validation
Validate before calling
if cfg.Gocritic.EnableAll && len(cfg.Gocritic.EnabledChecks) > 0 {
return errors.New("gocritic: use disabled-checks instead of enabled-checks with enable-all")
} Prevention
- Replace enabled-checks with disabled-checks when enable-all is on
- Keep exclusion lists (disabled-checks) as the single source of adjustments
- Verify config in CI before linting
When it happens
Trigger: gocritic settings combine enable-all: true with a non-empty enabled-checks list in .golangci.yml.
Common situations: Adding enable-all on top of an existing check-by-check config; scripts that append enable-all without cleaning enabled-checks; misunderstanding that enable-all acts as a default rather than a strict mode.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- disable-all and disabled-tags options must not be combined
- enable-all and disable-all options must not be combined
- enable-all and enabled-tags options must not be combined
- can't load config
- can't load config
AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02).
Data as JSON: /api/errors/177595e4c1dc60d3.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/golinters/gocritic/gocritic_settings.go:310
return err
}
}
return nil
}
func (s *settingsWrapper) validateOptionsCombinations() error {
if s.EnableAll && s.DisableAll {
return errors.New("enable-all and disable-all options must not be combined")
}
switch {
case s.EnableAll:
if len(s.EnabledTags) > 0 {
return errors.New("enable-all and enabled-tags options must not be combined")
}
if len(s.EnabledChecks) > 0 {
return errors.New("enable-all and enabled-checks options must not be combined")
}
case s.DisableAll:
if len(s.DisabledTags) > 0 {
return errors.New("disable-all and disabled-tags options must not be combined")
}
if len(s.DisabledChecks) > 0 {
return errors.New("disable-all and disabled-checks options must not be combined")
}
if len(s.EnabledTags) == 0 && len(s.EnabledChecks) == 0 {
return errors.New("all checks were disabled, but no one check was enabled: at least one must be enabled")
}
}
return nil
}View on GitHub (pinned to ed7a235d2d)