golangci/golangci-lint · error

analyzer doesn't have settings

Error message

analyzer doesn't have settings

What it means

goanalysis linters are configured by mapping config keys onto Go 'flag' values registered on the analysis.Analyzer. This error is thrown when a settings key is supplied for an analyzer that has no flags at all, so there is nothing to configure. It surfaces while building the analyzer set (via configure -> configureAnalyzer).

Source

Thrown at pkg/goanalysis/linter.go:147

func (lnt *Linter) Desc() string {
	return lnt.desc
}

func (lnt *Linter) allAnalyzerNames() []string {
	var ret []string
	for _, a := range lnt.analyzers {
		ret = append(ret, a.Name)
	}
	return ret
}

func (*Linter) configureAnalyzer(a *analysis.Analyzer, cfg map[string]any) error {
	for k, v := range cfg {
		f := a.Flags.Lookup(k)
		if f == nil {
			validFlagNames := allFlagNames(&a.Flags)
			if len(validFlagNames) == 0 {
				return errors.New("analyzer doesn't have settings")
			}

			return fmt.Errorf("analyzer doesn't have setting %q, valid settings: %v",
				k, validFlagNames)
		}

		if err := f.Value.Set(valueToString(v)); err != nil {
			return fmt.Errorf("failed to set analyzer setting %q with value %q: %w", k, v, err)
		}
	}

	return nil
}

func (lnt *Linter) configure() error {
	analyzersMap := map[string]*analysis.Analyzer{}
	for _, a := range lnt.analyzers {
		analyzersMap[a.Name] = a

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Remove the settings block for that linter in .golangci.yml
  2. Check the linter's documentation for the list of valid settings in your golangci-lint version
  3. Pin config to a compatible golangci-lint version or migrate settings to the current option names
  4. Run golangci-lint config verify to detect unknown settings before running the linter

Example fix

// before (.golangci.yml)
linters-settings:
  some-linter:
    option: true

// after
linters-settings:
  # some-linter has no settings; block removed
Defensive patterns

Strategy: validation

Validate before calling

noSettingsLinters := []string{"some-linter"}
for _, name := range noSettingsLinters {
    if s := cfg.LintersSettings[name]; s != nil && len(s) > 0 {
        return fmt.Errorf("linter %q accepts no settings", name)
    }
}

Prevention

When it happens

Trigger: Passing any settings map (even a single key) under the linter's name in .golangci.yml when the analyzer exposes zero flags, e.g. 'settings: { something: true }' for a linter with no configurable options.

Common situations: Copying a settings block for a linter version that later removed all its flags; adding settings to linters that never accepted any; enabling an analyzer whose options are configured elsewhere (e.g. go vet analyzers).

Related errors


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