cmd/go: use the global rooted path name

Change-Id: I4a450af5f35f0ad4e4652789f1eda4d3171610e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/302852
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
This commit is contained in:
Andy Pan 2021-03-18 10:45:04 +08:00 committed by Jay Conrod
parent db4adb1a9b
commit 6b6ea3271f

View File

@ -32,10 +32,8 @@ func ShortPath(path string) string {
// made relative to the current directory if they would be shorter.
func RelPaths(paths []string) []string {
var out []string
// TODO(rsc): Can this use Cwd from above?
pwd, _ := os.Getwd()
for _, p := range paths {
rel, err := filepath.Rel(pwd, p)
rel, err := filepath.Rel(Cwd, p)
if err == nil && len(rel) < len(p) {
p = rel
}