Exit early from path validation if checks pass, instead of completing the loop

This commit is contained in:
Seednode 2023-10-03 11:07:58 -05:00
parent e67752470d
commit 5a37bf3beb
2 changed files with 6 additions and 1 deletions

View File

@ -177,6 +177,8 @@ func pathIsValid(path string, paths []string) bool {
for i := 0; i < len(paths); i++ {
if strings.HasPrefix(path, paths[i]) {
matchesPrefix = true
break
}
}
@ -306,6 +308,7 @@ func walkPath(path string, fileChannel chan<- string, stats *scanStatsChannels,
go func() {
wg.Wait()
done <- true
}()
@ -366,6 +369,7 @@ func scanPaths(paths []string, sort string, index *fileIndex, formats *types.Typ
go func() {
wg.Wait()
done <- true
}()
@ -391,6 +395,7 @@ Poll:
if stats.filesMatched < 1 {
fmt.Println("No files matched")
return []string{}, nil
}

View File

@ -12,7 +12,7 @@ import (
)
const (
ReleaseVersion string = "2.3.0"
ReleaseVersion string = "2.3.1"
)
var (