1// run 2 3// Copyright 2015 The Go Authors. All rights reserved. 4// Use of this source code is governed by a BSD-style 5// license that can be found in the LICENSE file. 6 7// The PkgPath of unexported fields of types defined in package main was incorrectly "" 8 9package main 10 11import ( 12 "fmt" 13 "reflect" 14) 15 16type foo struct { 17 bar int 18} 19 20func main() { 21 pkgpath := reflect.ValueOf(foo{}).Type().Field(0).PkgPath 22 if pkgpath != "main" { 23 fmt.Printf("BUG: incorrect PkgPath: %v", pkgpath) 24 } 25} 26