]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: use the global rooted path name
authorAndy Pan <panjf2000@gmail.com>
Thu, 18 Mar 2021 02:45:04 +0000 (10:45 +0800)
committerJay Conrod <jayconrod@google.com>
Thu, 18 Mar 2021 14:20:08 +0000 (14:20 +0000)
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>

src/cmd/go/internal/base/path.go

index 7a51181c9736e9cdf8549a7192f9bdcf67f419ce..cb4adbde42a2dad323159f85731faccf2c7529e3 100644 (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
                }