Skip to content

Commit

Permalink
getSingleImpl: don't check whether a map value is zero
Browse files Browse the repository at this point in the history
The code that checked whether a map value is zero was wrong.
It passed the reflect.Value itself, which before Go 1.13 was never zero.
In Go 1.13 this changed, as reflect.Value got an IsZero method,
which reports whether the value stored in the reflect.Value is zero.
Checking that causes tests in go-openapi/spec to fail.

Fixes go-openapi/spec#99

Signed-off-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
ianlancetaylor committed Aug 2, 2019
1 parent a105a90 commit de6c4fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func getSingleImpl(node interface{}, decodedToken string, nameProvider *swag.Nam
kv := reflect.ValueOf(decodedToken)
mv := rValue.MapIndex(kv)

if mv.IsValid() && !swag.IsZero(mv) {
if mv.IsValid() {
return mv.Interface(), kind, nil
}
return nil, kind, fmt.Errorf("object has no key %q", decodedToken)
Expand Down

0 comments on commit de6c4fe

Please sign in to comment.