NeedsFixhelp wanted
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version go1.10.2 linux/amd64
Does this issue reproduce with the latest release?
yes
What did you do?
package main
import "fmt"
import "reflect"
func main() {
type T = struct {
x int
}
fmt.Println(reflect.TypeOf(T{})) // struct { x int }
var n int
tn := reflect.TypeOf(n)
// panic: reflect.StructOf: field "x" is unexported but missing PkgPath
tt := reflect.StructOf([]reflect.StructField{
{Name: "x", Type: tn, Anonymous: false},
})
fmt.Println(tt)
}
What did you expect to see?
not panic.
What did you see instead?
panic.
If it really should panic, it should be documented.