golangci/golangci-lint · info

config is disabled by --no-config

Error message

config is disabled by --no-config

What it means

errConfigDisabled is the sentinel error (declared in loader.go) returned by evaluateOptions/setConfigFile when --no-config is set. It is not a failure: callers check errors.Is(err, errConfigDisabled) and silently skip config loading, meaning the run proceeds with default settings.

Source

Thrown at pkg/config/loader.go:18

package config

import (
	"context"
	"errors"
	"fmt"
	"os"
	"slices"

	"github.com/spf13/pflag"
	"github.com/spf13/viper"

	"github.com/golangci/golangci-lint/v2/pkg/fsutils"
	"github.com/golangci/golangci-lint/v2/pkg/goutil"
	"github.com/golangci/golangci-lint/v2/pkg/logutils"
)

var errConfigDisabled = errors.New("config is disabled by --no-config")

const (
	modeLinters    = "linters"
	modeFormatters = "formatters"
)

type LoaderOptions struct {
	Config   string // Flag only. The path to the golangci config file, as specified with the --config argument.
	NoConfig bool   // Flag only.
}

type LoadOptions struct {
	CheckDeprecation bool
	Validation       bool
}

type Loader struct {
	*BaseLoader

View on GitHub (pinned to ed7a235d2d)

Solutions

  1. Remove the --no-config flag to load .golangci.yml again.
  2. Use --config <file> to load a specific config even from another directory.
  3. In code, treat errors.Is(err, errConfigDisabled) as a non-fatal condition, matching the loader's own handling.

Example fix

// before
if err := l.Load(target); err != nil { return err } // treats no-config as failure

// after
if err := l.Load(target); err != nil && !errors.Is(err, errConfigDisabled) { return err }
Defensive patterns

Strategy: try-catch

Try / catch

err := loader.Load(target)
if err != nil && !errors.Is(err, errConfigDisabled) {
    return fmt.Errorf("loading config: %w", err)
}
// errConfigDisabled means defaults are in use; not fatal.

Prevention

When it happens

Trigger: Running golangci-lint with --no-config; the loader detects opts.NoConfig in evaluateOptions (base_loader.go:89) and setConfigFile treats it as a normal early-exit at base_loader.go:62.

Common situations: Intentionally running with defaults in CI; users confused why their .golangci.yml seems ignored — because --no-config suppressed it entirely.

Related errors


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