From 0feba9cbeb63eae964b36e14c2ee2a3da16bead0 Mon Sep 17 00:00:00 2001 From: Marc Nuri Date: Mon, 31 Aug 2026 12:21:50 +0200 Subject: [PATCH] fix(build): derive xgo image tag from GO_VERSION The Go version was pinned in three places and #422 updated only two: native/go.mod, GO_VERSION in the workflows, and the hardcoded xgo image tag here (left at go-1.25.10). Once go.mod requires go >= 1.26.0, the toolchain inside the go-1.25.10 container auto-downloads Go 1.26.0 and runs its linker against that image's older GNU binutils, which cannot parse the .def file Go 1.26 emits. The Windows DLL then fails to link and the enforcer reports the missing file as the symptom. Deriving the tag from GO_VERSION removes the drift: CI already exports it, and make's `?=` prefers the environment value. Co-Authored-By: Claude Opus 5 (1M context) Signed-off-by: Marc Nuri --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0c6acb6..40abba4 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,13 @@ .DEFAULT_GOAL := help CGO_ENABLED = 1 +# Go toolchain version. CI exports GO_VERSION (see .github/workflows/*.yml), which +# overrides this default, so the two cannot drift apart. +# The xgo image must ship a Go >= the `go` directive in native/go.mod. Otherwise the +# container silently downloads a newer toolchain whose linker is incompatible with +# that image's mingw-w64 binutils, and the Windows DLL fails to link. +GO_VERSION ?= 1.26.7 +XGO_IMAGE = ghcr.io/techknowlogick/xgo:go-$(GO_VERSION) LD_FLAGS = -s -w COMMON_BUILD_ARGS = -ldflags "$(LD_FLAGS)" -buildmode=c-shared MAVEN_OPTIONS = @@ -59,7 +66,7 @@ build-native: ## Build the native shared library for the current platform .PHONY: build-native-cross-platform build-native-cross-platform: ## Build native shared libraries for all 5 supported platforms (requires Docker) go install src.techknowlogick.com/xgo@latest - xgo -image ghcr.io/techknowlogick/xgo:go-1.25.10 $(COMMON_BUILD_ARGS) -out native/out/helm --targets */arm64,*/amd64 ./native + xgo -image $(XGO_IMAGE) $(COMMON_BUILD_ARGS) -out native/out/helm --targets */arm64,*/amd64 ./native .PHONY: build-java build-java: ## Build and verify the Java artifacts (mvn clean verify)