github.com/henvic/wedeploycli@v1.7.6-0.20200319005353-3630f582f284/deployment/internal/ignore/ignore.go (about) 1 package ignore 2 3 import ( 4 "path/filepath" 5 ) 6 7 // These ignore rules were extracted and adapted from github.com/github/gitignore 8 // Though it contains lots of files, it isn't an exhaustive list. 9 10 // Match if a filename matches the ignore list 11 func Match(path string) bool { 12 for _, p := range Patterns { 13 // github.com/gobwas/glob has better performance, but 14 // premature optimization is the root of all evil 15 if ok, _ := filepath.Match(p, filepath.Base(path)); ok { 16 return true 17 } 18 } 19 20 return false 21 }