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

     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/stack@v1.0.0
    20  go run -trimpath printstack.go
    21  stdout '^example.com/stack@v1.0.0/stack.go$'
    22  go get example.com/stack@v1.0.1
    23  go run -trimpath printstack.go
    24  stdout '^example.com/stack@v1.0.1/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
    48  

View as plain text