Commit 3aa4f50a authored by Justin Santa Barbara's avatar Justin Santa Barbara

Avoid closing over range variables

The consequence is only a misleading error message, but it is easy to avoid.
parent c347f579
...@@ -164,7 +164,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error { ...@@ -164,7 +164,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
} }
// Add field label conversions for kinds having selectable nothing but ObjectMeta fields. // Add field label conversions for kinds having selectable nothing but ObjectMeta fields.
for _, kind := range []string{ for _, k := range []string{
"Endpoints", "Endpoints",
"ResourceQuota", "ResourceQuota",
"PersistentVolumeClaim", "PersistentVolumeClaim",
...@@ -172,6 +172,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error { ...@@ -172,6 +172,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
"ServiceAccount", "ServiceAccount",
"ConfigMap", "ConfigMap",
} { } {
kind := k // don't close over range variables
err = scheme.AddFieldLabelConversionFunc("v1", kind, err = scheme.AddFieldLabelConversionFunc("v1", kind,
func(label, value string) (string, string, error) { func(label, value string) (string, string, error) {
switch label { switch label {
......
...@@ -57,7 +57,8 @@ func addConversionFuncs(scheme *runtime.Scheme) error { ...@@ -57,7 +57,8 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
} }
// Add field label conversions for kinds having selectable nothing but ObjectMeta fields. // 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, err = api.Scheme.AddFieldLabelConversionFunc("extensions/v1beta1", kind,
func(label, value string) (string, string, error) { func(label, value string) (string, string, error) {
switch label { switch label {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment