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>
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() {
// dir: "/usr/local//"
// file: "go"
}
+
+func ExampleJoin() {
+ fmt.Println("On Unix:")
+ fmt.Println(filepath.Join("a", "b", "c"))
+ fmt.Println(filepath.Join("a", "b/c"))
+ fmt.Println(filepath.Join("a/b", "c"))
+ fmt.Println(filepath.Join("a/b", "/c"))
+ // Output:
+ // On Unix:
+ // a/b/c
+ // a/b/c
+ // a/b/c
+ // a/b/c
+}