Globbing
This commit is contained in:
parent
ae5f777689
commit
2a32c99767
@ -100,7 +100,7 @@ func (gs *goldsmith) chainSingle(s stage, cs ChainerSingle, globs []string) {
|
|||||||
matched := true
|
matched := true
|
||||||
if len(globs) > 0 {
|
if len(globs) > 0 {
|
||||||
var err error
|
var err error
|
||||||
if matched, err = globMatch(file.Path, globs); err != nil {
|
if matched, err = globMatch(globs, file.Path); err != nil {
|
||||||
file.Err = err
|
file.Err = err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ func (gs *goldsmith) chainMultiple(s stage, cm ChainerMultiple, globs []string)
|
|||||||
matched := true
|
matched := true
|
||||||
if len(globs) > 0 {
|
if len(globs) > 0 {
|
||||||
var err error
|
var err error
|
||||||
if matched, err = globMatch(file.Path, globs); err != nil {
|
if matched, err = globMatch(globs, file.Path); err != nil {
|
||||||
file.Err = err
|
file.Err = err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
util.go
4
util.go
@ -24,14 +24,14 @@ package goldsmith
|
|||||||
|
|
||||||
import "path/filepath"
|
import "path/filepath"
|
||||||
|
|
||||||
func globMatch(pattern string, globs []string) (bool, error) {
|
func globMatch(globs []string, name string) (bool, error) {
|
||||||
var (
|
var (
|
||||||
match bool
|
match bool
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
for _, glob := range globs {
|
for _, glob := range globs {
|
||||||
match, err = filepath.Match(pattern, glob)
|
match, err = filepath.Match(glob, name)
|
||||||
if err != nil || match {
|
if err != nil || match {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user