aboutsummaryrefslogtreecommitdiff
path: root/src/go/types/resolver.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/go/types/resolver.go')
-rw-r--r--src/go/types/resolver.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/go/types/resolver.go b/src/go/types/resolver.go
index 14148a585b..1536df5bf1 100644
--- a/src/go/types/resolver.go
+++ b/src/go/types/resolver.go
@@ -483,11 +483,9 @@ func pkgName(path string) string {
// (Per the go/build package dependency tests, we cannot import
// path/filepath and simply use filepath.Dir.)
func dir(path string) string {
- if i := strings.LastIndexAny(path, "/\\"); i >= 0 {
- path = path[:i]
+ if i := strings.LastIndexAny(path, `/\`); i > 0 {
+ return path[:i]
}
- if path == "" {
- path = "."
- }
- return path
+ // i <= 0
+ return "."
}