{"record":{"id":"6effd9f826bbd272","repo":"golangci/golangci-lint","slug":"govet-disable-all-and-disable-can-t-be-combined","errorCode":null,"errorMessage":"govet: disable-all and disable can't be combined","messagePattern":"govet: disable-all and disable can't be combined","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/linters_settings.go","lineNumber":734,"sourceCode":"\tGo string `mapstructure:\"-\"`\n\n\tEnable     []string `mapstructure:\"enable\"`\n\tDisable    []string `mapstructure:\"disable\"`\n\tEnableAll  bool     `mapstructure:\"enable-all\"`\n\tDisableAll bool     `mapstructure:\"disable-all\"`\n\n\tSettings map[string]map[string]any `mapstructure:\"settings\"`\n}\n\nfunc (cfg *GovetSettings) Validate() error {\n\tif cfg.EnableAll && cfg.DisableAll {\n\t\treturn errors.New(\"govet: enable-all and disable-all can't be combined\")\n\t}\n\tif cfg.EnableAll && len(cfg.Enable) != 0 {\n\t\treturn errors.New(\"govet: enable-all and enable can't be combined\")\n\t}\n\tif cfg.DisableAll && len(cfg.Disable) != 0 {\n\t\treturn errors.New(\"govet: disable-all and disable can't be combined\")\n\t}\n\treturn nil\n}\n\ntype GrouperSettings struct {\n\tConstRequireSingleConst   bool `mapstructure:\"const-require-single-const\"`\n\tConstRequireGrouping      bool `mapstructure:\"const-require-grouping\"`\n\tImportRequireSingleImport bool `mapstructure:\"import-require-single-import\"`\n\tImportRequireGrouping     bool `mapstructure:\"import-require-grouping\"`\n\tTypeRequireSingleType     bool `mapstructure:\"type-require-single-type\"`\n\tTypeRequireGrouping       bool `mapstructure:\"type-require-grouping\"`\n\tVarRequireSingleVar       bool `mapstructure:\"var-require-single-var\"`\n\tVarRequireGrouping        bool `mapstructure:\"var-require-grouping\"`\n}\n\ntype IfaceSettings struct {\n\tEnable   []string                  `mapstructure:\"enable\"`\n\tSettings map[string]map[string]any `mapstructure:\"settings\"`","sourceCodeStart":716,"sourceCodeEnd":752,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/config/linters_settings.go#L716-L752","documentation":"Validation guard in GovetSettings.Validate: the user's golangci-lint config set both disable-all and enable under linters-settings.govet, which is contradictory (disable-all turns every govet analyzer off, so an enable list has nothing to enable). The check compares the DisableAll flag against a non-empty Enable slice and fails fast before running.","triggerScenarios":"Config with `disable-all: true` plus a non-empty `disable:` list under govet settings.","commonSituations":"Copy-pasted settings where someone added disable-all: true but kept an old `disable:` list; config merge artifacts.","solutions":["Remove the `disable:` list entries (redundant under disable-all).","Set disable-all: false and use an explicit `disable:` list with default-enabled analyzers.","List the analyzers you actually want in `enable:` instead."],"exampleFix":"# before\nlinters-settings:\n  govet:\n    disable-all: true\n    disable:\n      - shadow\n\n# after\nlinters-settings:\n  govet:\n    disable-all: true\n    enable:\n      - bodyclose","handlingStrategy":"validation","validationCode":"const govet = cfg['linters-settings']?.govet ?? {};\nif (govet['disable-all'] && (govet.disable ?? []).length > 0) {\n  throw new Error('govet: remove `disable` list when disable-all is true');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When switching to disable-all, move former `disable` entries to `enable` if needed.","Run `golangci-lint config verify` before committing config changes.","Keep govet settings minimal and reviewed."],"tags":["govet","configuration","validation"],"backgroundTag":"mutually-exclusive-config-options","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}