]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/work: remove '_test' from import paths in stacktraces when -trimpath...
authorHajime Hoshi <hajimehoshi@gmail.com>
Fri, 25 Dec 2020 17:25:13 +0000 (02:25 +0900)
committerHajime Hoshi <hajimehoshi@gmail.com>
Mon, 12 Apr 2021 15:17:33 +0000 (15:17 +0000)
commit117b1c84d3678a586c168a5f7f2f0a750c27f0c2
tree767c0b7afe9d4ea029802dbb864d5f4f4b06213f
parentc26f954a540a99eafac6ee3bb3b996c750aad8a4
cmd/go/internal/work: remove '_test' from import paths in stacktraces when -trimpath is specified

ExampleFrames with -trimpath failed since the content of Frame's File
changed when -trimpath is specified.

This CL fixes the issue by adding a new field OrigImportPath to
PackageInternal, which represents the original import path before adding
'_test' suffix for an external test package, and always using it to
create paths for the build tools.

Fixes golang/go#43380

Change-Id: Ibbc947eb3ae08a7ba81f13f03af67c8745b5c69f
Reviewed-on: https://go-review.googlesource.com/c/go/+/279440
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/internal/load/pkg.go
src/cmd/go/internal/load/test.go
src/cmd/go/internal/work/gc.go
src/cmd/go/testdata/script/test_trimpath.txt [new file with mode: 0644]
src/cmd/go/testdata/script/test_trimpath_main.txt [new file with mode: 0644]
src/cmd/go/testdata/script/test_trimpath_test_suffix.txt [new file with mode: 0644]