From 2416dc26aa22055f9c721e53601ec9726b837740 Mon Sep 17 00:00:00 2001 From: Seednode Date: Wed, 28 Feb 2024 11:17:33 -0600 Subject: [PATCH] Correct linter errors --- cmd/files.go | 14 +++++++------- cmd/index.go | 4 ++-- cmd/root.go | 2 +- cmd/web.go | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cmd/files.go b/cmd/files.go index 2f17f1d..f2d8f12 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -306,7 +306,7 @@ func walkPath(path string, fileChannel chan<- string, wg1 *sync.WaitGroup, stats 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() var filesMatched, filesSkipped int @@ -430,24 +430,24 @@ func scanPaths(paths []string, sort string, index *fileIndex, formats types.Type 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 { case Index && !index.isEmpty() && filters.isEmpty(): return index.List() case Index && !index.isEmpty() && !filters.isEmpty(): return filters.apply(index.List()) 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()) 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() case !Index && !filters.isEmpty(): - return filters.apply(scanPaths(paths, sort, index, formats, errorChannel)) + return filters.apply(scanPaths(paths, formats, errorChannel)) 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 case fileCount < 1: return "", ErrNoMediaFound - } + } return list[rand.IntN(fileCount)], nil } diff --git a/cmd/index.go b/cmd/index.go index 0e35e39..bf1e6c3 100644 --- a/cmd/index.go +++ b/cmd/index.go @@ -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) { 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) { @@ -245,7 +245,7 @@ func importIndex(paths []string, index *fileIndex, formats types.Types, errorCha 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 { diff --git a/cmd/root.go b/cmd/root.go index 5eb2d74..83333bb 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -17,7 +17,7 @@ import ( const ( AllowedCharacters string = `^[A-z0-9.\-_]+$` - ReleaseVersion string = "8.8.0" + ReleaseVersion string = "8.8.1" ) var ( diff --git a/cmd/web.go b/cmd/web.go index b9e2673..3c8cf5c 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -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: 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) { startTime := time.Now() @@ -581,7 +581,7 @@ func ServePage(args []string) error { 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))