Files
athens/pkg/module/parser.go
marpio 769f833999 add gofmt, golint and go vet to ci (#85)
* add gofmt, golint and go vet to ci

* result of gofmt -w .
2018-03-22 14:46:59 -07:00

41 lines
732 B
Go

package module
import (
"strings"
ignore "github.com/sabhiram/go-gitignore"
)
type multiIgnoreParser struct {
parsers []ignore.IgnoreParser
}
// Returns map of patterns for more performant searches
func newMultiIgnoreParser(parsers ...ignore.IgnoreParser) ignore.IgnoreParser {
parser := multiIgnoreParser{}
for _, p := range parsers {
if p != nil {
parser.parsers = append(parser.parsers, p)
}
}
return parser
}
func (p multiIgnoreParser) MatchesPath(f string) bool {
for _, parser := range p.parsers {
if parser.MatchesPath(f) {
return true
}
}
return false
}
type dsStoreIgnoreParser struct{}
func (p dsStoreIgnoreParser) MatchesPath(f string) bool {
return strings.Contains(f, "/.DS_Store")
}