From dda5841af88866f48fba86530f3fe927fbe26106 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 14 May 2026 05:39:28 +0000 Subject: [PATCH] chore(deps): bump `retry-go`, `golangci-lint`, `govulncheck` (#965) Bumps `github.com/avast/retry-go` v4.7.0 -> v5.0.0, `golangci-lint` v2.11.4 -> v2.12.2 (aligns with gitea/gitea), and pins `govulncheck` to v1.3.0. - `retry-go` v5 replaces the package-level `retry.Do(fn, opts...)` with a builder API `retry.New(opts...).Do(fn)`. The single call site in `internal/pkg/report/reporter.go` was migrated. - `golangci-lint` v2.12.2 surfaces three new findings in `act/` (modernize/slicesbackward, govet/inline): one backward loop now uses `slices.Backward`, and the deprecated `reflect.Ptr` alias is replaced with `reflect.Pointer`. - `go.mod`: the two direct-`require` blocks are merged into one, and a stray `gopkg.in/yaml.v3 // indirect` is moved into the indirect block. Purely cosmetic; `go.sum` is unchanged. --- This PR was written with the help of Claude Opus 4.7 Reviewed-on: https://gitea.com/gitea/runner/pulls/965 Reviewed-by: Lunny Xiao Co-authored-by: silverwind Co-committed-by: silverwind --- Makefile | 4 ++-- act/common/cartesian.go | 4 +++- act/exprparser/interpreter.go | 4 ++-- go.mod | 25 +++++++++++-------------- go.sum | 6 ++---- internal/pkg/report/reporter.go | 10 +++++----- 6 files changed, 25 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 67970e00..caaeb70c 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,8 @@ DOCKER_TAG ?= nightly DOCKER_REF := $(DOCKER_IMAGE):$(DOCKER_TAG) DOCKER_ROOTLESS_REF := $(DOCKER_IMAGE):$(DOCKER_TAG)-dind-rootless -GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.4 -GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1 +GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2 +GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1.3.0 STATIC ?= EXTLDFLAGS ?= diff --git a/act/common/cartesian.go b/act/common/cartesian.go index 96b4ece2..c4f7540c 100644 --- a/act/common/cartesian.go +++ b/act/common/cartesian.go @@ -4,6 +4,8 @@ package common +import "slices" + // CartesianProduct takes map of lists and returns list of unique tuples func CartesianProduct(mapOfLists map[string][]any) []map[string]any { listNames := make([]string, 0) @@ -46,7 +48,7 @@ func cartN(a ...[]any) [][]any { for j, n := range n { pi[j] = a[j][n] } - for j := len(n) - 1; j >= 0; j-- { + for j := range slices.Backward(n) { n[j]++ if n[j] < len(a[j]) { break diff --git a/act/exprparser/interpreter.go b/act/exprparser/interpreter.go index 5b2a171a..6de554eb 100644 --- a/act/exprparser/interpreter.go +++ b/act/exprparser/interpreter.go @@ -251,7 +251,7 @@ func (impl *interperterImpl) evaluateArrayDeref(arrayDerefNode *actionlint.Array func (impl *interperterImpl) getPropertyValue(left reflect.Value, property string) (value any, err error) { switch left.Kind() { - case reflect.Ptr: + case reflect.Pointer: return impl.getPropertyValue(left.Elem(), property) case reflect.Struct: @@ -321,7 +321,7 @@ func (impl *interperterImpl) getPropertyValue(left reflect.Value, property strin } func (impl *interperterImpl) getMapValue(value reflect.Value) (any, error) { - if value.Kind() == reflect.Ptr { + if value.Kind() == reflect.Pointer { return impl.getMapValue(value.Elem()) } diff --git a/go.mod b/go.mod index 7c787829..5b080e73 100644 --- a/go.mod +++ b/go.mod @@ -5,22 +5,9 @@ go 1.26.0 require ( code.gitea.io/actions-proto-go v0.4.1 connectrpc.com/connect v1.19.2 - github.com/avast/retry-go/v4 v4.7.0 - github.com/joho/godotenv v1.5.1 - github.com/mattn/go-isatty v0.0.22 - github.com/sirupsen/logrus v1.9.4 - github.com/spf13/cobra v1.10.2 - github.com/stretchr/testify v1.11.1 - go.yaml.in/yaml/v4 v4.0.0-rc.3 - golang.org/x/term v0.43.0 - google.golang.org/protobuf v1.36.11 - gopkg.in/yaml.v3 v3.0.1 // indirect - gotest.tools/v3 v3.5.2 -) - -require ( dario.cat/mergo v1.0.2 github.com/Masterminds/semver v1.5.0 + github.com/avast/retry-go/v5 v5.0.0 github.com/containerd/errdefs v1.0.0 github.com/creack/pty v1.1.24 github.com/distribution/reference v0.6.0 @@ -30,8 +17,10 @@ require ( github.com/go-git/go-git/v5 v5.19.0 github.com/gobwas/glob v0.2.3 github.com/google/go-cmp v0.7.0 + github.com/joho/godotenv v1.5.1 github.com/julienschmidt/httprouter v1.3.0 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 + github.com/mattn/go-isatty v0.0.22 github.com/moby/go-archive v0.2.0 github.com/moby/moby/api v1.54.2 github.com/moby/moby/client v0.4.1 @@ -41,9 +30,16 @@ require ( github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.23.2 github.com/rhysd/actionlint v1.7.12 + github.com/sirupsen/logrus v1.9.4 + github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 + github.com/stretchr/testify v1.11.1 github.com/timshannon/bolthold v0.0.0-20240314194003-30aac6950928 go.etcd.io/bbolt v1.4.3 + go.yaml.in/yaml/v4 v4.0.0-rc.3 + golang.org/x/term v0.43.0 + google.golang.org/protobuf v1.36.11 + gotest.tools/v3 v3.5.2 tags.cncf.io/container-device-interface v1.1.0 ) @@ -112,4 +108,5 @@ require ( golang.org/x/sync v0.20.0 // indirect golang.org/x/sys v0.44.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index e30f2e63..a07fb560 100644 --- a/go.sum +++ b/go.sum @@ -19,8 +19,8 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFI github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/avast/retry-go/v4 v4.7.0 h1:yjDs35SlGvKwRNSykujfjdMxMhMQQM0TnIjJaHB+Zio= -github.com/avast/retry-go/v4 v4.7.0/go.mod h1:ZMPDa3sY2bKgpLtap9JRUgk2yTAba7cgiFhqxY2Sg6Q= +github.com/avast/retry-go/v5 v5.0.0 h1:kf1Qc2UsTZ4qq8elDymqfbISvkyMuhgRxuJqX2NHP7k= +github.com/avast/retry-go/v5 v5.0.0/go.mod h1://d+usmKWio1agtZfS1H/ltTqwtIfBnRq9zEwjc3eH8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bmatcuk/doublestar/v4 v4.10.0 h1:zU9WiOla1YA122oLM6i4EXvGW62DvKZVxIe6TYWexEs= @@ -147,8 +147,6 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= -github.com/opencontainers/selinux v1.14.0 h1:k1w6YWg3w/TvfZUAc3ksdaRwGNulRbE88TxqAZxUSOE= -github.com/opencontainers/selinux v1.14.0/go.mod h1:LenyElirjUHszfxrjuFqC85HIeXZKumHcKMQtnaDlQQ= github.com/opencontainers/selinux v1.14.1 h1:a7XlXV/nN/l5zFP1FWZYoExpClu1QOPMfWUV2CZ8kEQ= github.com/opencontainers/selinux v1.14.1/go.mod h1:LenyElirjUHszfxrjuFqC85HIeXZKumHcKMQtnaDlQQ= github.com/pjbgf/sha1cd v0.6.0 h1:3WJ8Wz8gvDz29quX1OcEmkAlUg9diU4GxJHqs0/XiwU= diff --git a/internal/pkg/report/reporter.go b/internal/pkg/report/reporter.go index eda52b49..49e839f2 100644 --- a/internal/pkg/report/reporter.go +++ b/internal/pkg/report/reporter.go @@ -19,7 +19,7 @@ import ( runnerv1 "code.gitea.io/actions-proto-go/runner/v1" "connectrpc.com/connect" - "github.com/avast/retry-go/v4" + "github.com/avast/retry-go/v5" log "github.com/sirupsen/logrus" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/timestamppb" @@ -433,12 +433,12 @@ func (r *Reporter) Close(lastWords string) error { // Report the job outcome even when all log upload retry attempts have been exhausted return errors.Join( - retry.Do(func() error { + retry.New(retry.Context(r.ctx)).Do(func() error { return r.ReportLog(true) - }, retry.Context(r.ctx)), - retry.Do(func() error { + }), + retry.New(retry.Context(r.ctx)).Do(func() error { return r.ReportState(true) - }, retry.Context(r.ctx)), + }), ) }