Exit early from path validation if checks pass, instead of completing the loop
This commit is contained in:
parent
e67752470d
commit
5a37bf3beb
|
@ -177,6 +177,8 @@ func pathIsValid(path string, paths []string) bool {
|
||||||
for i := 0; i < len(paths); i++ {
|
for i := 0; i < len(paths); i++ {
|
||||||
if strings.HasPrefix(path, paths[i]) {
|
if strings.HasPrefix(path, paths[i]) {
|
||||||
matchesPrefix = true
|
matchesPrefix = true
|
||||||
|
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,6 +308,7 @@ func walkPath(path string, fileChannel chan<- string, stats *scanStatsChannels,
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
done <- true
|
done <- true
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -366,6 +369,7 @@ func scanPaths(paths []string, sort string, index *fileIndex, formats *types.Typ
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
done <- true
|
done <- true
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -391,6 +395,7 @@ Poll:
|
||||||
|
|
||||||
if stats.filesMatched < 1 {
|
if stats.filesMatched < 1 {
|
||||||
fmt.Println("No files matched")
|
fmt.Println("No files matched")
|
||||||
|
|
||||||
return []string{}, nil
|
return []string{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ReleaseVersion string = "2.3.0"
|
ReleaseVersion string = "2.3.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Loading…
Reference in New Issue