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 <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
40960b6deb
commit
4892ae6946
|
@ -19,6 +19,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"golang.org/x/tools/go/gcexportdata"
|
"golang.org/x/tools/go/gcexportdata"
|
||||||
|
@ -838,7 +839,7 @@ func sameFile(x, y string) bool {
|
||||||
// overlay case implies x==y.)
|
// overlay case implies x==y.)
|
||||||
return true
|
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 xi, err := os.Stat(x); err == nil {
|
||||||
if yi, err := os.Stat(y); err == nil {
|
if yi, err := os.Stat(y); err == nil {
|
||||||
return os.SameFile(xi, yi)
|
return os.SameFile(xi, yi)
|
||||||
|
|
Loading…
Reference in New Issue