From: Aurélien Rainone Date: Tue, 23 Oct 2018 14:56:41 +0000 (+0200) Subject: path/filepath: add example for Match X-Git-Tag: go1.12beta1~651 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7989119d1765955319141003ae21c8ff36f80bfb;p=gostls13.git 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 --- 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 +}