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

  1. Remove enabled-tags when using enable-all
  2. If you want everything except some checks, use enable-all with disabled-tags instead
  3. If tags are the real intent, replace enable-all with a curated enabled-tags list
  4. 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

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


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