]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/moddeps: preserve PWD more carefully in commands
authorBryan C. Mills <bcmills@google.com>
Thu, 13 Apr 2023 03:19:20 +0000 (03:19 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 13 Apr 2023 14:14:43 +0000 (14:14 +0000)
commitc38d122fd4df8481a5b57a696945d65b7d4fc28e
tree612c48652ce2a12973258b66a0a3c8ea3e5ddb1c
parente8fe3b77574d9afadab664104a669d8e9f0f4303
cmd/internal/moddeps: preserve PWD more carefully in commands

On macOS, TMPDIR is typically a symlink, and the GOROOT for the
buildlet is in TMPDIR as well. PWD must be preserved in order for
os.Getwd (and functions based on it) to report paths that remain
relative to GOROOT, and paths relative to GOROOT are necessary in
order for filepath.Rel to report subdirectories as subdirectories
(rather than paths with long "../../…" prefixes).

Fortunately, the (*Cmd).Environ method added for #50599 makes
preserving PWD somewhat easier.

This fixes 'go test cmd/internal/moddeps' on the new
darwin-amd64-longtest builder.

For #35678.

Change-Id: Ibaa458bc9a94b44ba455519bb8da445af07fe0d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/484295
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/cmd/internal/moddeps/moddeps_test.go