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>
// 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
}