1
0
mirror of https://github.com/golang/go synced 2024-11-22 05:04:40 -07:00

path: improve documentation for Dir

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6495059
This commit is contained in:
Rob Pike 2012-08-30 11:16:41 -07:00
parent e61c047c3e
commit b7627d3d1f
2 changed files with 3 additions and 1 deletions

View File

@ -198,7 +198,8 @@ func IsAbs(path string) bool {
} }
// Dir returns all but the last element of path, typically the path's directory. // 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 is empty, Dir returns ".".
// If the path consists entirely of slashes followed by non-slash bytes, Dir // 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 // returns a single slash. In any other case, the returned path does not end in a

View File

@ -200,6 +200,7 @@ var dirtests = []PathTest{
{"x/", "x"}, {"x/", "x"},
{"abc", "."}, {"abc", "."},
{"abc/def", "abc"}, {"abc/def", "abc"},
{"abc////def", "abc"},
{"a/b/.x", "a/b"}, {"a/b/.x", "a/b"},
{"a/b/c.", "a/b"}, {"a/b/c.", "a/b"},
{"a/b/c.x", "a/b"}, {"a/b/c.x", "a/b"},