Rename variables for consistency's sake

This commit is contained in:
Seednode 2023-09-28 02:47:43 -05:00
parent c11ddae546
commit abe3dbb54f
2 changed files with 24 additions and 24 deletions

View File

@ -151,8 +151,8 @@ func newFile(list []string, sortOrder string, regexes *regexes, formats *types.T
return path, nil return path, nil
} }
func nextFile(path, sortOrder string, regexes *regexes, formats *types.Types) (string, error) { func nextFile(filePath, sortOrder string, regexes *regexes, formats *types.Types) (string, error) {
splitPath, err := split(path, regexes) splitPath, err := split(filePath, regexes)
if err != nil { if err != nil {
return "", err return "", err
} }
@ -166,27 +166,27 @@ func nextFile(path, sortOrder string, regexes *regexes, formats *types.Types) (s
return "", nil return "", nil
} }
fileName, err := tryExtensions(splitPath, formats) path, err := tryExtensions(splitPath, formats)
if err != nil { if err != nil {
return "", err return "", err
} }
return fileName, err return path, err
} }
func tryExtensions(splitPath *splitPath, formats *types.Types) (string, error) { func tryExtensions(splitPath *splitPath, formats *types.Types) (string, error) {
var fileName string var path string
for extension := range formats.Extensions { for extension := range formats.Extensions {
fileName = fmt.Sprintf("%s%.3d%s", splitPath.base, splitPath.number, extension) path = fmt.Sprintf("%s%.3d%s", splitPath.base, splitPath.number, extension)
exists, err := fileExists(fileName) exists, err := fileExists(path)
if err != nil { if err != nil {
return "", err return "", err
} }
if exists { if exists {
return fileName, nil return path, nil
} }
} }
@ -229,7 +229,7 @@ func pathIsValid(path string, paths []string) bool {
} }
} }
func pathHasSupportedFiles(path string, formats *types.Types) (bool, error) { func hasSupportedFiles(path string, formats *types.Types) (bool, error) {
hasRegisteredFiles := make(chan bool, 1) hasRegisteredFiles := make(chan bool, 1)
err := filepath.WalkDir(path, func(p string, info os.DirEntry, err error) error { err := filepath.WalkDir(path, func(p string, info os.DirEntry, err error) error {
@ -409,18 +409,18 @@ func scanPaths(paths []string, sort string, cache *fileCache, formats *types.Typ
Poll: Poll:
for { for {
select { select {
case p := <-fileChannel: case path := <-fileChannel:
list = append(list, p) list = append(list, path)
case s := <-statsChannels.filesMatched: case stat := <-statsChannels.filesMatched:
stats.filesMatched = stats.filesMatched + s stats.filesMatched = stats.filesMatched + stat
case s := <-statsChannels.filesSkipped: case stat := <-statsChannels.filesSkipped:
stats.filesSkipped = stats.filesSkipped + s stats.filesSkipped = stats.filesSkipped + stat
case s := <-statsChannels.directoriesMatched: case stat := <-statsChannels.directoriesMatched:
stats.directoriesMatched = stats.directoriesMatched + s stats.directoriesMatched = stats.directoriesMatched + stat
case s := <-statsChannels.directoriesSkipped: case stat := <-statsChannels.directoriesSkipped:
stats.directoriesSkipped = stats.directoriesSkipped + s stats.directoriesSkipped = stats.directoriesSkipped + stat
case e := <-errorChannel: case err := <-errorChannel:
return []string{}, e return []string{}, err
case <-done: case <-done:
break Poll break Poll
} }
@ -543,12 +543,12 @@ func validatePaths(args []string, formats *types.Types) ([]string, error) {
pathMatches := (args[i] == path) pathMatches := (args[i] == path)
hasSupportedFiles, err := pathHasSupportedFiles(path, formats) hasSupportedFiles, err := hasSupportedFiles(path, formats)
if err != nil { if err != nil {
return nil, err return nil, err
} }
var addPath bool = false var addPath = false
switch { switch {
case pathMatches && hasSupportedFiles: case pathMatches && hasSupportedFiles:

View File

@ -12,7 +12,7 @@ import (
) )
const ( const (
ReleaseVersion string = "0.96.4" ReleaseVersion string = "0.96.5"
) )
var ( var (