From 39ea3d0a2365fe1619fced89f94b747ce4852540 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Thu, 23 Jan 2020 12:51:26 -0500 Subject: [PATCH] cmd/go: add a control case to the mod_vendor_trimpath test 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 TryBot-Result: Gobot Gobot Reviewed-by: Jay Conrod --- src/cmd/go/testdata/script/mod_vendor_trimpath.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cmd/go/testdata/script/mod_vendor_trimpath.txt b/src/cmd/go/testdata/script/mod_vendor_trimpath.txt index c419fc9793..5451aa773c 100644 --- a/src/cmd/go/testdata/script/mod_vendor_trimpath.txt +++ b/src/cmd/go/testdata/script/mod_vendor_trimpath.txt @@ -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 -- 2.50.0