diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-01-20 18:07:41 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-01-22 10:28:12 +0100 |
commit | 9421380168f66620cb73203e1267814b3086d805 (patch) | |
tree | 0946c9982ebfd61bb74268e69302e2364171d6f2 /Gopkg.toml | |
parent | 5d03086981b4a7d4bc450269a6a2e0fd22dbeed7 (diff) |
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
Diffstat (limited to 'Gopkg.toml')
-rw-r--r-- | Gopkg.toml | 4 |
1 files changed, 4 insertions, 0 deletions
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" |