aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorHeschi Kreinick <heschi@google.com>2020-02-24 15:19:47 -0500
committerHeschi Kreinick <heschi@google.com>2020-02-25 18:45:58 +0000
commit6bd7a3808648dbaa6d96e2797731ff311a641599 (patch)
treee78d28ffccb9b3d7ab8b83f374adb0f92da8f0f2 /internal
parent45849e8256ad6f41fdbfdd6cb34a08a22a117e6b (diff)
downloadgolang-x-tools-6bd7a3808648dbaa6d96e2797731ff311a641599.tar.gz
internal/imports: filepath.Clean module Dirs
Various bits of the module code use HasPrefix, which only works if all paths are clean. Make sure they are. No test; this is pretty esoteric and it's not easy to test. Fixes golang/go#36193. Change-Id: I8c8e87d1882d149a1a129d8b7123bc95c115b2ad Reviewed-on: https://go-review.googlesource.com/c/tools/+/220659 Run-TryBot: Heschi Kreinick <heschi@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Diffstat (limited to 'internal')
-rw-r--r--internal/imports/mod.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/internal/imports/mod.go b/internal/imports/mod.go
index 1980f59de..c0310e6fb 100644
--- a/internal/imports/mod.go
+++ b/internal/imports/mod.go
@@ -162,6 +162,8 @@ func (r *ModuleResolver) initAllMods() error {
// Can't do anything with a module that's not downloaded.
continue
}
+ // golang/go#36193: the go command doesn't always clean paths.
+ mod.Dir = filepath.Clean(mod.Dir)
r.modsByModPath = append(r.modsByModPath, mod)
r.modsByDir = append(r.modsByDir, mod)
if mod.Main {