summaryrefslogtreecommitdiff
path: root/libgo/go/cmd/go/testdata/script/build_cache_trimpath.txt
blob: 9a4b9d7b40c7264ea9cec6df11a66006be3a41fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
[short] skip
env GO111MODULE=on

# Set up fresh GOCACHE.
env GOCACHE=$WORK/gocache
mkdir $GOCACHE

cd $WORK
go build -o a.out

# Varying -trimpath should cause a rebuild.
go build -x -o a.out -trimpath
stderr '(compile|gccgo)( |\.exe)'
stderr 'link( |\.exe)'

# Two distinct versions of the same module with identical content should
# still be cached separately.
# Verifies golang.org/issue/35412.
go get -d example.com/stack@v1.0.0
go run -trimpath printstack.go
stdout '^example.com/stack@v1.0.0/stack.go$'
go get -d example.com/stack@v1.0.1
go run -trimpath printstack.go
stdout '^example.com/stack@v1.0.1/stack.go$'

-- $WORK/hello.go --
package main
func main() { println("hello") }

-- $WORK/printstack.go --
// +build ignore

package main

import (
	"fmt"

	"example.com/stack"
)

func main() {
	fmt.Println(stack.TopFile())
}
-- $WORK/go.mod --
module m

go 1.14