Skip to content

Commit 5fdaf7f

Browse files
committed
fix: replace interface{} with any and fix formatting
- Replace interface{} with any type for Go 1.18+ compatibility - Fix gofumpt formatting issues - Remove trailing spaces and extra blank lines
1 parent b5b6a0d commit 5fdaf7f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

util/argo/normalizers/diff_normalizer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ func (np *jqMultiPathNormalizerPatch) Apply(data []byte) ([]byte, error) {
158158
if strings.Contains(np.pathExpression, ".metadata.annotations") && strings.Contains(np.pathExpression, "keys[]") {
159159
// This is selecting annotation keys, so we need to delete those specific annotations
160160
result := dataJSON
161-
if metadata, ok := result["metadata"].(map[string]interface{}); ok {
162-
if annotations, ok := metadata["annotations"].(map[string]interface{}); ok {
161+
if metadata, ok := result["metadata"].(map[string]any); ok {
162+
if annotations, ok := metadata["annotations"].(map[string]any); ok {
163163
for _, key := range pathsToDelete {
164164
delete(annotations, key)
165165
}
@@ -169,7 +169,7 @@ func (np *jqMultiPathNormalizerPatch) Apply(data []byte) ([]byte, error) {
169169
}
170170
}
171171
}
172-
172+
173173
patchedData, err := json.Marshal(result)
174174
if err != nil {
175175
return nil, err
@@ -192,7 +192,7 @@ func (np *jqMultiPathNormalizerPatch) Apply(data []byte) ([]byte, error) {
192192
iter := deletionCode.RunWithContext(ctx, result)
193193
if v, ok := iter.Next(); ok {
194194
if _, isErr := v.(error); !isErr {
195-
result = v.(map[string]interface{})
195+
result = v.(map[string]any)
196196
}
197197
}
198198
}

util/argo/normalizers/diff_normalizer_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ func TestNormalizeJQPathExpressionMultipleFields(t *testing.T) {
307307
deployment := test.NewDeployment()
308308

309309
// Add annotations with custom prefix and other annotations
310-
annotations := map[string]interface{}{
310+
annotations := map[string]any{
311311
"customprefix.foo": "value1",
312-
"customprefix.bar": "value2",
312+
"customprefix.bar": "value2",
313313
"other.annotation": "value3",
314314
"another.annotation": "value4",
315315
}
@@ -353,7 +353,7 @@ func TestNormalizeJQPathExpressionMultipleFieldsNoMatch(t *testing.T) {
353353
deployment := test.NewDeployment()
354354

355355
// Add annotations without the target prefix
356-
annotations := map[string]interface{}{
356+
annotations := map[string]any{
357357
"customprefix.foo": "value1",
358358
"other.annotation": "value3",
359359
}

0 commit comments

Comments
 (0)