From 8b236c2e265b129798ca4bcd5647bcfdcdb4eef9 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 5 Aug 2026 22:50:18 +0000 Subject: [PATCH] chore: align go version handling with gitea (#226) 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/gitea-mcp/pulls/226 Reviewed-by: techknowlogick <9+techknowlogick@noreply.gitea.com> Co-authored-by: silverwind --- .gitea/workflows/release-tag.yml | 3 ++- .gitea/workflows/test-pr.yml | 1 + Makefile | 5 +++++ go.mod | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/release-tag.yml b/.gitea/workflows/release-tag.yml index 13318bf..c9feab3 100644 --- a/.gitea/workflows/release-tag.yml +++ b/.gitea/workflows/release-tag.yml @@ -16,7 +16,8 @@ jobs: - name: Set up Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7 with: - go-version: stable + go-version-file: 'go.mod' + check-latest: true - name: Install GoReleaser run: go install github.com/goreleaser/goreleaser/v2@latest - name: Run GoReleaser diff --git a/.gitea/workflows/test-pr.yml b/.gitea/workflows/test-pr.yml index 0e2689b..d6cfe00 100644 --- a/.gitea/workflows/test-pr.yml +++ b/.gitea/workflows/test-pr.yml @@ -11,6 +11,7 @@ jobs: - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7 with: go-version-file: 'go.mod' + check-latest: true - name: lint run: make lint - name: build diff --git a/Makefile b/Makefile index fe709b7..7e48e58 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,12 @@ security-check: ## run security check .PHONY: tidy tidy: ## run go mod tidy $(eval MIN_GO_VERSION := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2)) + $(eval GO_TOOLCHAIN := $(shell grep -Eo '^toolchain\s+go[0-9.]+' go.mod | cut -d' ' -f2)) $(GO) mod tidy -compat=$(MIN_GO_VERSION) + @# 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: vendor vendor: tidy ## tidy and verify module dependencies diff --git a/go.mod b/go.mod index 255ff5e..e8e3581 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module gitea.com/gitea/gitea-mcp go 1.26.0 +toolchain go1.26.5 + require ( gitea.dev/sdk v1.2.0 github.com/mark3labs/mcp-go v0.57.0