Update vendored dependencies

This commit is contained in:
Nick Sardo 2017-07-31 13:35:10 -07:00
parent 65e8cecbac
commit 9b22796383
666 changed files with 38921 additions and 47120 deletions

View file

@ -8,15 +8,15 @@ load(
"go_test",
)
go_library(
name = "go_default_library",
srcs = ["json.go"],
tags = ["automanaged"],
)
go_test(
name = "go_default_test",
srcs = ["json_test.go"],
library = ":go_default_library",
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = ["json.go"],
tags = ["automanaged"],
)

View file

@ -50,6 +50,18 @@ func Unmarshal(data []byte, v interface{}) error {
// If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64
return convertMapNumbers(*v)
case *[]interface{}:
// Build a decoder from the given data
decoder := json.NewDecoder(bytes.NewBuffer(data))
// Preserve numbers, rather than casting to float64 automatically
decoder.UseNumber()
// Run the decode
if err := decoder.Decode(v); err != nil {
return err
}
// If the decode succeeds, post-process the map to convert json.Number objects to int64 or float64
return convertSliceNumbers(*v)
default:
return json.Unmarshal(data, v)
}