Go version
1.24
Output of go env
in your module/workspace:
not relevant
What did you do?
Calling reflect.Value.Seq()
panics if the value is unexported (CanInterface()
returns false), but the documentation doesn't mention it.
What did you see happen?
It panics
What did you expect to see?
The documentation should explain that Seq()
and Seq2()
can be called if CanInterface()
returns true, otherwise it panics.
I guess we should add the same warning to Call()
and CallSlice()
Comment From: dmitshur
CC @golang/runtime.
Comment From: sayymeer
I have experience with Go’s reflect package and would like to update the documentation as described. Please assign this issue to me.
Comment From: gopherbot
Change https://go.dev/cl/690616 mentions this issue: reflect: Seq/Seq2 prohibit read unexported field
Comment From: gopherbot
Change https://go.dev/cl/690617 mentions this issue: reflect: Call/CallSlice panic when v is unexported field