From 1ae8624e0564c0acf02e3f45bd13a8c98b750299 Mon Sep 17 00:00:00 2001 From: ze0s <43699394+zze0s@users.noreply.github.com> Date: Thu, 1 May 2025 16:36:55 +0200 Subject: [PATCH] build(deps): bump Go to 1.24 (#2060) * build(deps): bump Go to 1.24 --- .github/workflows/codeql.yml | 2 +- .github/workflows/golang-linter.yml | 2 +- .github/workflows/release.yml | 2 +- Dockerfile | 2 +- ci.Dockerfile | 2 +- ciwindows.Dockerfile | 2 +- go.mod | 2 +- internal/list/process_list_trakt.go | 20 ++++++-------------- internal/proxy/service.go | 2 +- pkg/jsonrpc/jsonrpc.go | 3 +-- 10 files changed, 15 insertions(+), 24 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index aa8bce7..4a4edf0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -21,7 +21,7 @@ on: - cron: '20 13 * * 6' env: - GO_VERSION: '1.23' + GO_VERSION: '1.24' NODE_VERSION: '20.17.0' jobs: diff --git a/.github/workflows/golang-linter.yml b/.github/workflows/golang-linter.yml index b4f6319..2de9846 100644 --- a/.github/workflows/golang-linter.yml +++ b/.github/workflows/golang-linter.yml @@ -9,7 +9,7 @@ on: pull_request: env: - GO_VERSION: '1.23' + GO_VERSION: '1.24' NODE_VERSION: '20.17.0' jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b6b157e..55cd1fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ on: env: REGISTRY: ghcr.io REGISTRY_IMAGE: ghcr.io/${{ github.repository }} - GO_VERSION: '1.23' + GO_VERSION: '1.24' NODE_VERSION: '20.17.0' permissions: diff --git a/Dockerfile b/Dockerfile index 366ee7d..c904a76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ COPY web ./ RUN pnpm run build # build app -FROM golang:1.23-alpine3.20 AS app-builder +FROM golang:1.24-alpine3.21 AS app-builder ARG VERSION=dev ARG REVISION=dev diff --git a/ci.Dockerfile b/ci.Dockerfile index f21cc23..44c1cb3 100644 --- a/ci.Dockerfile +++ b/ci.Dockerfile @@ -1,5 +1,5 @@ # build app -FROM --platform=$BUILDPLATFORM golang:1.23-alpine3.20 AS app-builder +FROM --platform=$BUILDPLATFORM golang:1.24-alpine3.21 AS app-builder RUN apk add --no-cache git tzdata ENV SERVICE=autobrr diff --git a/ciwindows.Dockerfile b/ciwindows.Dockerfile index 21749a9..d77473e 100644 --- a/ciwindows.Dockerfile +++ b/ciwindows.Dockerfile @@ -1,5 +1,5 @@ # build app -FROM --platform=$BUILDPLATFORM golang:1.23-alpine3.20 AS app-builder +FROM --platform=$BUILDPLATFORM golang:1.24-alpine3.20 AS app-builder RUN apk add --no-cache git tzdata ENV SERVICE=autobrr diff --git a/go.mod b/go.mod index 2799bc3..761cb60 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/autobrr/autobrr -go 1.23.2 +go 1.24 replace github.com/r3labs/sse/v2 => github.com/autobrr/sse/v2 v2.0.0-20230520125637-530e06346d7d diff --git a/internal/list/process_list_trakt.go b/internal/list/process_list_trakt.go index 2cbeaf9..22c4888 100644 --- a/internal/list/process_list_trakt.go +++ b/internal/list/process_list_trakt.go @@ -6,7 +6,6 @@ package list import ( "context" "encoding/json" - "fmt" "net/http" "strings" @@ -19,17 +18,14 @@ func (s *service) trakt(ctx context.Context, list *domain.List) error { l := s.log.With().Str("type", "trakt").Str("list", list.Name).Logger() if list.URL == "" { - errMsg := "no URL provided for steam" - l.Error().Msg(errMsg) - return fmt.Errorf(errMsg) + return errors.Errorf("no URL provided for trakt: %s", list.Name) } l.Debug().Msgf("fetching titles from %s", list.URL) req, err := http.NewRequestWithContext(ctx, http.MethodGet, list.URL, nil) if err != nil { - l.Error().Err(err).Msg("could not make new request") - return err + return errors.Wrapf(err, "could not make new request for URL: %s", list.URL) } req.Header.Set("trakt-api-version", "2") @@ -44,20 +40,17 @@ func (s *service) trakt(ctx context.Context, list *domain.List) error { resp, err := s.httpClient.Do(req) if err != nil { - l.Error().Err(err).Msgf("failed to fetch titles from URL: %s", list.URL) - return err + return errors.Wrapf(err, "failed to fetch titles from URL: %s", list.URL) } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - l.Error().Msgf("failed to fetch titles from URL: %s", list.URL) - return fmt.Errorf("failed to fetch titles from URL: %s", list.URL) + return errors.Errorf("failed to fetch titles from URL: %s", list.URL) } contentType := resp.Header.Get("Content-Type") if !strings.HasPrefix(contentType, "application/json") { - errMsg := fmt.Sprintf("invalid content type for URL: %s, content type should be application/json", list.URL) - return fmt.Errorf(errMsg) + return errors.Errorf("invalid content type for URL: %s, content type should be application/json", list.URL) } var data []struct { @@ -71,8 +64,7 @@ func (s *service) trakt(ctx context.Context, list *domain.List) error { } if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { - l.Error().Err(err).Msgf("failed to decode JSON data from URL: %s", list.URL) - return err + return errors.Wrapf(err, "failed to decode JSON data from URL: %s", list.URL) } var titles []string diff --git a/internal/proxy/service.go b/internal/proxy/service.go index e681855..44accdb 100644 --- a/internal/proxy/service.go +++ b/internal/proxy/service.go @@ -141,7 +141,7 @@ func (s *service) Test(ctx context.Context, proxy *domain.Proxy) error { } if resp.StatusCode != http.StatusOK { - return errors.New(resp.Status) + return errors.New("got unexpected status code: %d", resp.StatusCode) } s.log.Debug().Msgf("proxy %s test OK!", proxy.Addr) diff --git a/pkg/jsonrpc/jsonrpc.go b/pkg/jsonrpc/jsonrpc.go index bb817d9..70ed870 100644 --- a/pkg/jsonrpc/jsonrpc.go +++ b/pkg/jsonrpc/jsonrpc.go @@ -7,7 +7,6 @@ import ( "bytes" "context" "encoding/json" - "fmt" "net/http" "reflect" "strconv" @@ -186,7 +185,7 @@ func (c *rpcClient) doCall(ctx context.Context, request RPCRequest) (*RPCRespons if err != nil { if httpResponse.StatusCode >= 400 { - return nil, errors.Wrap(err, fmt.Sprintf("rpc call %v() on %v status code: %v. Could not decode body to rpc response", request.Method, httpRequest.URL.String(), httpResponse.StatusCode)) + return nil, errors.Wrap(err, "rpc call %v() on %v status code: %v. Could not decode body to rpc response", request.Method, httpRequest.URL.String(), httpResponse.StatusCode) } // if res.StatusCode == http.StatusUnauthorized { // return nil, errors.New("unauthorized: bad credentials")