encoding/json: The result has been changed even an error happened at json.Unmarshal #35454
Labels
Comments
This appears to be working as documented. Per https://golang.org/pkg/encoding/json/#Unmarshal:
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, I had try it at go version go1.13 linux/amd64
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://play.golang.org/p/QEWC05EBLBs
What did you expect to see?
The variable
arr
should be a empty slice because an error happened atjson.Unmarshal([]byte(str), &arr)
.What did you see instead?
The variable
arr
is a non-empty slice with 3 elementsThe text was updated successfully, but these errors were encountered: