...

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

Documentation: cmd/go/testdata/script

     1[short] skip
     2env GO111MODULE=on
     3
     4# Set up fresh GOCACHE.
     5env GOCACHE=$WORK/gocache
     6mkdir $GOCACHE
     7
     8cd $WORK
     9go build -o a.out
    10
    11# Varying -trimpath should cause a rebuild.
    12go build -x -o a.out -trimpath
    13stderr '(compile|gccgo)( |\.exe)'
    14stderr '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.
    19go get example.com/stack@v1.0.0
    20go run -trimpath printstack.go
    21stdout '^example.com/stack@v1.0.0/stack.go$'
    22go get example.com/stack@v1.0.1
    23go run -trimpath printstack.go
    24stdout '^example.com/stack@v1.0.1/stack.go$'
    25
    26-- $WORK/hello.go --
    27package main
    28func main() { println("hello") }
    29
    30-- $WORK/printstack.go --
    31// +build ignore
    32
    33package main
    34
    35import (
    36	"fmt"
    37
    38	"example.com/stack"
    39)
    40
    41func main() {
    42	fmt.Println(stack.TopFile())
    43}
    44-- $WORK/go.mod --
    45module m
    46
    47go 1.14

View as plain text