Skip to content

Commit

Permalink
Set GOARM=7 explicitly for arm32v7 images
Browse files Browse the repository at this point in the history
This fixes the disparity between the "armv6" download of Go from upstream and the image being v7 otherwise (and thus the default value of `GOARM` being `6` instead of `7`, which is unexpected for users of the image).

This is set in such a way that environment variables (or `go env -w`) will override it, but without requiring us to recompile Go (which I'm not convinced gives us much gain -- happy to reconsider if someone comes up with a good way to benchmark the compiler).
  • Loading branch information
tianon committed Dec 8, 2023
1 parent 9f8bfe7 commit d6d331e
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
9 changes: 9 additions & 0 deletions 1.21/alpine3.18/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions 1.21/alpine3.19/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions 1.21/bookworm/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions 1.21/bullseye/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Dockerfile-linux.template
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,17 @@ RUN set -eux; \
/usr/local/go/src/cmd/dist/dist \
"$GOCACHE" \
; \
{{ if [ "1.20" ] | index(env.version) then "" elif .arches["arm32v7"].url | contains("armv6") then ( -}}
elif [ "$arch" = {{ os_arches["arm32v7"] | @sh }} ]; then \
[ -s /usr/local/go/go.env ]; \
before="$(go env GOARM)"; [ "$before" != {{ .arches["arm32v7"].env["GOARM"] | @sh }} ]; \
{ \
echo; \
echo '# https://github.com/docker-library/golang/issues/494'; \
echo {{ "GOARM=\(.arches["arm32v7"].env["GOARM"])" | @sh }}; \
} >> /usr/local/go/go.env; \
after="$(go env GOARM)"; [ "$after" = {{ .arches["arm32v7"].env["GOARM"] | @sh }} ]; \
{{ ) else "" end -}}
fi; \
\
{{ if is_alpine then ( -}}
Expand Down

0 comments on commit d6d331e

Please sign in to comment.