diff --git a/src/pkg/path/filepath/path.go b/src/pkg/path/filepath/path.go index 7fa3b9b56a9d6..d37fc9dfc8908 100644 --- a/src/pkg/path/filepath/path.go +++ b/src/pkg/path/filepath/path.go @@ -452,13 +452,6 @@ func Dir(path string) string { i-- } dir := Clean(path[len(vol) : i+1]) - last := len(dir) - 1 - if last > 0 && os.IsPathSeparator(dir[last]) { - dir = dir[:last] - } - if dir == "" { - dir = "." - } return vol + dir } diff --git a/src/pkg/path/path.go b/src/pkg/path/path.go index bdb85c6b92a74..98a6d52922948 100644 --- a/src/pkg/path/path.go +++ b/src/pkg/path/path.go @@ -206,13 +206,5 @@ func IsAbs(path string) bool { // slash. func Dir(path string) string { dir, _ := Split(path) - dir = Clean(dir) - last := len(dir) - 1 - if last > 0 && dir[last] == '/' { - dir = dir[:last] - } - if dir == "" { - dir = "." - } - return dir + return Clean(dir) }