golangci/golangci-lint · error

enable-all and disable-all options must not be combined

Error message

enable-all and disable-all options must not be combined

What it means

gocritic's settings wrapper validates that exclusive bulk-selection options are not combined. Enabling every check (enable-all) while also disabling all checks (disable-all) is contradictory, so validateOptionsCombinations rejects the config outright.

Source

Thrown at pkg/golinters/gocritic/gocritic_settings.go:300

// validate tries to be consistent with (lintersdb.Validator).validateEnabledDisabledLintersConfig.
func (s *settingsWrapper) validate() error {
	for _, v := range []func() error{
		s.validateOptionsCombinations,
		s.validateCheckerTags,
		s.validateCheckerNames,
		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 {

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Remove either enable-all or disable-all from gocritic settings so only one bulk mode is set
  2. Keep enable-all and use disabled-tags/disabled-checks to exclude specific checks
  3. Keep disable-all and use enabled-tags/enabled-checks to opt in selectively
  4. Run golangci-lint config verify to catch the conflicting combination early

Example fix

// before (.golangci.yml)
gocritic:
  enable-all: true
  disable-all: true

// after
gocritic:
  enable-all: true
  disabled-checks:
    - hugeParam
Defensive patterns

Strategy: validation

Validate before calling

g := cfg.Gocritic
if g.EnableAll && g.DisableAll {
    return errors.New("gocritic: enable-all and disable-all must not be combined")
}

Prevention

When it happens

Trigger: gocritic settings contain both enabled-tags/enable-all set true and disable-all set true simultaneously in .golangci.yml under linters-settings.gocritic.

Common situations: Merging two config files, one using enable-all and one disable-all; toggling bulk options while experimenting and forgetting to clear the other; templated configs that set both flags.

Related errors


AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02). Data as JSON: /api/errors/d31961fd37728ed5. Report an issue: GitHub.