Skip to content

fix(build): derive xgo image tag from GO_VERSION - #424

Merged
manusa merged 1 commit into
mainfrom
fix/xgo-image-go-version
Aug 31, 2026
Merged

fix(build): derive xgo image tag from GO_VERSION#424
manusa merged 1 commit into
mainfrom
fix/xgo-image-go-version

Conversation

@manusa

@manusa manusa commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Problem

The Linux job on #419 fails while cross-compiling the Windows DLL:

x86_64-w64-mingw32-ld: /tmp/go-link-*/export_file.def:1: syntax error
x86_64-w64-mingw32-ld: /tmp/go-link-*/export_file.def: file format not
  recognized; treating as linker script
collect2: error: ld returned 1 exit status

helm-windows-4.0-amd64.dll is therefore never produced, and the build later
stops on:

Rule 1: RequireFilesExist failed with message:
  .../native/out/helm-windows-4.0-amd64.dll

The enforcer error is the symptom that gets reported, not the cause.

Root cause

The Go version is pinned in three places, and only two were updated when
GO_VERSION moved to 1.26.7:

Pin Value
native/go.mod go 1.26.0 (raised by #419)
GO_VERSION in .github/workflows/*.yml 1.26.7
xgo image tag in Makefile go-1.25.10

Once go.mod requires >= 1.26.0, the Go toolchain inside the go-1.25.10
container auto-downloads Go 1.26.0 and links with it — against the mingw-w64
binutils that image ships. That older GNU ld cannot parse the .def file Go
1.26 emits.

This is why main stayed green: its go.mod still says 1.25.10, so the
container never downloads a different toolchain and the mismatch never appears.

Fix

Derive the image tag from GO_VERSION. The workflows already export it, and
make's ?= prefers an environment value over the default, so CI and the
Makefile can no longer drift apart. Local builds default to 1.26.7.

Verification

Ran the exact failing scenario inside ghcr.io/techknowlogick/xgo:go-1.26.7:

  • ships go1.26.7 and LLD 21.1.8 as x86_64-w64-mingw32-ld (not GNU ld)
  • no toolchain download occurs, since 1.26.7 already satisfies the directive
  • a -buildmode=c-shared windows/amd64 build links successfully

Confirmed with go.mod at both go 1.26.0 (as on #419) and go 1.25.10 (as on
main today), so this is safe to land ahead of #419.

Unblocks #419, the last remaining dependabot PR.

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) <noreply@anthropic.com>
Signed-off-by: Marc Nuri <marc@marcnuri.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is small, self-contained in the Makefile, and correctly ties the xgo image tag to the already CI-exported GO_VERSION to eliminate a known drift failure mode.

Pull request overview

Aligns the xgo Docker image selection with the CI-pinned Go toolchain version to prevent Makefile/CI drift that can break cross-compilation (notably the Windows DLL build) when native/go.mod requires a newer Go than the container ships.

Changes:

  • Introduces GO_VERSION ?= 1.26.7 as a Makefile default that is overridden by CI’s exported GO_VERSION.
  • Derives XGO_IMAGE from GO_VERSION and switches the cross-platform build to use -image $(XGO_IMAGE).
File summaries
File Description
Makefile Adds GO_VERSION/XGO_IMAGE variables and uses them for xgo cross-platform builds to keep CI and Makefile in sync.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@manusa
manusa merged commit f4d0908 into main Aug 31, 2026
4 checks passed
@manusa
manusa deleted the fix/xgo-image-go-version branch August 31, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants