github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/misc/cgo/testshared/src/dep3/dep3.go (about)

     1  package dep3
     2  
     3  // The point of this test file is that it references a type from
     4  // depBase that is also referenced in dep2, but dep2 is loaded by the
     5  // linker before depBase (because it is earlier in the import list).
     6  // There was a bug in the linker where it would not correctly read out
     7  // the type data in this case and later crash.
     8  
     9  import (
    10  	"dep2"
    11  	"depBase"
    12  )
    13  
    14  type Dep3 struct {
    15  	dep  depBase.Dep
    16  	dep2 dep2.Dep2
    17  }
    18  
    19  func D3() int {
    20  	var x Dep3
    21  	return x.dep.X + x.dep2.X
    22  }