Skip to content

Set GOARM from TARGETVARIANT in the Go cross-compilation examples - #26675

Open
kamrullab wants to merge 2 commits into
docker:mainfrom
kamrullab:fix/26674-goarm-examples
Open

kamrullab wants to merge 2 commits into
docker:mainfrom
kamrullab:fix/26674-goarm-examples

Conversation

@kamrullab

Copy link
Copy Markdown

Description

The Go cross-compilation examples set GOOS and GOARCH from TARGETOS and TARGETARCH, but never set GOARM. When Go cross-compiles for arm without GOARM, it defaults to GOARM=7, so anyone following the example for linux/arm/v6 publishes an ARMv7 binary under the arm/v6 label, which crashes on ARMv6 boards such as the Raspberry Pi Zero W.

This adds the pre-defined TARGETVARIANT build argument to both examples and passes it to Go as GOARM=${TARGETVARIANT#v}:

  • content/manuals/build/building/multi-platform.md: step 3 text, the updated Dockerfile, and the diff tab.
  • content/manuals/build/bake/targets.md: the artifact export Dockerfile and its closing note.

GOARM is only read when GOARCH=arm, so other platforms are unaffected.

Related issues or tickets

Fixes #26674

Reviews

  • Technical review
  • Editorial review
  • Product review

… example

Signed-off-by: Kamrul Hossain <engr.kamrul45@gmail.com>
Signed-off-by: Kamrul Hossain <engr.kamrul45@gmail.com>
@kamrullab
kamrullab requested a review from dvdksn as a code owner November 19, 2026 04:20
@netlify

netlify Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for docsdocker ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 45554d5
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/6afe79054c41eac54d807f25
😎 Deploy Preview https://deploy-preview-26675--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the area/build Relates to Dockerfiles or docker build command label Nov 19, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Relates to Dockerfiles or docker build command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Go cross-compilation example builds ARMv7 binaries for linux/arm/v6

1 participant