golangci/golangci-lint · error

disable-all and disabled-tags options must not be combined

Error message

disable-all and disabled-tags options must not be combined

What it means

When gocritic's disable-all is set, listing disabled-tags is contradictory: everything is already off, so tag-based exclusions make no sense. validateOptionsCombinations rejects the combination during settings validation.

Source

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

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
}

func (s *settingsWrapper) validateCheckerTags() error {
	for _, tag := range s.EnabledTags {
		if !s.allChecksByTag.has(tag) {
			return fmt.Errorf("enabled tag %q doesn't exist, see %s's documentation", tag, linterName)

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Remove disabled-tags when using disable-all
  2. Select checks with enabled-tags/enabled-checks when disable-all is set
  3. Switch to enable-all with disabled-tags if exclusion-based configuration is intended
  4. Run 'golangci-lint config verify' to catch the conflict before linting

Example fix

// before (.golangci.yml)
gocritic:
  disable-all: true
  disabled-tags:
    - style

// after
gocritic:
  disable-all: true
  enabled-tags:
    - diagnostic
Defensive patterns

Strategy: validation

Validate before calling

if cfg.Gocritic.DisableAll && len(cfg.Gocritic.DisabledTags) > 0 {
    return errors.New("gocritic: use enabled-tags instead of disabled-tags with disable-all")
}

Prevention

When it happens

Trigger: gocritic settings contain disable-all: true together with a non-empty disabled-tags list in .golangci.yml.

Common situations: Merging a disable-all (opt-in) config with an enable-all (opt-out) config; migrating between the two philosophies and leaving stale disabled-tags; generated configs that emit both keys.

Related errors


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