Welcome
How did you install golangci-lint?
Official binary
Your feature request related to a problem? Please describe
goconst's Config.ExcludeTypes map can suppress findings by AST context (Assignment, Binary, Case, Return, Call, CompositeLit). golangci-lint only surfaces the Call entry, via ignore-calls.
There is no way to opt out of CompositeLit from config. Since v2.12 bundled goconst v1.9.0+, which added composite-literal element walking, every string used as a map key, struct field value, or slice element is now reported:
metav1.TypeMeta{APIVersion: "v1", Kind: "ConfigMap"}
map[string]any{"phase": "Pending", "message": "..."}
In a repo with Pulumi stacks and Kubernetes controllers, the v2.11 → v2.12 bump took us from ~5 to 383 findings, ~95% of them inside composite literals.
Describe the solution you'd like
Surface ExcludeTypes[CompositeLit] (and ideally the other Type values) in the goconst linter settings, the same way ExcludeTypes[Call] is surfaced today via ignore-calls.
Describe alternatives you've considered
linters.exclusions.rules with path: — drops goconst wholesale on the affected directories.
goconst.ignore-string-values listing every repeated Helm key / Kubernetes Kind / apiVersion — needs ~70 lines of yaml that grows with every new chart.
source:-regex exclusion matching ^\s*"[^"]+":\s* — covers map-key lines but not struct-field-value lines.
All three are workarounds for a knob that already exists in the underlying linter.
Additional context
Supporter
Welcome
How did you install golangci-lint?
Official binary
Your feature request related to a problem? Please describe
goconst'sConfig.ExcludeTypesmap can suppress findings by AST context (Assignment,Binary,Case,Return,Call,CompositeLit). golangci-lint only surfaces theCallentry, viaignore-calls.There is no way to opt out of
CompositeLitfrom config. Since v2.12 bundled goconst v1.9.0+, which added composite-literal element walking, every string used as a map key, struct field value, or slice element is now reported:In a repo with Pulumi stacks and Kubernetes controllers, the v2.11 → v2.12 bump took us from ~5 to 383 findings, ~95% of them inside composite literals.
Describe the solution you'd like
Surface
ExcludeTypes[CompositeLit](and ideally the otherTypevalues) in the goconst linter settings, the same wayExcludeTypes[Call]is surfaced today viaignore-calls.Describe alternatives you've considered
linters.exclusions.ruleswithpath:— dropsgoconstwholesale on the affected directories.goconst.ignore-string-valueslisting every repeated Helm key / Kubernetes Kind / apiVersion — needs ~70 lines of yaml that grows with every new chart.source:-regex exclusion matching^\s*"[^"]+":\s*— covers map-key lines but not struct-field-value lines.All three are workarounds for a knob that already exists in the underlying linter.
Additional context
Typeenum: https://github.com/jgautheron/goconst/blob/v1.10.0/parser.gogolangci-lint v2.12.2,goconst v1.10.0.Supporter