{"record":{"id":"d31961fd37728ed5","repo":"golangci/golangci-lint","slug":"enable-all-and-disable-all-options-must-not-be-com","errorCode":null,"errorMessage":"enable-all and disable-all options must not be combined","messagePattern":"enable-all and disable-all options must not be combined","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/golinters/gocritic/gocritic_settings.go","lineNumber":300,"sourceCode":"// validate tries to be consistent with (lintersdb.Validator).validateEnabledDisabledLintersConfig.\nfunc (s *settingsWrapper) validate() error {\n\tfor _, v := range []func() error{\n\t\ts.validateOptionsCombinations,\n\t\ts.validateCheckerTags,\n\t\ts.validateCheckerNames,\n\t\ts.validateDisabledAndEnabledAtOneMoment,\n\t\ts.validateAtLeastOneCheckerEnabled,\n\t} {\n\t\tif err := v(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (s *settingsWrapper) validateOptionsCombinations() error {\n\tif s.EnableAll && s.DisableAll {\n\t\treturn errors.New(\"enable-all and disable-all options must not be combined\")\n\t}\n\n\tswitch {\n\tcase s.EnableAll:\n\t\tif len(s.EnabledTags) > 0 {\n\t\t\treturn errors.New(\"enable-all and enabled-tags options must not be combined\")\n\t\t}\n\n\t\tif len(s.EnabledChecks) > 0 {\n\t\t\treturn errors.New(\"enable-all and enabled-checks options must not be combined\")\n\t\t}\n\n\tcase s.DisableAll:\n\t\tif len(s.DisabledTags) > 0 {\n\t\t\treturn errors.New(\"disable-all and disabled-tags options must not be combined\")\n\t\t}\n\n\t\tif len(s.DisabledChecks) > 0 {","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/golangci/golangci-lint/blob/ed7a235d2d771152056fdc142a9855567c5796a9/pkg/golinters/gocritic/gocritic_settings.go#L282-L318","documentation":"gocritic's settings wrapper validates that exclusive bulk-selection options are not combined. Enabling every check (enable-all) while also disabling all checks (disable-all) is contradictory, so validateOptionsCombinations rejects the config outright.","triggerScenarios":"gocritic settings contain both enabled-tags/enable-all set true and disable-all set true simultaneously in .golangci.yml under linters-settings.gocritic.","commonSituations":"Merging two config files, one using enable-all and one disable-all; toggling bulk options while experimenting and forgetting to clear the other; templated configs that set both flags.","solutions":["Remove either enable-all or disable-all from gocritic settings so only one bulk mode is set","Keep enable-all and use disabled-tags/disabled-checks to exclude specific checks","Keep disable-all and use enabled-tags/enabled-checks to opt in selectively","Run golangci-lint config verify to catch the conflicting combination early"],"exampleFix":"// before (.golangci.yml)\ngocritic:\n  enable-all: true\n  disable-all: true\n\n// after\ngocritic:\n  enable-all: true\n  disabled-checks:\n    - hugeParam","handlingStrategy":"validation","validationCode":"g := cfg.Gocritic\nif g.EnableAll && g.DisableAll {\n    return errors.New(\"gocritic: enable-all and disable-all must not be combined\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one bulk mode: enable-all (opt-out) or disable-all (opt-in)","Review merged configs for duplicate gocritic keys","Add 'golangci-lint config verify' to CI"],"tags":["gocritic","config","golangci-lint","validation"],"backgroundTag":"conflicting-config-options","analyzedSha":"ed7a235d2d771152056fdc142a9855567c5796a9","analyzedAt":"2026-09-02T18:47:33.865Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}