interp: fix relative import path detection on MS-Windows

Fixes #1106.
This commit is contained in:
Marc Vertes
2021-05-27 12:34:09 +02:00
committed by GitHub
parent c86436afa6
commit 2f9fe7003a

View File

@@ -303,7 +303,7 @@ func effectivePkg(root, path string) string {
}
// isPathRelative returns true if path starts with "./" or "../".
// It is intended for use on import paths, where "/" is always the directory separator.
func isPathRelative(s string) bool {
p := "." + string(filepath.Separator)
return strings.HasPrefix(s, p) || strings.HasPrefix(s, "."+p)
return strings.HasPrefix(s, "./") || strings.HasPrefix(s, "../")
}