{"record":{"id":"d64beb2c1a3b0825","repo":"golangci/golangci-lint","slug":"s-is-a-formatter","errorCode":null,"errorMessage":"%s is a formatter","messagePattern":"(.+?) is a formatter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/linters.go","lineNumber":44,"sourceCode":"func (l *Linters) Validate() error {\n\tvalidators := []func() error{\n\t\tl.Exclusions.Validate,\n\t\tl.validateNoFormatters,\n\t}\n\n\tfor _, v := range validators {\n\t\tif err := v(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (l *Linters) validateNoFormatters() error {\n\tfor _, n := range slices.Concat(l.Enable, l.Disable) {\n\t\tif slices.Contains(getAllFormatterNames(), n) {\n\t\t\treturn fmt.Errorf(\"%s is a formatter\", n)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc getAllFormatterNames() []string {\n\treturn []string{\"gci\", \"gofmt\", \"gofumpt\", \"goimports\", \"golines\", \"swaggo\"}\n}\n","sourceCodeStart":26,"sourceCodeEnd":54,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/config/linters.go#L26-L54","documentation":"Linters.validateNoFormatters rejects any name in linters.enable or linters.disable that is actually a formatter. In golangci-lint v2, formatters were split out of linters, so configuring e.g. 'gofmt' under linters is an error rather than silently accepted.","triggerScenarios":"v1-style config where gofmt/goimports/gofumpt etc. are listed under linters.enable or linters.disable; running golangci-lint v2 on an unmigrated config.","commonSituations":"Upgrading from golangci-lint v1 to v2 without running the migration; copy-pasting old configs; disabling a formatter via linters.disable.","solutions":["Move formatter names from linters.enable to formatters.enable","Remove formatter names from linters.disable and use formatters settings instead","Run 'golangci-lint migrate' to auto-convert a v1 config to v2"],"exampleFix":"# before\nlinters:\n  enable:\n    - gofmt\n    - revive\n# after\nlinters:\n  enable:\n    - revive\nformatters:\n  enable:\n    - gofmt","handlingStrategy":"validation","validationCode":"formatterNames := getAllFormatterNames()\nfor _, n := range slices.Concat(cfg.Linters.Enable, cfg.Linters.Disable) {\n\tif slices.Contains(formatterNames, n) {\n\t\treturn fmt.Errorf(\"%s is a formatter; move it to formatters\", n)\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err := linters.Validate(); err != nil { log.Fatalf(\"linters config: %v\", err) }","preventionTips":["After upgrading to v2, run 'golangci-lint migrate' on old configs","Never list gofmt/goimports/gofumpt under linters","Use 'golangci-lint config verify' in CI"],"tags":["golangci-lint","config-validation","migration"],"backgroundTag":"formatter-configured-as-linter","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}