mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
encoding/json: address go vet reports
The error message for decoding a unquoted value into a struct field with
the ,string option specified has two arguments when one is needed.
Make the error message take one argument and add a test in order to cover
the case when a unquoted value is specified.
Also add error value as the missing argument for Fatalf call in test.
Fixes the following go vet reports:
decode.go:602: wrong number of args for format in Errorf call: 1 needed but 2 args
decode_test.go:1088: missing argument for Fatalf("%v"): format reads arg 1, have only 0 args
Change-Id: Id036e10c54c4a7c1ee9952f6910858ecc2b84134
Reviewed-on: https://go-review.googlesource.com/2109
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
This commit is contained in:
parent
b6e913806e
commit
2c987e1693
2 changed files with 3 additions and 2 deletions
|
|
@ -599,7 +599,7 @@ func (d *decodeState) object(v reflect.Value) {
|
|||
case string:
|
||||
d.literalStore([]byte(qv), subv, true)
|
||||
default:
|
||||
d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal unquoted value into %v", item, v.Type()))
|
||||
d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal unquoted value into %v", subv.Type()))
|
||||
}
|
||||
} else {
|
||||
d.value(subv)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue