-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: -trimpath with -mod=vendor doesn't trim path #36566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Tentatively putting in the 1.14 milestone since if the bisection is correct this was introduced in this development cycle. |
It looks like this is happening because we don't set the module root directory with
It should be:
This can also be seen with |
Change https://golang.org/cl/214945 mentions this issue: |
Is there any way this could be considered for a backport to the next go1.13 as well? I wouldn't be able to upgrade to 1.14 for sometime due to that version automatically switching over to TLS 1.3 and removing any switch to fallback to TLS1.2 but man have I hit this issue. I think this may have started with go1.13.5 honestly. |
@cmitchell This issue was a regression introduced on the 1.14 development branch. I just confirmed it doesn't reproduce in 1.13.6. Could you open a new issue with steps to reproduce the problem you're seeing? |
Change https://golang.org/cl/215940 mentions this issue: |
If a package has a module with a version, the package's directory is replaced with the module path and version, followed by the package's path within the module. This is a follow up to CL 214945. We no longer check whether the module has a directory (with -mod=vendor, it does not). Updates #36566 Change-Id: I5bc952b13bc7b4659f58ee555bd6c6a087eb7792 Reviewed-on: https://go-review.googlesource.com/c/go/+/215940 Run-TryBot: Jay Conrod <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]>
Change https://golang.org/cl/216018 mentions this issue: |
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
Given a single file main.go in a module:
With
go version go1.13.6 darwin/amd64
, after runninggo mod vendor
, thengo run -mod=vendor -trimpath main.go
returns the following output:Notice that the location is printed as
golang.org/x/text@v0...
.With go tip at
go version devel +71154e061f Tue Jan 14 17:13:34 2020 +0000 darwin/amd64
, runninggo run -mod=vendor -trimpath main.go
produces this output:Notice that now, the vendored module has changed to its absolute path on disk,
/tmp/x/vendor/...
.I bisected to 6cba4db as the commit which introduced this path-based output.
With the new behavior since 6cba4db, -trimpath no longer works as documented in
go help build
("remove all file system paths from the resulting executable")./cc @bcmills @jayconrod
The text was updated successfully, but these errors were encountered: