mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Avoid closing over range variables
The consequence is only a misleading error message, but it is easy to avoid.
This commit is contained in:
parent
c347f579a3
commit
3aa4f50aba
@ -164,7 +164,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
|
||||
}
|
||||
|
||||
// Add field label conversions for kinds having selectable nothing but ObjectMeta fields.
|
||||
for _, kind := range []string{
|
||||
for _, k := range []string{
|
||||
"Endpoints",
|
||||
"ResourceQuota",
|
||||
"PersistentVolumeClaim",
|
||||
@ -172,6 +172,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
|
||||
"ServiceAccount",
|
||||
"ConfigMap",
|
||||
} {
|
||||
kind := k // don't close over range variables
|
||||
err = scheme.AddFieldLabelConversionFunc("v1", kind,
|
||||
func(label, value string) (string, string, error) {
|
||||
switch label {
|
||||
|
@ -57,7 +57,8 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
|
||||
}
|
||||
|
||||
// Add field label conversions for kinds having selectable nothing but ObjectMeta fields.
|
||||
for _, kind := range []string{"DaemonSet", "Deployment", "Ingress"} {
|
||||
for _, k := range []string{"DaemonSet", "Deployment", "Ingress"} {
|
||||
kind := k // don't close over range variables
|
||||
err = api.Scheme.AddFieldLabelConversionFunc("extensions/v1beta1", kind,
|
||||
func(label, value string) (string, string, error) {
|
||||
switch label {
|
||||
|
Loading…
Reference in New Issue
Block a user