aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2012-09-22 05:54:52 +1000
committerRob Pike <r@golang.org>2012-09-22 05:54:52 +1000
commit9d7ca4b0e62d7f118d126395fc64d05d0e6fa6c9 (patch)
treece5d8a381bf45af1c90e898877dee0c5ea863fbb
parent94403eb5d36af8852ce500a249970d184db6ff01 (diff)
downloadgo-9d7ca4b0e62d7f118d126395fc64d05d0e6fa6c9.tar.gz
go-9d7ca4b0e62d7f118d126395fc64d05d0e6fa6c9.zip
[release-branch.go1] path: improve documentation for Dir
««« backport 735963d94dad path: improve documentation for Dir R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/6495059 »»»
-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 a7e0415689..b07534b36f 100644
--- a/src/pkg/path/path.go
+++ b/src/pkg/path/path.go
@@ -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
diff --git a/src/pkg/path/path_test.go b/src/pkg/path/path_test.go
index 77f080433b..65be550604 100644
--- a/src/pkg/path/path_test.go
+++ b/src/pkg/path/path_test.go
@@ -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"},