Source file src/cmd/cgo/internal/testshared/testdata/dep3/dep3.go

     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  	"testshared/dep2"
    11  	"testshared/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  }
    23  

View as plain text