]> Cypherpunks repositories - gostls13.git/commitdiff
path, path/filepath: remove dead code
authorDave Cheney <dave@cheney.net>
Fri, 22 Aug 2014 12:21:41 +0000 (22:21 +1000)
committerDave Cheney <dave@cheney.net>
Fri, 22 Aug 2014 12:21:41 +0000 (22:21 +1000)
Fixes #8503.

Thanks to no.smile.face for the original report.

LGTM=bradfitz, r, ruiu
R=bradfitz, ruiu, r
CC=golang-codereviews
https://golang.org/cl/132730043

src/pkg/path/filepath/path.go
src/pkg/path/path.go

index 7fa3b9b56a9d66c683c33efd8fcf95aaca2a3d8c..d37fc9dfc8908f950c8b5523f33b8660e2cef13a 100644 (file)
@@ -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
 }
 
index bdb85c6b92a7445c11713324041586faa8ebb401..98a6d5292294829081b99ef59e6784dfa1786184 100644 (file)
@@ -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)
 }