diff --git a/cmd/lure-api-server/main.go b/cmd/lure-api-server/main.go index 1d14fb2..43315ba 100644 --- a/cmd/lure-api-server/main.go +++ b/cmd/lure-api-server/main.go @@ -77,8 +77,10 @@ func allowAllCORSHandler(h http.Handler) http.Handler { }) } -type acceptLanguageKey struct{} -type langParameterKey struct{} +type ( + acceptLanguageKey struct{} + langParameterKey struct{} +) func withAcceptLanguage(h http.Handler) http.Handler { return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { @@ -86,10 +88,10 @@ func withAcceptLanguage(h http.Handler) http.Handler { langs := req.Header.Get("Accept-Language") ctx = context.WithValue(ctx, acceptLanguageKey{}, langs) - + lang := req.URL.Query().Get("lang") ctx = context.WithValue(ctx, langParameterKey{}, lang) - + req = req.WithContext(ctx) h.ServeHTTP(res, req) diff --git a/internal/dlcache/dlcache.go b/internal/dlcache/dlcache.go index c62e471..96eb7a5 100644 --- a/internal/dlcache/dlcache.go +++ b/internal/dlcache/dlcache.go @@ -1,13 +1,12 @@ package dlcache import ( + "crypto/sha1" "encoding/hex" "io" "os" "path/filepath" - "crypto/sha1" - "go.arsenm.dev/lure/internal/config" )