Skip to content

Commit

Permalink
remove unused field and simplify check with strings.ContainsAny
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Sep 1, 2024
1 parent b5c3682 commit 8a005c4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions zglob.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ var (
)

type zenv struct {
dirmask string
fre *regexp.Regexp
braceDir bool
pattern string
root string
dirmask string
fre *regexp.Regexp
pattern string
root string
}

func toSlash(path string) string {
Expand All @@ -51,7 +50,7 @@ func New(pattern string) (*zenv, error) {
globmask := ""
root := ""
for n, i := range strings.Split(toSlash(pattern), "/") {
if root == "" && (strings.Index(i, "*") != -1 || strings.Index(i, "{") != -1) {
if root == "" && strings.ContainsAny(i, "*{") {
if globmask == "" {
root = "."
} else {
Expand Down

0 comments on commit 8a005c4

Please sign in to comment.