mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
db4adb1a9b
commit
6b6ea3271f
1 changed files with 1 additions and 3 deletions
|
|
@ -32,10 +32,8 @@ func ShortPath(path string) string {
|
||||||
// made relative to the current directory if they would be shorter.
|
// made relative to the current directory if they would be shorter.
|
||||||
func RelPaths(paths []string) []string {
|
func RelPaths(paths []string) []string {
|
||||||
var out []string
|
var out []string
|
||||||
// TODO(rsc): Can this use Cwd from above?
|
|
||||||
pwd, _ := os.Getwd()
|
|
||||||
for _, p := range paths {
|
for _, p := range paths {
|
||||||
rel, err := filepath.Rel(pwd, p)
|
rel, err := filepath.Rel(Cwd, p)
|
||||||
if err == nil && len(rel) < len(p) {
|
if err == nil && len(rel) < len(p) {
|
||||||
p = rel
|
p = rel
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue