From 5efd29e54e3fa61dfa9bc629df9e318b91a991ec Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 3 Dec 2024 21:30:05 +0100 Subject: [PATCH 1/3] build: relax required go version for local development --- .forgejo/workflows-composite/setup-env/action.yaml | 10 ++++++++++ go.mod | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.forgejo/workflows-composite/setup-env/action.yaml b/.forgejo/workflows-composite/setup-env/action.yaml index 4fac0c0f46..83cce157bd 100644 --- a/.forgejo/workflows-composite/setup-env/action.yaml +++ b/.forgejo/workflows-composite/setup-env/action.yaml @@ -13,3 +13,13 @@ runs: - uses: https://codeberg.org/fnetx/setup-cache-go@4b50dd28b1068fa06d433c5fabed3f6f4d4ccddf with: username: forgejo + + - name: validate go version + run: | + set -ex + toolchain=$(grep -oP '(?<=toolchain ).+' go.mod) + version=$(go version | cut -d' ' -f3) + if [ "$toolchain" != "$version" ]; then + echo "go version mismatch: $toolchain <> $version" + exit 1 + fi diff --git a/go.mod b/go.mod index f70c7096af..a9200df998 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module code.gitea.io/gitea -go 1.23.3 +go 1.23.1 + +toolchain go1.23.3 require ( code.forgejo.org/f3/gof3/v3 v3.7.0 From f61db3f2c14fa1f02ab54d4ecccaae84fcb19d3f Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 3 Dec 2024 22:25:45 +0100 Subject: [PATCH 2/3] build: use go from goroot for fmt --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8cf06a20e8..b0277b95d5 100644 --- a/Makefile +++ b/Makefile @@ -337,7 +337,7 @@ clean: .PHONY: fmt fmt: - @GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}' + @GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(shell $(GO) env GOROOT) run build/code-batch-process.go gitea-fmt -w '{file-list}' $(eval TEMPLATES := $(shell find templates -type f -name '*.tmpl')) @# strip whitespace after '{{' or '(' and before '}}' or ')' unless there is only @# whitespace before it From df765431e49686cf863ce524a339776163ef0acf Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 3 Dec 2024 22:30:55 +0100 Subject: [PATCH 3/3] build: fix go command --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b0277b95d5..1f350dc256 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ DIST := dist DIST_DIRS := $(DIST)/binaries $(DIST)/release IMPORT := code.gitea.io/gitea -GO ?= go +GO ?= $(shell go env GOROOT)/bin/go SHASUM ?= shasum -a 256 HAS_GO := $(shell hash $(GO) > /dev/null 2>&1 && echo yes) COMMA := , @@ -337,7 +337,7 @@ clean: .PHONY: fmt fmt: - @GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(shell $(GO) env GOROOT) run build/code-batch-process.go gitea-fmt -w '{file-list}' + @GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}' $(eval TEMPLATES := $(shell find templates -type f -name '*.tmpl')) @# strip whitespace after '{{' or '(' and before '}}' or ')' unless there is only @# whitespace before it @@ -620,7 +620,7 @@ tidy-check: tidy go-licenses: $(GO_LICENSE_FILE) $(GO_LICENSE_FILE): go.mod go.sum - -$(shell $(GO) env GOROOT)/bin/go run $(GO_LICENSES_PACKAGE) save . --force --ignore code.gitea.io/gitea --save_path=$(GO_LICENSE_TMP_DIR) 2>/dev/null + -$(GO) run $(GO_LICENSES_PACKAGE) save . --force --ignore code.gitea.io/gitea --save_path=$(GO_LICENSE_TMP_DIR) 2>/dev/null $(GO) run build/generate-go-licenses.go $(GO_LICENSE_TMP_DIR) $(GO_LICENSE_FILE) @rm -rf $(GO_LICENSE_TMP_DIR)