mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
fix: loop variable capture and linter (#7328)
Enable copyloopvar linter and remove redundant variable shadowing in Kubernetes plugin metadata handling. This pattern is no longer needed in Go 1.22+ where loop variables are automatically captured correctly in closures. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
@@ -2,13 +2,14 @@ version: "2"
|
|||||||
linters:
|
linters:
|
||||||
default: none
|
default: none
|
||||||
enable:
|
enable:
|
||||||
|
- copyloopvar
|
||||||
- govet
|
- govet
|
||||||
- ineffassign
|
- ineffassign
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- unconvert
|
- unconvert
|
||||||
- unused
|
- unused
|
||||||
- whitespace
|
|
||||||
- usetesting
|
- usetesting
|
||||||
|
- whitespace
|
||||||
exclusions:
|
exclusions:
|
||||||
generated: lax
|
generated: lax
|
||||||
presets:
|
presets:
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ func (k *Kubernetes) Metadata(ctx context.Context, state request.Request) contex
|
|||||||
})
|
})
|
||||||
|
|
||||||
for k, v := range pod.Labels {
|
for k, v := range pod.Labels {
|
||||||
v := v
|
|
||||||
metadata.SetValueFunc(ctx, "kubernetes/client-label/"+k, func() string {
|
metadata.SetValueFunc(ctx, "kubernetes/client-label/"+k, func() string {
|
||||||
return v
|
return v
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user