From e8cb614b2eda96ab740349a664b8bc4ffc1f6174 Mon Sep 17 00:00:00 2001 From: Elara Musayelyan Date: Tue, 11 Jul 2023 13:15:06 -0700 Subject: [PATCH] Run formatter --- cmd/lure-api-server/main.go | 6 +++--- internal/dl/torrent.go | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cmd/lure-api-server/main.go b/cmd/lure-api-server/main.go index 88fb269..be7e09b 100644 --- a/cmd/lure-api-server/main.go +++ b/cmd/lure-api-server/main.go @@ -25,12 +25,12 @@ import ( "net/http" "os" + "github.com/go-chi/chi/v5" "github.com/twitchtv/twirp" "go.elara.ws/logger" "go.elara.ws/logger/log" "go.elara.ws/lure/internal/api" "go.elara.ws/lure/internal/repos" - "github.com/go-chi/chi/v5" ) func init() { @@ -61,12 +61,12 @@ func main() { sigCh := make(chan struct{}, 200) go repoPullWorker(ctx, sigCh) - + apiServer := api.NewAPIServer( lureWebAPI{db: gdb}, twirp.WithServerPathPrefix(""), ) - + r := chi.NewRouter() r.With(allowAllCORSHandler, withAcceptLanguage).Handle("/*", apiServer) r.Post("/webhook", handleWebhook(sigCh)) diff --git a/internal/dl/torrent.go b/internal/dl/torrent.go index 3909919..c09931c 100644 --- a/internal/dl/torrent.go +++ b/internal/dl/torrent.go @@ -1,19 +1,20 @@ package dl import ( + "errors" "fmt" "os" "os/exec" "path/filepath" "regexp" "strings" - - "errors" ) -var urlMatchRegex = regexp.MustCompile(`(magnet|torrent\+https?):.*`) -var ErrAria2NotFound = errors.New("aria2 must be installed for torrent functionality") -var ErrDestinationEmpty = errors.New("the destination directory is empty") +var ( + urlMatchRegex = regexp.MustCompile(`(magnet|torrent\+https?):.*`) + ErrAria2NotFound = errors.New("aria2 must be installed for torrent functionality") + ErrDestinationEmpty = errors.New("the destination directory is empty") +) type TorrentDownloader struct{}