golangci/golangci-lint · error

cannot use 'enable' with 'default=all'

Error message

cannot use 'enable' with 'default=all'

What it means

Guard in checkSettings, invoked from New when building the godoclint linter: the user set godoclint default=all while also listing rules in enable. With default=all every rule is already on, so an explicit enable list is contradictory and the settings are rejected at linter construction time.

Source

Thrown at pkg/golinters/godoclint/godoclint.go:85

	}

	composition := glcompose.Compose(glcompose.CompositionConfig{
		BaseDirPlainConfig: &pcfg,
		ExitFunc: func(_ int, err error) {
			internal.LinterLogger.Errorf("godoclint: %v", err)
		},
	})

	return goanalysis.
		NewLinterFromAnalyzer(composition.Analyzer.GetAnalyzer()).
		WithLoadMode(goanalysis.LoadModeSyntax)
}

func checkSettings(settings *config.GodoclintSettings) error {
	switch deref(settings.Default) {
	case string(model.DefaultSetAll):
		if len(settings.Enable) > 0 {
			return errors.New("cannot use 'enable' with 'default=all'")
		}

	case string(model.DefaultSetNone):
		if len(settings.Disable) > 0 {
			return errors.New("cannot use 'disable' with 'default=none'")
		}

	default:
		for _, rule := range settings.Enable {
			if slices.Contains(settings.Disable, rule) {
				return fmt.Errorf("a rule cannot be enabled and disabled at the same time: '%s'", rule)
			}
		}

		for _, rule := range settings.Disable {
			if slices.Contains(settings.Enable, rule) {
				return fmt.Errorf("a rule cannot be enabled and disabled at the same time: '%s'", rule)
			}

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Remove the enable list when default=all
  2. Or set default to none/specified and use enable to pick rules
  3. Use disable instead to turn specific rules off under default=all
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/golinters/godoclint/godoclint.go:85 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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