-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
CherryPickApprovedUsed during the release process for point releasesUsed during the release process for point releasesFrozenDueToAge
Milestone
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version go1.10 linux/amd64
go version go1.10 windows/amd64
Does this issue reproduce with the latest release?
yes. Does not happen with go1.9
What operating system and processor architecture are you using (go env)?
Windows 10 amd64
Ubuntu Xenial amd64 16.04.2 LTS
What did you do?
https://play.golang.org/p/ZDEBiSJKERw
What did you expect to see?
The release notes state:
As a result of fixing a reflect bug, Unmarshal can no longer decode into fields inside embedded pointers to unexported struct types, because it cannot initialize the unexported embedded pointer to point at fresh storage. Unmarshal now returns an error in this case.
These fields however aren't pointers and it panics instead of just returning an error
What did you see instead?
panic: reflect: reflect.Value.SetString using value obtained using unexported field [recovered]
panic: interface conversion: string is not error: missing method Error
goroutine 1 [running]:
encoding/json.(*decodeState).unmarshal.func1(0x1052ff68, 0x10556022)
/usr/local/go/src/encoding/json/decode.go:177 +0xc0
panic(0x110120, 0x1050c178)
/usr/local/go/src/runtime/panic.go:505 +0x2c0
reflect.flag.mustBeAssignable(0x1b8, 0x1051403c)
/usr/local/go/src/reflect/value.go:231 +0x280
reflect.Value.SetString(0x110120, 0x1050c170, 0x1b8, 0x10514058, 0x7, 0x7)
/usr/local/go/src/reflect/value.go:1551 +0x40
encoding/json.(*decodeState).literalStore(0x10556090, 0x1055804b, 0x9, 0x15, 0x110120, 0x1050c170, 0x1b8, 0x4400)
/usr/local/go/src/encoding/json/decode.go:957 +0x1fe0
encoding/json.(*decodeState).literal(0x10556090, 0x110120, 0x1050c170, 0x1b8)
/usr/local/go/src/encoding/json/decode.go:820 +0xe0
encoding/json.(*decodeState).value(0x10556090, 0x110120, 0x1050c170, 0x1b8)
/usr/local/go/src/encoding/json/decode.go:411 +0x420
encoding/json.(*decodeState).object(0x10556090, 0x112be0, 0x1050c170, 0x1d9)
/usr/local/go/src/encoding/json/decode.go:754 +0x15a0
encoding/json.(*decodeState).value(0x10556090, 0x112be0, 0x1050c170, 0x1d9)
/usr/local/go/src/encoding/json/decode.go:408 +0x3e0
encoding/json.(*decodeState).object(0x10556090, 0x107f00, 0x1050c170, 0x16)
/usr/local/go/src/encoding/json/decode.go:754 +0x15a0
encoding/json.(*decodeState).value(0x10556090, 0x107f00, 0x1050c170, 0x16)
/usr/local/go/src/encoding/json/decode.go:408 +0x3e0
encoding/json.(*decodeState).unmarshal(0x10556090, 0x107f00, 0x1050c170, 0x105560a0, 0x0, 0x0)
/usr/local/go/src/encoding/json/decode.go:189 +0x260
encoding/json.Unmarshal(0x10558030, 0x2b, 0x30, 0x107f00, 0x1050c170, 0x2b, 0x30, 0x111ec0)
/usr/local/go/src/encoding/json/decode.go:108 +0x1a0
main.main()
/tmp/sandbox919475193/main.go:17 +0xc0
Metadata
Metadata
Assignees
Labels
CherryPickApprovedUsed during the release process for point releasesUsed during the release process for point releasesFrozenDueToAge