]> Cypherpunks repositories - gostls13.git/commitdiff
path/filepath: add example for Match
authorAurélien Rainone <aurelien.rainone@gmail.com>
Tue, 23 Oct 2018 14:56:41 +0000 (16:56 +0200)
committerIan Lance Taylor <iant@golang.org>
Wed, 24 Oct 2018 20:57:32 +0000 (20:57 +0000)
Change-Id: Id2df4895a95904a607e54dd9810bfe97f5e12a73
Reviewed-on: https://go-review.googlesource.com/c/144105
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/path/filepath/example_unix_test.go

index cd8233ceb6a60e2d3f0d55199d0dcb60d7912176..20ec8927b4692b304672b19162ba85306b7ec21e 100644 (file)
@@ -79,3 +79,18 @@ func ExampleJoin() {
        // a/b/c
        // a/b/c
 }
+
+func ExampleMatch() {
+       fmt.Println("On Unix:")
+       fmt.Println(filepath.Match("/home/catch/*", "/home/catch/foo"))
+       fmt.Println(filepath.Match("/home/catch/*", "/home/catch/foo/bar"))
+       fmt.Println(filepath.Match("/home/?opher", "/home/gopher"))
+       fmt.Println(filepath.Match("/home/\\*", "/home/*"))
+
+       // Output:
+       // On Unix:
+       // true <nil>
+       // false <nil>
+       // true <nil>
+       // true <nil>
+}