...

Text file src/cmd/go/testdata/script/build_gopath_order.txt

Documentation: cmd/go/testdata/script

     1# golang.org/issue/14176#issuecomment-179895769
     2# golang.org/issue/14192
     3# -I arguments to compiler could end up not in GOPATH order,
     4# leading to unexpected import resolution in the compiler.
     5
     6env GO111MODULE=off
     7env GOPATH=$WORK/p1${:}$WORK/p2
     8mkdir $WORK/p1/src/foo $WORK/p2/src/baz
     9mkdir $WORK/p2/pkg/${GOOS}_${GOARCH} $WORK/p1/src/bar
    10cp foo.go $WORK/p1/src/foo/foo.go
    11cp baz.go $WORK/p2/src/baz/baz.go
    12cp foo.a $WORK/p2/pkg/${GOOS}_${GOARCH}/foo.a
    13cp bar.go $WORK/p1/src/bar/bar.go
    14
    15go install -x bar
    16
    17# add in baz.a to the mix
    18mkdir $WORK/p1/pkg/${GOOS}_${GOARCH}
    19cp baz.a $WORK/p1/pkg/${GOOS}_${GOARCH}/baz.a
    20env GOPATH=$WORK/p1${:}$WORK/p2
    21go install -x bar
    22env GOPATH=$WORK/p2${:}$WORK/p1
    23go install -x bar
    24
    25-- foo.go --
    26package foo
    27-- baz.go --
    28package baz
    29-- foo.a --
    30bad
    31-- baz.a --
    32bad
    33-- bar.go --
    34package bar
    35import _ "baz"
    36import _ "foo"

View as plain text