summaryrefslogtreecommitdiffstats
path: root/src/cmd/go/testdata/script/build_i.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/go/testdata/script/build_i.txt')
-rw-r--r--src/cmd/go/testdata/script/build_i.txt41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/script/build_i.txt b/src/cmd/go/testdata/script/build_i.txt
new file mode 100644
index 0000000..0e7ebed
--- /dev/null
+++ b/src/cmd/go/testdata/script/build_i.txt
@@ -0,0 +1,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() }