You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ go run .
hello world
panic: reflect.Value.Interface: cannot return value obtained from unexported field or method
goroutine 1 [running]:
reflect.valueInterface({0x100d175c0?, 0x100dd26a0?, 0x1400009cf18?}, 0x1?)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/reflect/value.go:1501 +0xc8
reflect.Value.Interface(...)
/opt/homebrew/Cellar/go/1.21.6/libexec/src/reflect/value.go:1490
main.main()
/Users/violin/Workspace/golang/play/ref/main.go:14 +0xc4
exit status 2
This is because devlog is trying to read XXXRequest.state.atomicMessageInfo.GoReflectType.t, which is type of reflect.Type
Expected behavior formatStruct() method should ignore and skip the unexported fields in struct, for reading an unexported field of other package is dangerous and useless.
The text was updated successfully, but these errors were encountered:
Describe the bug
when formatting struct attributes, devslog try to read the unexported fields using reflect,
this behaviour cause panic.
To Reproduce
Given the codes below:
build and run it, program will panic with:
As for devlog, given the codes below:
when calling grpc, server will panic in devslog:
This is because devlog is trying to read
XXXRequest.state.atomicMessageInfo.GoReflectType.t
, which is type ofreflect.Type
Expected behavior
formatStruct()
method should ignore and skip the unexported fields in struct, for reading an unexported field of other package is dangerous and useless.The text was updated successfully, but these errors were encountered: