Skip to content

Commit

Permalink
fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Sep 28, 2023
1 parent 6010091 commit e229efe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion pkg/bootstrap/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions pkg/scaffold/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check failure on line 229 in pkg/scaffold/helm.go

View workflow job for this annotation

GitHub Actions / Lint

commentFormatting: put a space between `//` and comment text (gocritic)
Expand Down
13 changes: 7 additions & 6 deletions pkg/utils/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{} {
Expand All @@ -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)
Expand Down

0 comments on commit e229efe

Please sign in to comment.