1
0
mirror of https://github.com/golang/go synced 2024-11-17 07:04:44 -07:00

cmd/go: avoid hard-coding runtime dependencies in TestNewReleaseRebuildsStalePackagesInGOPATH

Fixes #64583.

Change-Id: Idbe50fe77f6030f2402ac436abe6710cb1183730
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/547995
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Bryan C. Mills 2023-12-06 12:47:32 -05:00 committed by Gopher Robot
parent fecaea97e4
commit 0ff2b33ea0

View File

@ -881,22 +881,17 @@ func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) {
// Copy the runtime packages into a temporary GOROOT
// so that we can change files.
for _, copydir := range []string{
"src/runtime",
"src/internal/abi",
"src/internal/bytealg",
"src/internal/coverage/rtcov",
"src/internal/cpu",
"src/internal/goarch",
"src/internal/godebugs",
"src/internal/goexperiment",
"src/internal/goos",
"src/internal/coverage/rtcov",
"src/math/bits",
"src/unsafe",
var dirs []string
tg.run("list", "-deps", "runtime")
pkgs := strings.Split(strings.TrimSpace(tg.getStdout()), "\n")
for _, pkg := range pkgs {
dirs = append(dirs, filepath.Join("src", pkg))
}
dirs = append(dirs,
filepath.Join("pkg/tool", goHostOS+"_"+goHostArch),
"pkg/include",
} {
)
for _, copydir := range dirs {
srcdir := filepath.Join(testGOROOT, copydir)
tg.tempDir(filepath.Join("goroot", copydir))
err := filepath.WalkDir(srcdir,
@ -912,6 +907,9 @@ func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) {
return err
}
dest := filepath.Join("goroot", copydir, srcrel)
if _, err := os.Stat(dest); err == nil {
return nil
}
data, err := os.ReadFile(path)
if err != nil {
return err