...
1# Checks that an identical binary is built with -trimpath from the same
2# source files, with GOROOT in two different locations.
3# Verifies golang.org/issue/38989
4
5[short] skip
6[!symlink] skip
7
8# Symlink the compiler to a local path
9env GOROOT=$WORK/goroot1
10symlink $GOROOT -> $TESTGO_GOROOT
11
12# Set up fresh GOCACHE
13env GOCACHE=$WORK/gocache1
14mkdir $GOCACHE
15
16# Build a simple binary
17go build -o binary1 -trimpath -x main.go
18
19# Now repeat the same process with the compiler at a different local path
20env GOROOT=$WORK/goroot2
21symlink $GOROOT -> $TESTGO_GOROOT
22
23env GOCACHE=$WORK/gocache2
24mkdir $GOCACHE
25
26go build -o binary2 -trimpath -x main.go
27
28# Check that the binaries match exactly
29go tool buildid binary1
30cp stdout buildid1
31go tool buildid binary2
32cp stdout buildid2
33cmp buildid1 buildid2
34
35
36-- main.go --
37package main
38func main() {}
View as plain text