aboutsummaryrefslogtreecommitdiff
path: root/src/path
diff options
context:
space:
mode:
authorAurélien Rainone <aurelien.rainone@gmail.com>2018-10-23 16:56:41 +0200
committerIan Lance Taylor <iant@golang.org>2018-10-24 20:57:32 +0000
commit7989119d1765955319141003ae21c8ff36f80bfb (patch)
treebfd6f0b2f9e670fa6e4b9e3b9e9888b148f38db5 /src/path
parent9f7b1a8259fb5be07e41b5f74445f16a6a23e963 (diff)
downloadgo-7989119d1765955319141003ae21c8ff36f80bfb.tar.gz
go-7989119d1765955319141003ae21c8ff36f80bfb.zip
path/filepath: add example for Match
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>
Diffstat (limited to 'src/path')
-rw-r--r--src/path/filepath/example_unix_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/path/filepath/example_unix_test.go b/src/path/filepath/example_unix_test.go
index cd8233ceb6..20ec8927b4 100644
--- a/src/path/filepath/example_unix_test.go
+++ b/src/path/filepath/example_unix_test.go
@@ -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>
+}