From 9421380168f66620cb73203e1267814b3086d805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 20 Jan 2018 18:07:41 +0100 Subject: resource: Add Match and GetMatch These methods takes a glob pattern as argument: * by default matching from the bundle root * matching is case insensitive and the separator is Unix style slashes: "/" * the bundle root does (by default) not start with a leading slash * if you renames the `Name` for the rsource in front matter (`src=...`), then that is the value used in `Match`. * double asterisk matches beyond directory borders, so "**.jpg" will match any JPEG image in the bundle See https://github.com/gobwas/glob This commit also deprecates `ByPrefix` and `GetByPrefix`. This should also be more effective, given a fair amount of reuse of the glob patterns: ```bash BenchmarkResourcesByPrefix-4 300000 4284 ns/op 1130 B/op 7 allocs/op BenchmarkResourcesMatch-4 300000 5220 ns/op 505 B/op 3 allocs/op ``` Fixes #4301 --- Gopkg.toml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Gopkg.toml') diff --git a/Gopkg.toml b/Gopkg.toml index 5218dc3af..b07a41f7c 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -131,3 +131,7 @@ [[constraint]] branch = "v2" name = "gopkg.in/yaml.v2" + +[[constraint]] + name = "github.com/gobwas/glob" + version = "0.2.2" -- cgit v1.2.3