]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1] path: improve documentation for Dir
authorRob Pike <r@golang.org>
Fri, 21 Sep 2012 19:54:52 +0000 (05:54 +1000)
committerRob Pike <r@golang.org>
Fri, 21 Sep 2012 19:54:52 +0000 (05:54 +1000)
««« backport 735963d94dad
path: improve documentation for Dir

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6495059

»»»

src/pkg/path/path.go
src/pkg/path/path_test.go

index a7e0415689ca9f4a1b97e545f31f239f8324eb41..b07534b36f44540160631b313527dade5639446f 100644 (file)
@@ -166,7 +166,8 @@ func IsAbs(path string) bool {
 }
 
 // Dir returns all but the last element of path, typically the path's directory.
-// The path is Cleaned and trailing slashes are removed before processing.
+// After dropping the final element using Split, the path is Cleaned and trailing
+// slashes are removed.
 // If the path is empty, Dir returns ".".
 // If the path consists entirely of slashes followed by non-slash bytes, Dir
 // returns a single slash. In any other case, the returned path does not end in a
index 77f080433b667719f103ec09f9f57656b4d4c907..65be55060423de96fafdcf953bfb308e3fb3592f 100644 (file)
@@ -181,6 +181,7 @@ var dirtests = []PathTest{
        {"x/", "x"},
        {"abc", "."},
        {"abc/def", "abc"},
+       {"abc////def", "abc"},
        {"a/b/.x", "a/b"},
        {"a/b/c.", "a/b"},
        {"a/b/c.x", "a/b"},