aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/path
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2012-08-30 11:16:41 -0700
committerRob Pike <r@golang.org>2012-08-30 11:16:41 -0700
commitb7627d3d1f238e484d08bb8abb770cbe91482bc4 (patch)
treed5cfeef54a0679e2f551c6103fcbb2711554777e /src/pkg/path
parente61c047c3e5ac3ad253c9046d479d769d14f7808 (diff)
downloadgo-b7627d3d1f238e484d08bb8abb770cbe91482bc4.tar.xz
path: improve documentation for Dir
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/6495059
Diffstat (limited to 'src/pkg/path')
-rw-r--r--src/pkg/path/path.go3
-rw-r--r--src/pkg/path/path_test.go1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/pkg/path/path.go b/src/pkg/path/path.go
index 649c1504c8..bdb85c6b92 100644
--- a/src/pkg/path/path.go
+++ b/src/pkg/path/path.go
@@ -198,7 +198,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
diff --git a/src/pkg/path/path_test.go b/src/pkg/path/path_test.go
index 109005de39..0f353be34d 100644
--- a/src/pkg/path/path_test.go
+++ b/src/pkg/path/path_test.go
@@ -200,6 +200,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"},