]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: add a control case to the mod_vendor_trimpath test
authorBryan C. Mills <bcmills@google.com>
Thu, 23 Jan 2020 17:51:26 +0000 (12:51 -0500)
committerBryan C. Mills <bcmills@google.com>
Thu, 23 Jan 2020 19:11:41 +0000 (19:11 +0000)
In reviewing CL 215940, it took me a while to find the control
condition for the test, which was located in build_cache_trimpath.txt.

We could consolidate the two tests, but since they check for
regressions of separate issues (with separate root-causes), I think it
makes sense to keep them separate.

However, I would like the control condition to be present in the same
source file, so that we'll be more likely to update both cases if the
behavior of one of them is changed.

Updates #36566

Change-Id: Ic588f1dfb7977dd78d1d5ef61b9841e22bad82e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/216018
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/cmd/go/testdata/script/mod_vendor_trimpath.txt

index c419fc9793d9bfb36b642a5411593491f075bb43..5451aa773c8b5ea4eb4fed7fb90954199a3427bd 100644 (file)
@@ -18,8 +18,13 @@ stdout vendor
 
 # With -trimpath, everything before the package path should be trimmed.
 # As with -mod=mod, the version should appear as part of the module path.
-go run -trimpath main.go
-stdout example.com/stack@v1.0.0/stack.go
+go run -mod=vendor -trimpath main.go
+stdout '^example.com/stack@v1.0.0/stack.go$'
+
+# With pristinely vendored source code, a trimmed binary built from vendored
+# code should have the same behavior as one build from the module cache.
+go run -mod=mod -trimpath main.go
+stdout '^example.com/stack@v1.0.0/stack.go$'
 
 -- go.mod --
 module example.com/main