From 70387cca44268ba14374e0692f32a89ea4b9caaa Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 5 Aug 2026 22:50:11 +0000 Subject: [PATCH] chore: align go version handling with gitea (#1144) Aligns Go version handling with gitea, see https://github.com/go-gitea/gitea/pull/38559. `toolchain` names the build version, `go` stays the minimum. Reviewed-on: https://gitea.com/gitea/runner/pulls/1144 Reviewed-by: techknowlogick <9+techknowlogick@noreply.gitea.com> Co-authored-by: silverwind --- .gitea/workflows/release-nightly.yml | 1 + .gitea/workflows/release-tag.yml | 1 + .gitea/workflows/test.yml | 1 + Makefile | 5 +++++ go.mod | 2 ++ 5 files changed, 10 insertions(+) diff --git a/.gitea/workflows/release-nightly.yml b/.gitea/workflows/release-nightly.yml index 3f0b8ed3..e34cefa5 100644 --- a/.gitea/workflows/release-nightly.yml +++ b/.gitea/workflows/release-nightly.yml @@ -35,6 +35,7 @@ jobs: - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7 with: go-version-file: "go.mod" + check-latest: true - name: goreleaser uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7 with: diff --git a/.gitea/workflows/release-tag.yml b/.gitea/workflows/release-tag.yml index 21325c98..df6bfb79 100644 --- a/.gitea/workflows/release-tag.yml +++ b/.gitea/workflows/release-tag.yml @@ -27,6 +27,7 @@ jobs: - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7 with: go-version-file: "go.mod" + check-latest: true - name: Import GPG key id: import_gpg uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7 diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 7c32f3b6..f98652e5 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -21,6 +21,7 @@ jobs: - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7 with: go-version-file: 'go.mod' + check-latest: true - name: prepare anonymous docker config run: mkdir -p "$DOCKER_CONFIG" && echo '{}' > "$DOCKER_CONFIG/config.json" # Pre-pull act/runner's two largest base images so a slow pull can't dominate `make test`; diff --git a/Makefile b/Makefile index 8460278b..10b83389 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,12 @@ security-check: .PHONY: tidy tidy: ## run go mod tidy + $(eval GO_TOOLCHAIN := $(shell grep -Eo '^toolchain\s+go[0-9.]+' go.mod | cut -d' ' -f2)) $(GO) mod tidy + @# workaround https://github.com/golang/go/issues/75331: restore toolchain if tidy dropped it + @if [ -n "$(GO_TOOLCHAIN)" ] && ! grep -qE '^toolchain\s' go.mod; then \ + $(GO) mod edit -toolchain=$(GO_TOOLCHAIN); \ + fi .PHONY: tidy-check tidy-check: tidy diff --git a/go.mod b/go.mod index 269122da..0b21a597 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module gitea.com/gitea/runner go 1.26.0 +toolchain go1.26.5 + require ( connectrpc.com/connect v1.20.0 dario.cat/mergo v1.0.2