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
6 env GO111MODULE=off
7 env GOPATH=$WORK/p1${:}$WORK/p2
8 mkdir $WORK/p1/src/foo $WORK/p2/src/baz
9 mkdir $WORK/p2/pkg/${GOOS}_${GOARCH} $WORK/p1/src/bar
10 cp foo.go $WORK/p1/src/foo/foo.go
11 cp baz.go $WORK/p2/src/baz/baz.go
12 cp foo.a $WORK/p2/pkg/${GOOS}_${GOARCH}/foo.a
13 cp bar.go $WORK/p1/src/bar/bar.go
14
15 go install -x bar
16
17 # add in baz.a to the mix
18 mkdir $WORK/p1/pkg/${GOOS}_${GOARCH}
19 cp baz.a $WORK/p1/pkg/${GOOS}_${GOARCH}/baz.a
20 env GOPATH=$WORK/p1${:}$WORK/p2
21 go install -x bar
22 env GOPATH=$WORK/p2${:}$WORK/p1
23 go install -x bar
24
25 -- foo.go --
26 package foo
27 -- baz.go --
28 package baz
29 -- foo.a --
30 bad
31 -- baz.a --
32 bad
33 -- bar.go --
34 package bar
35 import _ "baz"
36 import _ "foo"
37
View as plain text