From e229efebe2a6109dfa8dd5716a1cfba1d6bc28d9 Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Thu, 28 Sep 2023 09:51:29 +0200 Subject: [PATCH] fix linter issues --- pkg/bootstrap/check.go | 1 - pkg/scaffold/helm.go | 4 ++-- pkg/utils/map.go | 13 +++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/bootstrap/check.go b/pkg/bootstrap/check.go index 8bb452c8..5a528ebd 100644 --- a/pkg/bootstrap/check.go +++ b/pkg/bootstrap/check.go @@ -64,7 +64,6 @@ func IsClusterPhase(context, name, namespace string, phase capi.ClusterPhase) (b return c.Status.GetTypedPhase() == phase, nil } - // CheckClusterReadiness checks if Cluster API cluster is in ready state. func CheckClusterReadiness(name, namespace string) (bool, error) { utils.Highlight("Checking cluster status") diff --git a/pkg/scaffold/helm.go b/pkg/scaffold/helm.go index 0f9eb373..ecb2240a 100644 --- a/pkg/scaffold/helm.go +++ b/pkg/scaffold/helm.go @@ -222,8 +222,8 @@ func (s *Scaffold) buildChartValues(w *wkspace.Workspace) error { } // TODO: Remove this after testing. It is deprecated as values.yaml migration should not longer be required. - //mapValues, err := getValues(valuesFile) - //if err != nil { + // mapValues, err := getValues(valuesFile) + // if err != nil { // return err //} //patchValues, err := utils.PatchInterfaceMap(defaultValues, mapValues) diff --git a/pkg/utils/map.go b/pkg/utils/map.go index e20b5727..787bf2f2 100644 --- a/pkg/utils/map.go +++ b/pkg/utils/map.go @@ -94,9 +94,10 @@ var ( // if needed by passing custom DiffCondition function. // // Example: -// A: {a: 1, b: 1, c: 2} -// B: {a: 1, d: 2, c: 3} -// Result: {b: 1, c: 2} +// +// A: {a: 1, b: 1, c: 2} +// B: {a: 1, d: 2, c: 3} +// Result: {b: 1, c: 2} // // Note: It does not remove null value keys by default. func DiffMap(base, diff map[string]interface{}, conditions ...DiffCondition) map[string]interface{} { @@ -108,17 +109,17 @@ func DiffMap(base, diff map[string]interface{}, conditions ...DiffCondition) map } for k, v := range base { - switch v.(type) { + switch f := v.(type) { case map[string]interface{}: dValue, _ := diff[k].(map[string]interface{}) - if dMap := DiffMap(v.(map[string]interface{}), dValue, conditions...); len(dMap) > 0 { + if dMap := DiffMap(f, dValue, conditions...); len(dMap) > 0 { result[k] = dMap break } delete(result, k) default: - diffV, _ := diff[k] + diffV := diff[k] for _, condition := range append(conditions, equalDiffCondition) { if condition(k, v, diffV) { delete(result, k)