| 1 |
[short] skip |
| 2 |
env GO111MODULE=on |
| 3 |
|
| 4 |
# Set up fresh GOCACHE. |
| 5 |
env GOCACHE=$WORK/gocache |
| 6 |
mkdir $GOCACHE |
| 7 |
|
| 8 |
cd $WORK |
| 9 |
go build -o a.out |
| 10 |
|
| 11 |
# Varying -trimpath should cause a rebuild. |
| 12 |
go build -x -o a.out -trimpath |
| 13 |
stderr '(compile|gccgo)( |\.exe)' |
| 14 |
stderr 'link( |\.exe)' |
| 15 |
|
| 16 |
# Two distinct versions of the same module with identical content should |
| 17 |
# still be cached separately. |
| 18 |
# Verifies golang.org/issue/35412. |
| 19 |
go get example.com/[email protected] |
| 20 |
go run -trimpath printstack.go |
| 21 |
stdout '^example.com/[email protected]/stack.go$' |
| 22 |
go get example.com/[email protected] |
| 23 |
go run -trimpath printstack.go |
| 24 |
stdout '^example.com/[email protected]/stack.go$' |
| 25 |
|
| 26 |
-- $WORK/hello.go -- |
| 27 |
package main |
| 28 |
func main() { println("hello") } |
| 29 |
|
| 30 |
-- $WORK/printstack.go -- |
| 31 |
// +build ignore |
| 32 |
|
| 33 |
package main |
| 34 |
|
| 35 |
import ( |
| 36 |
"fmt" |
| 37 |
|
| 38 |
"example.com/stack" |
| 39 |
) |
| 40 |
|
| 41 |
func main() { |
| 42 |
fmt.Println(stack.TopFile()) |
| 43 |
} |
| 44 |
-- $WORK/go.mod -- |
| 45 |
module m |
| 46 |
|
| 47 |
go 1.14 |