From 7989119d1765955319141003ae21c8ff36f80bfb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aur=C3=A9lien=20Rainone?= Date: Tue, 23 Oct 2018 16:56:41 +0200 Subject: [PATCH] path/filepath: add example for Match Change-Id: Id2df4895a95904a607e54dd9810bfe97f5e12a73 Reviewed-on: https://go-review.googlesource.com/c/144105 Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/path/filepath/example_unix_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 + // false + // true + // true +} -- 2.48.1