From 4892ae6946ab8a542e4fe1bf1376eb714b9e7aec Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Thu, 31 Jan 2019 20:02:48 +0900 Subject: [PATCH] go/packages: use strings.EqualFold in sameFile to handle case-insensitive file systems Name of file or URI must be checked ignorecase on Windows. Change-Id: I61507b0aa95389c5e1f421f0702ba6ad17b79177 Reviewed-on: https://go-review.googlesource.com/c/160597 Run-TryBot: Rebecca Stambler TryBot-Result: Gobot Gobot Reviewed-by: Rebecca Stambler --- go/packages/packages.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/go/packages/packages.go b/go/packages/packages.go index f4aac56e..1e5836c9 100644 --- a/go/packages/packages.go +++ b/go/packages/packages.go @@ -19,6 +19,7 @@ import ( "log" "os" "path/filepath" + "strings" "sync" "golang.org/x/tools/go/gcexportdata" @@ -838,7 +839,7 @@ func sameFile(x, y string) bool { // overlay case implies x==y.) return true } - if filepath.Base(x) == filepath.Base(y) { // (optimisation) + if strings.EqualFold(filepath.Base(x), filepath.Base(y)) { // (optimisation) if xi, err := os.Stat(x); err == nil { if yi, err := os.Stat(y); err == nil { return os.SameFile(xi, yi)