summaryrefslogtreecommitdiffstats
path: root/src/cmd/go/testdata/script/mod_tidy.txt
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/go/testdata/script/mod_tidy.txt')
-rw-r--r--src/cmd/go/testdata/script/mod_tidy.txt72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/script/mod_tidy.txt b/src/cmd/go/testdata/script/mod_tidy.txt
new file mode 100644
index 0000000..b1d9371
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_tidy.txt
@@ -0,0 +1,72 @@
+env GO111MODULE=on
+
+# tidy removes unused y, but everything else is used
+go mod tidy -v
+stderr '^unused y.1'
+! stderr '^unused [^y]'
+
+grep 'go 1.10' go.mod
+
+go list -m all
+! stdout '^y'
+stdout '^w.1 v1.2.0'
+stdout '^z.1 v1.2.0'
+
+# empty tidy should not crash
+cd triv
+! grep 'go ' go.mod
+go mod tidy
+
+# tidy should add missing go line
+grep 'go ' go.mod
+
+-- go.mod --
+module m
+
+go 1.10
+
+require (
+ x.1 v1.0.0
+ y.1 v1.0.0
+ w.1 v1.2.0
+)
+
+replace x.1 v1.0.0 => ./x
+replace y.1 v1.0.0 => ./y
+replace z.1 v1.1.0 => ./z
+replace z.1 v1.2.0 => ./z
+replace w.1 => ./w
+
+-- m.go --
+package m
+
+import _ "x.1"
+import _ "z.1/sub"
+
+-- w/go.mod --
+module w
+
+-- w/w.go --
+package w
+
+-- x/go.mod --
+module x
+require w.1 v1.1.0
+require z.1 v1.1.0
+
+-- x/x.go --
+package x
+import _ "w.1"
+
+-- y/go.mod --
+module y
+require z.1 v1.2.0
+
+-- z/go.mod --
+module z
+
+-- z/sub/sub.go --
+package sub
+
+-- triv/go.mod --
+module triv