blob: 0e7ebed0f99e28f72e1f3ea77006b4b6354ca534 [file] [log] [blame]
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() }