aboutsummaryrefslogtreecommitdiff
path: root/src/path/example_test.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2016-03-14 20:23:22 -0400
committerRuss Cox <rsc@golang.org>2016-04-03 16:55:51 +0000
commit1f7e55e418659dc3b5fe66792b85807a7065144f (patch)
tree016dbff6c4e44f99de5b5306c92ba56e48306666 /src/path/example_test.go
parent29a6149e67a9c382938ffb40102fb989a0a6db48 (diff)
downloadgo-1f7e55e418659dc3b5fe66792b85807a7065144f.tar.xz
path, path/filepath: add Join example with joined rooted path
This makes clear that Go's path.Join and filepath.Join are different from the Python os.path.join (and perhaps others). Requested in private mail. Change-Id: Ie5dfad8a57f9baa5cca31246af1fd4dd5b1a64ee Reviewed-on: https://go-review.googlesource.com/20711 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/path/example_test.go')
-rw-r--r--src/path/example_test.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/path/example_test.go b/src/path/example_test.go
index fa8c28d2e1..e8d684f771 100644
--- a/src/path/example_test.go
+++ b/src/path/example_test.go
@@ -54,7 +54,14 @@ func ExampleIsAbs() {
func ExampleJoin() {
fmt.Println(path.Join("a", "b", "c"))
- // Output: a/b/c
+ fmt.Println(path.Join("a", "b/c"))
+ fmt.Println(path.Join("a/b", "c"))
+ fmt.Println(path.Join("a/b", "/c"))
+ // Output:
+ // a/b/c
+ // a/b/c
+ // a/b/c
+ // a/b/c
}
func ExampleSplit() {