Skip to content

Commit 6ee3130

Browse files
Fix printf var mixup. (#935)
* Fix printf var mixup. * Act on error condition first.
1 parent c3c72e8 commit 6ee3130

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pkg/resources/virtual/virtual.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,13 @@ func (t *TransformBuilder) GetTransformFunc(gvk schema.GroupVersionKind, columns
5656
}
5757

5858
curValue, got, err := unstructured.NestedSlice(obj.Object, "metadata", "fields")
59-
if !got {
60-
return obj, nil
61-
}
62-
63-
if err != nil {
59+
if err != nil || !got {
6460
return obj, err
6561
}
6662

6763
value, cast := curValue[index].(string)
6864
if !cast {
69-
return obj, fmt.Errorf("could not cast metadata.fields[%d] to string, original value: <%v>", curValue[index], index)
65+
return obj, fmt.Errorf("could not cast metadata.fields[%d] to string, original value: <%v>", index, curValue[index])
7066
}
7167

7268
duration, err := rescommon.ParseTimestampOrHumanReadableDuration(value)

0 commit comments

Comments
 (0)