Make exclude match on suffices by default
This commit is contained in:
parent
0276b1bfca
commit
5790d3ab5f
7
main.go
7
main.go
|
@ -9,6 +9,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/bmatcuk/doublestar/v4"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -94,7 +95,11 @@ func run(c *cobra.Command, args []string) error {
|
|||
searchPath = append(searchPath, ".")
|
||||
}
|
||||
|
||||
for _, x := range excludeList {
|
||||
for i, x := range excludeList {
|
||||
if !strings.HasPrefix(x, "**/") && !strings.HasPrefix(x, "./") {
|
||||
x = "**/" + x
|
||||
excludeList[i] = x
|
||||
}
|
||||
if !doublestar.ValidatePattern(x) {
|
||||
return fmt.Errorf("invalid exclude pattern %q", x)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue