golangci/golangci-lint · error
enable-all and enabled-tags options must not be combined
Error message
enable-all and enabled-tags options must not be combined
What it means
When gocritic's enable-all is set, using enabled-tags is contradictory: enable-all already turns on every check, so tag-based inclusion is meaningless and rejected by validateOptionsCombinations. The library fails fast rather than silently ignoring one of the options.
Source
Thrown at pkg/golinters/gocritic/gocritic_settings.go:306
s.validateDisabledAndEnabledAtOneMoment,
s.validateAtLeastOneCheckerEnabled,
} {
if err := v(); err != nil {
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")
}View on GitHub (pinned to ed7a235d2d)
Solutions
- Remove enabled-tags when using enable-all
- If you want everything except some checks, use enable-all with disabled-tags instead
- If tags are the real intent, replace enable-all with a curated enabled-tags list
- Validate the config with 'golangci-lint config verify' before running
Example fix
// before (.golangci.yml)
gocritic:
enable-all: true
enabled-tags:
- style
// after
gocritic:
enable-all: true
disabled-tags:
- opinionated Defensive patterns
Strategy: validation
Validate before calling
if cfg.Gocritic.EnableAll && len(cfg.Gocritic.EnabledTags) > 0 {
return errors.New("gocritic: use disabled-tags instead of enabled-tags with enable-all")
} Prevention
- With enable-all, only use disabled-tags/disabled-checks
- Strip enabled-* keys when adopting enable-all
- Validate config before running linters in CI
When it happens
Trigger: gocritic settings have enable-all: true together with a non-empty enabled-tags list in .golangci.yml.
Common situations: Upgrading from a tag-based config to enable-all and forgetting to remove enabled-tags; merging team configs with different philosophies; copy-pasting settings blocks from different examples.
Related errors
- enable-all and disable-all options must not be combined
- enable-all and enabled-checks options must not be combined
- disable-all and disabled-tags options must not be combined
- the configuration contains invalid elements
- the configuration contains invalid elements
AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02).
Data as JSON: /api/errors/80b82028d17e0fbe.
Report an issue: GitHub.