From 9d7ca4b0e62d7f118d126395fc64d05d0e6fa6c9 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Sat, 22 Sep 2012 05:54:52 +1000 Subject: [PATCH] [release-branch.go1] path: improve documentation for Dir MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ««« backport 735963d94dad path: improve documentation for Dir R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/6495059 »»» --- src/pkg/path/path.go | 3 ++- src/pkg/path/path_test.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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"}, -- 2.50.0