From 2dc4ef2775b8122dd5afe2c18fd6f775e87f89e5 Mon Sep 17 00:00:00 2001 From: Gordon Tyler Date: Sat, 23 Feb 2019 03:21:59 +0000 Subject: [PATCH] cmd/guru: fix guessImportPath for Windows Import paths in Go use forward slashes, not the operating system's path separator. Fixes golang/go#24699. Fixes golang/go#23318. Change-Id: I190224f6b7236e8ee19893f3589dd9686cbf116a GitHub-Last-Rev: 751b29ca5f2e52ee1124c4baca6e45eecf4a3052 GitHub-Pull-Request: golang/tools#56 Reviewed-on: https://go-review.googlesource.com/c/151057 Run-TryBot: Dmitri Shuralyov TryBot-Result: Gobot Gobot Reviewed-by: Dmitri Shuralyov Reviewed-by: Rebecca Stambler --- cmd/guru/what.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/guru/what.go b/cmd/guru/what.go index fabc3e801b..82495b4f8d 100644 --- a/cmd/guru/what.go +++ b/cmd/guru/what.go @@ -10,6 +10,7 @@ import ( "go/build" "go/token" "os" + "path" "path/filepath" "sort" "strings" @@ -202,7 +203,7 @@ func guessImportPath(filename string, buildContext *build.Context) (srcdir, impo if d >= 0 && d < minD { minD = d srcdir = gopathDir - importPath = strings.Join(segmentedAbsFileDir[len(segmentedAbsFileDir)-minD:], string(os.PathSeparator)) + importPath = path.Join(segmentedAbsFileDir[len(segmentedAbsFileDir)-minD:]...) } } if srcdir == "" {