{"record":{"id":"4897dea3801de08e","repo":"golangci/golangci-lint","slug":"govet-enable-all-and-disable-all-can-t-be-combine","errorCode":null,"errorMessage":"govet: enable-all and disable-all can't be combined","messagePattern":"govet: enable-all and disable-all can't be combined","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/linters_settings.go","lineNumber":728,"sourceCode":"\tAllowTimeLocal  bool     `mapstructure:\"allow-time-local\"`\n\tEscapeHatches   []string `mapstructure:\"escape-hatches\"`\n\tWatchForScripts []string `mapstructure:\"watch-for-scripts\"`\n}\n\ntype GovetSettings struct {\n\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\"`","sourceCodeStart":710,"sourceCodeEnd":746,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/config/linters_settings.go#L710-L746","documentation":"GovetSettings.Validate rejects linters-settings.govet configs where both enable-all and disable-all are true. Enabling and disabling all analyzers simultaneously is contradictory, so the config is invalid.","triggerScenarios":"Setting both `enable-all: true` and `disable-all: true` under govet settings in .golangci.yml, then running any command that validates linters settings.","commonSituations":"Copy-pasting config examples that each set a different *-all flag; YAML merge tools combining two govet blocks.","solutions":["Keep only one of enable-all / disable-all set to true under govet.","If the goal is enable-all with a few off, use enable-all: true plus `disable: [...]`.","If the goal is disable-all with a few on, use disable-all: true plus `enable: [...]`."],"exampleFix":"# before\nlinters-settings:\n  govet:\n    enable-all: true\n    disable-all: true\n\n# after\nlinters-settings:\n  govet:\n    enable-all: true\n    disable:\n      - shadow","handlingStrategy":"validation","validationCode":"const govet = cfg['linters-settings']?.govet ?? {};\nif (govet['enable-all'] && govet['disable-all']) {\n  throw new Error('govet: pick either enable-all or disable-all, not both');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Adopt a convention: either enable-all+disable list, or disable-all+enable list.","Validate config in CI with `golangci-lint config verify`.","Review *-all flags after merging config changes."],"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"}