Move walkPath() defers out to calling function, for more intuitive readability
This commit is contained in:
parent
9b6d9464e6
commit
d568d10e78
11
cmd/files.go
11
cmd/files.go
|
@ -241,10 +241,6 @@ func hasSupportedFiles(path string, formats types.Types) (bool, error) {
|
|||
}
|
||||
|
||||
func walkPath(path string, fileChannel chan<- string, wg1 *sync.WaitGroup, stats *scanStats, limit chan struct{}, formats types.Types, errorChannel chan<- error) {
|
||||
defer func() {
|
||||
wg1.Done()
|
||||
}()
|
||||
|
||||
limit <- struct{}{}
|
||||
|
||||
defer func() {
|
||||
|
@ -297,7 +293,12 @@ func walkPath(path string, fileChannel chan<- string, wg1 *sync.WaitGroup, stats
|
|||
case node.IsDir() && Recursive:
|
||||
wg1.Add(1)
|
||||
|
||||
go func() {
|
||||
defer wg1.Done()
|
||||
|
||||
walkPath(fullPath, fileChannel, wg1, stats, limit, formats, errorChannel)
|
||||
}()
|
||||
|
||||
case !node.IsDir() && !skipFiles:
|
||||
path, err := normalizePath(fullPath)
|
||||
if err != nil {
|
||||
|
@ -421,6 +422,8 @@ func scanPaths(paths []string, sort string, index *fileIndex, formats types.Type
|
|||
wg1.Add(1)
|
||||
|
||||
go func(i int) {
|
||||
defer wg1.Done()
|
||||
|
||||
walkPath(paths[i], fileChannel, &wg1, stats, limit, formats, errorChannel)
|
||||
}(i)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import (
|
|||
|
||||
const (
|
||||
AllowedCharacters string = `^[A-z0-9.\-_]+$`
|
||||
ReleaseVersion string = "5.0.2"
|
||||
ReleaseVersion string = "5.0.3"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
Loading…
Reference in New Issue