| 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 |
|
| 9 |
package main |
| 10 |
|
| 11 |
import ( |
| 12 |
"fmt" |
| 13 |
"reflect" |
| 14 |
) |
| 15 |
|
| 16 |
type foo struct { |
| 17 |
bar int |
| 18 |
} |
| 19 |
|
| 20 |
func main() { |
| 21 |
pkgpath := reflect.ValueOf(foo{}).Type().Field(0).PkgPath |
| 22 |
if pkgpath != "main" { |
| 23 |
fmt.Printf("BUG: incorrect PkgPath: %v", pkgpath) |
| 24 |
} |
| 25 |
} |