modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue16616.dir/issue16616.go (about)

     1  // Copyright 2016 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"reflect"
     9  
    10  	_ "./a"
    11  	"./b"
    12  )
    13  
    14  var V struct{ i int }
    15  
    16  func main() {
    17  	if got := reflect.ValueOf(b.V).Type().Field(0).PkgPath; got != "b" {
    18  		panic(`PkgPath=` + got + ` for first field of b.V, want "b"`)
    19  	}
    20  	if got := reflect.ValueOf(V).Type().Field(0).PkgPath; got != "main" {
    21  		panic(`PkgPath=` + got + ` for first field of V, want "main"`)
    22  	}
    23  	if got := reflect.ValueOf(b.U).Type().Field(0).PkgPath; got != "b" {
    24  		panic(`PkgPath=` + got + ` for first field of b.U, want "b"`)
    25  	}
    26  }