summaryrefslogtreecommitdiffstats
path: root/src/cmd/go/testdata/script/build_i.txt
blob: 0e7ebed0f99e28f72e1f3ea77006b4b6354ca534 (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
env GO111MODULE=off

# Test that 'go build -i' installs dependencies of the requested package.

[short] skip

# Since we are checking installation of dependencies, use a clean cache
# to ensure that multiple runs of the test do not interfere.
env GOCACHE=$WORK/cache

# The initial 'go build -i' for bar should install its dependency foo.

go build -v -i x/y/bar
stderr 'x/y/foo'    # should be rebuilt
go build -v -i x/y/bar
! stderr 'x/y/foo'  # should already be installed

# After modifying the source files, both packages should be rebuild.

cp x/y/foo/foo.go.next x/y/foo/foo.go
cp x/y/bar/bar.go.next x/y/bar/bar.go

go build -v -i x/y/bar
stderr 'x/y/foo'    # should be rebuilt
go build -v -i x/y/bar
! stderr 'x/y/foo'  # should already be installed

-- x/y/foo/foo.go --
package foo
func F() {}
-- x/y/bar/bar.go --
package bar
import "x/y/foo"
func F() { foo.F() }
-- x/y/foo/foo.go.next --
package foo
func F() { F() }
-- x/y/bar/bar.go.next --
package main
import "x/y/foo"
func main() { foo.F() }