github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/go/testdata/script/build_i.txt (about) 1 env GO111MODULE=off 2 3 # Test that 'go build -i' installs dependencies of the requested package. 4 5 [short] skip 6 7 # Since we are checking installation of dependencies, use a clean cache 8 # to ensure that multiple runs of the test do not interfere. 9 env GOCACHE=$WORK/cache 10 11 # The initial 'go build -i' for bar should install its dependency foo. 12 13 go build -v -i x/y/bar 14 stderr 'x/y/foo' # should be rebuilt 15 go build -v -i x/y/bar 16 ! stderr 'x/y/foo' # should already be installed 17 18 # After modifying the source files, both packages should be rebuild. 19 20 cp x/y/foo/foo.go.next x/y/foo/foo.go 21 cp x/y/bar/bar.go.next x/y/bar/bar.go 22 23 go build -v -i x/y/bar 24 stderr 'x/y/foo' # should be rebuilt 25 go build -v -i x/y/bar 26 ! stderr 'x/y/foo' # should already be installed 27 28 -- x/y/foo/foo.go -- 29 package foo 30 func F() {} 31 -- x/y/bar/bar.go -- 32 package bar 33 import "x/y/foo" 34 func F() { foo.F() } 35 -- x/y/foo/foo.go.next -- 36 package foo 37 func F() { F() } 38 -- x/y/bar/bar.go.next -- 39 package main 40 import "x/y/foo" 41 func main() { foo.F() }