Correct linter errors

This commit is contained in:
Seednode 2024-02-28 11:17:33 -06:00
parent 0053f0e986
commit 2416dc26aa
4 changed files with 13 additions and 13 deletions

View File

@ -306,7 +306,7 @@ func walkPath(path string, fileChannel chan<- string, wg1 *sync.WaitGroup, stats
wg2.Wait() wg2.Wait()
} }
func scanPaths(paths []string, sort string, index *fileIndex, formats types.Types, errorChannel chan<- error) []string { func scanPaths(paths []string, formats types.Types, errorChannel chan<- error) []string {
startTime := time.Now() startTime := time.Now()
var filesMatched, filesSkipped int var filesMatched, filesSkipped int
@ -430,24 +430,24 @@ func scanPaths(paths []string, sort string, index *fileIndex, formats types.Type
return list return list
} }
func fileList(paths []string, filters *filters, sort string, index *fileIndex, formats types.Types, errorChannel chan<- error) []string { func fileList(paths []string, filters *filters, index *fileIndex, formats types.Types, errorChannel chan<- error) []string {
switch { switch {
case Index && !index.isEmpty() && filters.isEmpty(): case Index && !index.isEmpty() && filters.isEmpty():
return index.List() return index.List()
case Index && !index.isEmpty() && !filters.isEmpty(): case Index && !index.isEmpty() && !filters.isEmpty():
return filters.apply(index.List()) return filters.apply(index.List())
case Index && index.isEmpty() && !filters.isEmpty(): case Index && index.isEmpty() && !filters.isEmpty():
index.set(scanPaths(paths, sort, index, formats, errorChannel), errorChannel) index.set(scanPaths(paths, formats, errorChannel), errorChannel)
return filters.apply(index.List()) return filters.apply(index.List())
case Index && index.isEmpty() && filters.isEmpty(): case Index && index.isEmpty() && filters.isEmpty():
index.set(scanPaths(paths, sort, index, formats, errorChannel), errorChannel) index.set(scanPaths(paths, formats, errorChannel), errorChannel)
return index.List() return index.List()
case !Index && !filters.isEmpty(): case !Index && !filters.isEmpty():
return filters.apply(scanPaths(paths, sort, index, formats, errorChannel)) return filters.apply(scanPaths(paths, formats, errorChannel))
default: default:
return scanPaths(paths, sort, index, formats, errorChannel) return scanPaths(paths, formats, errorChannel)
} }
} }
@ -459,7 +459,7 @@ func pickFile(list []string) (string, error) {
return "", nil return "", nil
case fileCount < 1: case fileCount < 1:
return "", ErrNoMediaFound return "", ErrNoMediaFound
} }
return list[rand.IntN(fileCount)], nil return list[rand.IntN(fileCount)], nil
} }

View File

@ -237,7 +237,7 @@ func (index *fileIndex) Import(path string, errorChannel chan<- error) {
func rebuildIndex(paths []string, index *fileIndex, formats types.Types, errorChannel chan<- error) { func rebuildIndex(paths []string, index *fileIndex, formats types.Types, errorChannel chan<- error) {
index.clear() index.clear()
fileList(paths, &filters{}, "", index, formats, errorChannel) fileList(paths, &filters{}, index, formats, errorChannel)
} }
func importIndex(paths []string, index *fileIndex, formats types.Types, errorChannel chan<- error) { func importIndex(paths []string, index *fileIndex, formats types.Types, errorChannel chan<- error) {
@ -245,7 +245,7 @@ func importIndex(paths []string, index *fileIndex, formats types.Types, errorCha
index.Import(IndexFile, errorChannel) index.Import(IndexFile, errorChannel)
} }
fileList(paths, &filters{}, "", index, formats, errorChannel) fileList(paths, &filters{}, index, formats, errorChannel)
} }
func serveIndex(index *fileIndex, errorChannel chan<- error) httprouter.Handle { func serveIndex(index *fileIndex, errorChannel chan<- error) httprouter.Handle {

View File

@ -17,7 +17,7 @@ import (
const ( const (
AllowedCharacters string = `^[A-z0-9.\-_]+$` AllowedCharacters string = `^[A-z0-9.\-_]+$`
ReleaseVersion string = "8.8.0" ReleaseVersion string = "8.8.1"
) )
var ( var (

View File

@ -193,7 +193,7 @@ func serveRoot(paths []string, index *fileIndex, filename *regexp.Regexp, format
} }
} }
list := fileList(paths, filters, sortOrder, index, formats, errorChannel) list := fileList(paths, filters, index, formats, errorChannel)
loop: loop:
for timeout := time.After(timeout); ; { for timeout := time.After(timeout); ; {
@ -249,7 +249,7 @@ func serveRoot(paths []string, index *fileIndex, filename *regexp.Regexp, format
} }
} }
func serveMedia(paths []string, index *fileIndex, filename *regexp.Regexp, formats types.Types, errorChannel chan<- error) httprouter.Handle { func serveMedia(index *fileIndex, filename *regexp.Regexp, formats types.Types, errorChannel chan<- error) httprouter.Handle {
return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) { return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
startTime := time.Now() startTime := time.Now()
@ -581,7 +581,7 @@ func ServePage(args []string) error {
mux.GET(Prefix+"/favicon.ico", serveFavicons(errorChannel)) mux.GET(Prefix+"/favicon.ico", serveFavicons(errorChannel))
mux.GET(Prefix+mediaPrefix+"/*media", serveMedia(paths, index, filename, formats, errorChannel)) mux.GET(Prefix+mediaPrefix+"/*media", serveMedia(index, filename, formats, errorChannel))
mux.GET(Prefix+sourcePrefix+"/*static", serveStaticFile(paths, index, errorChannel)) mux.GET(Prefix+sourcePrefix+"/*static", serveStaticFile(paths, index, errorChannel))