From: Dave Cheney Date: Fri, 22 Aug 2014 12:21:41 +0000 (+1000) Subject: path, path/filepath: remove dead code X-Git-Tag: go1.4beta1~752 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3d3d5390834629a73b745900eb1a0aeda94d927d;p=gostls13.git path, path/filepath: remove dead code 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 --- diff --git a/src/pkg/path/filepath/path.go b/src/pkg/path/filepath/path.go index 7fa3b9b56a..d37fc9dfc8 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 bdb85c6b92..98a6d52922 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) }