Skip to content

Commit

Permalink
Merge pull request #3653 from alingse/fix-nilness-err
Browse files Browse the repository at this point in the history
fix: check `cerr != nil` but return a nil value error `err`
  • Loading branch information
dougm authored Dec 17, 2024
2 parents 3def2df + 3793a5b commit 04ddb84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/fields/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (cmd *info) Run(ctx context.Context, f *flag.FlagSet) error {
if cmd.name != "" {
fkey, cerr := m.FindKey(ctx, cmd.name)
if cerr != nil {
return err
return cerr
}
matches = func(key int32) bool {
return key == fkey
Expand Down
5 changes: 4 additions & 1 deletion govc/test/fields.bats
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ load test_helper
run govc fields.info vm/$vm_id
assert_success

run govc fields.info -n $val vm/$vm_id
run govc fields.info -n "invalid" vm/$vm_id
assert_failure

run govc fields.info -n $field vm/$vm_id
assert_success

info=$(govc vm.info -json $vm_id | jq .virtualMachines[0].customValue[0])
Expand Down

0 comments on commit 04ddb84

Please sign in to comment.