diff --git a/.github/workflows/munge.sh b/.github/workflows/munge.sh index ba4df569..c03a9a7a 100755 --- a/.github/workflows/munge.sh +++ b/.github/workflows/munge.sh @@ -10,6 +10,7 @@ jq ' .matrix.include[] | select(.name | test(" (.+)") | not) # ignore any existing munged builds | select(.os | startswith("windows-") | not) # ignore Windows (always downloads) + | select(any(.meta.entries[].tags[]; contains("golang:1.20"))) # https://github.com/docker-library/golang/pull/500#issuecomment-1863578601 | .name += " (force build)" | .runs.build = ([ "# update versions.json to force us to build Go instead of downloading it", diff --git a/1.20/alpine3.18/Dockerfile b/1.20/alpine3.18/Dockerfile index 07d9ef53..99d892d2 100644 --- a/1.20/alpine3.18/Dockerfile +++ b/1.20/alpine3.18/Dockerfile @@ -49,7 +49,7 @@ RUN set -eux; \ build=1; \ url='https://dl.google.com/go/go1.20.12.src.tar.gz'; \ sha256='c5bf934751d31c315c1d0bb5fb02296545fa6d08923566f7a5afec81f2ed27d6'; \ -# the precompiled binaries published by Go upstream are not compatible with Alpine, so we always build from source here 😅 +# the precompiled binaries published by Go upstream were not compatible with Alpine in Go 1.20, so we always build from source here 😅 fi; \ \ wget -O go.tgz.asc "$url.asc"; \ diff --git a/1.20/alpine3.19/Dockerfile b/1.20/alpine3.19/Dockerfile index 91e76af4..ddd80a50 100644 --- a/1.20/alpine3.19/Dockerfile +++ b/1.20/alpine3.19/Dockerfile @@ -49,7 +49,7 @@ RUN set -eux; \ build=1; \ url='https://dl.google.com/go/go1.20.12.src.tar.gz'; \ sha256='c5bf934751d31c315c1d0bb5fb02296545fa6d08923566f7a5afec81f2ed27d6'; \ -# the precompiled binaries published by Go upstream are not compatible with Alpine, so we always build from source here 😅 +# the precompiled binaries published by Go upstream were not compatible with Alpine in Go 1.20, so we always build from source here 😅 fi; \ \ wget -O go.tgz.asc "$url.asc"; \ diff --git a/1.21/alpine3.18/Dockerfile b/1.21/alpine3.18/Dockerfile index 3f3d9f4f..675a35a7 100644 --- a/1.21/alpine3.18/Dockerfile +++ b/1.21/alpine3.18/Dockerfile @@ -51,16 +51,6 @@ RUN set -eux; \ ;; \ *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \ esac; \ - build=; \ - if [ -z "$url" ]; then \ -# https://github.com/golang/go/issues/38536#issuecomment-616897960 - build=1; \ - url='https://dl.google.com/go/go1.21.5.src.tar.gz'; \ - sha256='285cbbdf4b6e6e62ed58f370f3f6d8c30825d6e56c5853c66d3c23bcdb09db19'; \ - echo >&2; \ - echo >&2 "warning: current architecture ($arch) does not have a compatible Go binary release; will be building from source"; \ - echo >&2; \ - fi; \ \ wget -O go.tgz.asc "$url.asc"; \ wget -O go.tgz "$url"; \ @@ -79,50 +69,6 @@ RUN set -eux; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ \ - if [ -n "$build" ]; then \ - apk add --no-cache --virtual .build-deps \ - bash \ - gcc \ - go \ - musl-dev \ - ; \ - \ - export GOCACHE='/tmp/gocache'; \ - \ - ( \ - cd /usr/local/go/src; \ -# set GOROOT_BOOTSTRAP + GOHOST* such that we can build Go successfully - export GOROOT_BOOTSTRAP="$(go env GOROOT)" GOHOSTOS="$GOOS" GOHOSTARCH="$GOARCH"; \ - if [ "${GOARCH:-}" = '386' ]; then \ -# https://github.com/golang/go/issues/52919; https://github.com/docker-library/golang/pull/426#issuecomment-1152623837 - export CGO_CFLAGS='-fno-stack-protector'; \ - fi; \ - ./make.bash; \ - ); \ - \ - apk del --no-network .build-deps; \ - \ -# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain - rm -rf \ - /usr/local/go/pkg/*/cmd \ - /usr/local/go/pkg/bootstrap \ - /usr/local/go/pkg/obj \ - /usr/local/go/pkg/tool/*/api \ - /usr/local/go/pkg/tool/*/go_bootstrap \ - /usr/local/go/src/cmd/dist/dist \ - "$GOCACHE" \ - ; \ - elif [ "$arch" = 'armv7' ]; then \ - [ -s /usr/local/go/go.env ]; \ - before="$(go env GOARM)"; [ "$before" != '7' ]; \ - { \ - echo; \ - echo '# https://github.com/docker-library/golang/issues/494'; \ - echo 'GOARM=7'; \ - } >> /usr/local/go/go.env; \ - after="$(go env GOARM)"; [ "$after" = '7' ]; \ - fi; \ - \ apk del --no-network .fetch-deps; \ \ go version diff --git a/1.21/alpine3.19/Dockerfile b/1.21/alpine3.19/Dockerfile index 44b083f7..0670a867 100644 --- a/1.21/alpine3.19/Dockerfile +++ b/1.21/alpine3.19/Dockerfile @@ -51,16 +51,6 @@ RUN set -eux; \ ;; \ *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \ esac; \ - build=; \ - if [ -z "$url" ]; then \ -# https://github.com/golang/go/issues/38536#issuecomment-616897960 - build=1; \ - url='https://dl.google.com/go/go1.21.5.src.tar.gz'; \ - sha256='285cbbdf4b6e6e62ed58f370f3f6d8c30825d6e56c5853c66d3c23bcdb09db19'; \ - echo >&2; \ - echo >&2 "warning: current architecture ($arch) does not have a compatible Go binary release; will be building from source"; \ - echo >&2; \ - fi; \ \ wget -O go.tgz.asc "$url.asc"; \ wget -O go.tgz "$url"; \ @@ -79,50 +69,6 @@ RUN set -eux; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ \ - if [ -n "$build" ]; then \ - apk add --no-cache --virtual .build-deps \ - bash \ - gcc \ - go \ - musl-dev \ - ; \ - \ - export GOCACHE='/tmp/gocache'; \ - \ - ( \ - cd /usr/local/go/src; \ -# set GOROOT_BOOTSTRAP + GOHOST* such that we can build Go successfully - export GOROOT_BOOTSTRAP="$(go env GOROOT)" GOHOSTOS="$GOOS" GOHOSTARCH="$GOARCH"; \ - if [ "${GOARCH:-}" = '386' ]; then \ -# https://github.com/golang/go/issues/52919; https://github.com/docker-library/golang/pull/426#issuecomment-1152623837 - export CGO_CFLAGS='-fno-stack-protector'; \ - fi; \ - ./make.bash; \ - ); \ - \ - apk del --no-network .build-deps; \ - \ -# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain - rm -rf \ - /usr/local/go/pkg/*/cmd \ - /usr/local/go/pkg/bootstrap \ - /usr/local/go/pkg/obj \ - /usr/local/go/pkg/tool/*/api \ - /usr/local/go/pkg/tool/*/go_bootstrap \ - /usr/local/go/src/cmd/dist/dist \ - "$GOCACHE" \ - ; \ - elif [ "$arch" = 'armv7' ]; then \ - [ -s /usr/local/go/go.env ]; \ - before="$(go env GOARM)"; [ "$before" != '7' ]; \ - { \ - echo; \ - echo '# https://github.com/docker-library/golang/issues/494'; \ - echo 'GOARM=7'; \ - } >> /usr/local/go/go.env; \ - after="$(go env GOARM)"; [ "$after" = '7' ]; \ - fi; \ - \ apk del --no-network .fetch-deps; \ \ go version diff --git a/1.21/bookworm/Dockerfile b/1.21/bookworm/Dockerfile index def7f931..a08b58c8 100644 --- a/1.21/bookworm/Dockerfile +++ b/1.21/bookworm/Dockerfile @@ -30,9 +30,6 @@ RUN set -eux; \ url='https://dl.google.com/go/go1.21.5.linux-amd64.tar.gz'; \ sha256='e2bc0b3e4b64111ec117295c088bde5f00eeed1567999ff77bc859d7df70078e'; \ ;; \ - 'armel') \ - export GOARCH='arm' GOARM='5' GOOS='linux'; \ - ;; \ 'armhf') \ url='https://dl.google.com/go/go1.21.5.linux-armv6l.tar.gz'; \ sha256='837f4bf4e22fcdf920ffeaa4abf3d02d1314e03725431065f4d44c46a01b42fe'; \ @@ -63,16 +60,6 @@ RUN set -eux; \ ;; \ *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \ esac; \ - build=; \ - if [ -z "$url" ]; then \ -# https://github.com/golang/go/issues/38536#issuecomment-616897960 - build=1; \ - url='https://dl.google.com/go/go1.21.5.src.tar.gz'; \ - sha256='285cbbdf4b6e6e62ed58f370f3f6d8c30825d6e56c5853c66d3c23bcdb09db19'; \ - echo >&2; \ - echo >&2 "warning: current architecture ($arch) does not have a compatible Go binary release; will be building from source"; \ - echo >&2; \ - fi; \ \ wget -O go.tgz.asc "$url.asc"; \ wget -O go.tgz "$url" --progress=dot:giga; \ @@ -91,46 +78,6 @@ RUN set -eux; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ \ - if [ -n "$build" ]; then \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends golang-go; \ - \ - export GOCACHE='/tmp/gocache'; \ - \ - ( \ - cd /usr/local/go/src; \ -# set GOROOT_BOOTSTRAP + GOHOST* such that we can build Go successfully - export GOROOT_BOOTSTRAP="$(go env GOROOT)" GOHOSTOS="$GOOS" GOHOSTARCH="$GOARCH"; \ - ./make.bash; \ - ); \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain - rm -rf \ - /usr/local/go/pkg/*/cmd \ - /usr/local/go/pkg/bootstrap \ - /usr/local/go/pkg/obj \ - /usr/local/go/pkg/tool/*/api \ - /usr/local/go/pkg/tool/*/go_bootstrap \ - /usr/local/go/src/cmd/dist/dist \ - "$GOCACHE" \ - ; \ - elif [ "$arch" = 'armhf' ]; then \ - [ -s /usr/local/go/go.env ]; \ - before="$(go env GOARM)"; [ "$before" != '7' ]; \ - { \ - echo; \ - echo '# https://github.com/docker-library/golang/issues/494'; \ - echo 'GOARM=7'; \ - } >> /usr/local/go/go.env; \ - after="$(go env GOARM)"; [ "$after" = '7' ]; \ - fi; \ - \ go version # don't auto-upgrade the gotoolchain diff --git a/1.21/bullseye/Dockerfile b/1.21/bullseye/Dockerfile index 0b1349c6..2b9fe697 100644 --- a/1.21/bullseye/Dockerfile +++ b/1.21/bullseye/Dockerfile @@ -30,9 +30,6 @@ RUN set -eux; \ url='https://dl.google.com/go/go1.21.5.linux-amd64.tar.gz'; \ sha256='e2bc0b3e4b64111ec117295c088bde5f00eeed1567999ff77bc859d7df70078e'; \ ;; \ - 'armel') \ - export GOARCH='arm' GOARM='5' GOOS='linux'; \ - ;; \ 'armhf') \ url='https://dl.google.com/go/go1.21.5.linux-armv6l.tar.gz'; \ sha256='837f4bf4e22fcdf920ffeaa4abf3d02d1314e03725431065f4d44c46a01b42fe'; \ @@ -63,16 +60,6 @@ RUN set -eux; \ ;; \ *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \ esac; \ - build=; \ - if [ -z "$url" ]; then \ -# https://github.com/golang/go/issues/38536#issuecomment-616897960 - build=1; \ - url='https://dl.google.com/go/go1.21.5.src.tar.gz'; \ - sha256='285cbbdf4b6e6e62ed58f370f3f6d8c30825d6e56c5853c66d3c23bcdb09db19'; \ - echo >&2; \ - echo >&2 "warning: current architecture ($arch) does not have a compatible Go binary release; will be building from source"; \ - echo >&2; \ - fi; \ \ wget -O go.tgz.asc "$url.asc"; \ wget -O go.tgz "$url" --progress=dot:giga; \ @@ -91,52 +78,6 @@ RUN set -eux; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ \ - if [ -n "$build" ]; then \ - savedAptMark="$(apt-mark showmanual)"; \ -# add backports for newer go version for bootstrap build: https://github.com/golang/go/issues/44505 - ( \ - . /etc/os-release; \ - echo "deb https://deb.debian.org/debian $VERSION_CODENAME-backports main" > /etc/apt/sources.list.d/backports.list; \ - \ - apt-get update; \ - apt-get install -y --no-install-recommends -t "$VERSION_CODENAME-backports" golang-go; \ - ); \ - \ - export GOCACHE='/tmp/gocache'; \ - \ - ( \ - cd /usr/local/go/src; \ -# set GOROOT_BOOTSTRAP + GOHOST* such that we can build Go successfully - export GOROOT_BOOTSTRAP="$(go env GOROOT)" GOHOSTOS="$GOOS" GOHOSTARCH="$GOARCH"; \ - ./make.bash; \ - ); \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain - rm -rf \ - /usr/local/go/pkg/*/cmd \ - /usr/local/go/pkg/bootstrap \ - /usr/local/go/pkg/obj \ - /usr/local/go/pkg/tool/*/api \ - /usr/local/go/pkg/tool/*/go_bootstrap \ - /usr/local/go/src/cmd/dist/dist \ - "$GOCACHE" \ - ; \ - elif [ "$arch" = 'armhf' ]; then \ - [ -s /usr/local/go/go.env ]; \ - before="$(go env GOARM)"; [ "$before" != '7' ]; \ - { \ - echo; \ - echo '# https://github.com/docker-library/golang/issues/494'; \ - echo 'GOARM=7'; \ - } >> /usr/local/go/go.env; \ - after="$(go env GOARM)"; [ "$after" = '7' ]; \ - fi; \ - \ go version # don't auto-upgrade the gotoolchain diff --git a/1.22-rc/alpine3.18/Dockerfile b/1.22-rc/alpine3.18/Dockerfile index 8ec949e8..81c54072 100644 --- a/1.22-rc/alpine3.18/Dockerfile +++ b/1.22-rc/alpine3.18/Dockerfile @@ -51,16 +51,6 @@ RUN set -eux; \ ;; \ *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \ esac; \ - build=; \ - if [ -z "$url" ]; then \ -# https://github.com/golang/go/issues/38536#issuecomment-616897960 - build=1; \ - url='https://dl.google.com/go/go1.22rc1.src.tar.gz'; \ - sha256='9aecbb8ebae41b93ea26ef5b014296fbbe70a07630249c0d8a275df3bd4d26ea'; \ - echo >&2; \ - echo >&2 "warning: current architecture ($arch) does not have a compatible Go binary release; will be building from source"; \ - echo >&2; \ - fi; \ \ wget -O go.tgz.asc "$url.asc"; \ wget -O go.tgz "$url"; \ @@ -79,50 +69,6 @@ RUN set -eux; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ \ - if [ -n "$build" ]; then \ - apk add --no-cache --virtual .build-deps \ - bash \ - gcc \ - go \ - musl-dev \ - ; \ - \ - export GOCACHE='/tmp/gocache'; \ - \ - ( \ - cd /usr/local/go/src; \ -# set GOROOT_BOOTSTRAP + GOHOST* such that we can build Go successfully - export GOROOT_BOOTSTRAP="$(go env GOROOT)" GOHOSTOS="$GOOS" GOHOSTARCH="$GOARCH"; \ - if [ "${GOARCH:-}" = '386' ]; then \ -# https://github.com/golang/go/issues/52919; https://github.com/docker-library/golang/pull/426#issuecomment-1152623837 - export CGO_CFLAGS='-fno-stack-protector'; \ - fi; \ - ./make.bash; \ - ); \ - \ - apk del --no-network .build-deps; \ - \ -# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain - rm -rf \ - /usr/local/go/pkg/*/cmd \ - /usr/local/go/pkg/bootstrap \ - /usr/local/go/pkg/obj \ - /usr/local/go/pkg/tool/*/api \ - /usr/local/go/pkg/tool/*/go_bootstrap \ - /usr/local/go/src/cmd/dist/dist \ - "$GOCACHE" \ - ; \ - elif [ "$arch" = 'armv7' ]; then \ - [ -s /usr/local/go/go.env ]; \ - before="$(go env GOARM)"; [ "$before" != '7' ]; \ - { \ - echo; \ - echo '# https://github.com/docker-library/golang/issues/494'; \ - echo 'GOARM=7'; \ - } >> /usr/local/go/go.env; \ - after="$(go env GOARM)"; [ "$after" = '7' ]; \ - fi; \ - \ apk del --no-network .fetch-deps; \ \ go version diff --git a/1.22-rc/alpine3.19/Dockerfile b/1.22-rc/alpine3.19/Dockerfile index ab81b871..f9049f85 100644 --- a/1.22-rc/alpine3.19/Dockerfile +++ b/1.22-rc/alpine3.19/Dockerfile @@ -51,16 +51,6 @@ RUN set -eux; \ ;; \ *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \ esac; \ - build=; \ - if [ -z "$url" ]; then \ -# https://github.com/golang/go/issues/38536#issuecomment-616897960 - build=1; \ - url='https://dl.google.com/go/go1.22rc1.src.tar.gz'; \ - sha256='9aecbb8ebae41b93ea26ef5b014296fbbe70a07630249c0d8a275df3bd4d26ea'; \ - echo >&2; \ - echo >&2 "warning: current architecture ($arch) does not have a compatible Go binary release; will be building from source"; \ - echo >&2; \ - fi; \ \ wget -O go.tgz.asc "$url.asc"; \ wget -O go.tgz "$url"; \ @@ -79,50 +69,6 @@ RUN set -eux; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ \ - if [ -n "$build" ]; then \ - apk add --no-cache --virtual .build-deps \ - bash \ - gcc \ - go \ - musl-dev \ - ; \ - \ - export GOCACHE='/tmp/gocache'; \ - \ - ( \ - cd /usr/local/go/src; \ -# set GOROOT_BOOTSTRAP + GOHOST* such that we can build Go successfully - export GOROOT_BOOTSTRAP="$(go env GOROOT)" GOHOSTOS="$GOOS" GOHOSTARCH="$GOARCH"; \ - if [ "${GOARCH:-}" = '386' ]; then \ -# https://github.com/golang/go/issues/52919; https://github.com/docker-library/golang/pull/426#issuecomment-1152623837 - export CGO_CFLAGS='-fno-stack-protector'; \ - fi; \ - ./make.bash; \ - ); \ - \ - apk del --no-network .build-deps; \ - \ -# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain - rm -rf \ - /usr/local/go/pkg/*/cmd \ - /usr/local/go/pkg/bootstrap \ - /usr/local/go/pkg/obj \ - /usr/local/go/pkg/tool/*/api \ - /usr/local/go/pkg/tool/*/go_bootstrap \ - /usr/local/go/src/cmd/dist/dist \ - "$GOCACHE" \ - ; \ - elif [ "$arch" = 'armv7' ]; then \ - [ -s /usr/local/go/go.env ]; \ - before="$(go env GOARM)"; [ "$before" != '7' ]; \ - { \ - echo; \ - echo '# https://github.com/docker-library/golang/issues/494'; \ - echo 'GOARM=7'; \ - } >> /usr/local/go/go.env; \ - after="$(go env GOARM)"; [ "$after" = '7' ]; \ - fi; \ - \ apk del --no-network .fetch-deps; \ \ go version diff --git a/1.22-rc/bookworm/Dockerfile b/1.22-rc/bookworm/Dockerfile index 145b471c..e10376a4 100644 --- a/1.22-rc/bookworm/Dockerfile +++ b/1.22-rc/bookworm/Dockerfile @@ -30,9 +30,6 @@ RUN set -eux; \ url='https://dl.google.com/go/go1.22rc1.linux-amd64.tar.gz'; \ sha256='fbe9d0585b9322d44008f6baf78b391b22f64294338c6ce2b9eb6040d6373c52'; \ ;; \ - 'armel') \ - export GOARCH='arm' GOARM='5' GOOS='linux'; \ - ;; \ 'armhf') \ url='https://dl.google.com/go/go1.22rc1.linux-armv6l.tar.gz'; \ sha256='78e86eb1f449d88692829f1d794cd9f696b66c4f5e25f4ceb4ddd3ad7bee3683'; \ @@ -63,16 +60,6 @@ RUN set -eux; \ ;; \ *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \ esac; \ - build=; \ - if [ -z "$url" ]; then \ -# https://github.com/golang/go/issues/38536#issuecomment-616897960 - build=1; \ - url='https://dl.google.com/go/go1.22rc1.src.tar.gz'; \ - sha256='9aecbb8ebae41b93ea26ef5b014296fbbe70a07630249c0d8a275df3bd4d26ea'; \ - echo >&2; \ - echo >&2 "warning: current architecture ($arch) does not have a compatible Go binary release; will be building from source"; \ - echo >&2; \ - fi; \ \ wget -O go.tgz.asc "$url.asc"; \ wget -O go.tgz "$url" --progress=dot:giga; \ @@ -91,46 +78,6 @@ RUN set -eux; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ \ - if [ -n "$build" ]; then \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends golang-go; \ - \ - export GOCACHE='/tmp/gocache'; \ - \ - ( \ - cd /usr/local/go/src; \ -# set GOROOT_BOOTSTRAP + GOHOST* such that we can build Go successfully - export GOROOT_BOOTSTRAP="$(go env GOROOT)" GOHOSTOS="$GOOS" GOHOSTARCH="$GOARCH"; \ - ./make.bash; \ - ); \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain - rm -rf \ - /usr/local/go/pkg/*/cmd \ - /usr/local/go/pkg/bootstrap \ - /usr/local/go/pkg/obj \ - /usr/local/go/pkg/tool/*/api \ - /usr/local/go/pkg/tool/*/go_bootstrap \ - /usr/local/go/src/cmd/dist/dist \ - "$GOCACHE" \ - ; \ - elif [ "$arch" = 'armhf' ]; then \ - [ -s /usr/local/go/go.env ]; \ - before="$(go env GOARM)"; [ "$before" != '7' ]; \ - { \ - echo; \ - echo '# https://github.com/docker-library/golang/issues/494'; \ - echo 'GOARM=7'; \ - } >> /usr/local/go/go.env; \ - after="$(go env GOARM)"; [ "$after" = '7' ]; \ - fi; \ - \ go version # don't auto-upgrade the gotoolchain diff --git a/1.22-rc/bullseye/Dockerfile b/1.22-rc/bullseye/Dockerfile index 3fbd4678..f25a8acd 100644 --- a/1.22-rc/bullseye/Dockerfile +++ b/1.22-rc/bullseye/Dockerfile @@ -30,9 +30,6 @@ RUN set -eux; \ url='https://dl.google.com/go/go1.22rc1.linux-amd64.tar.gz'; \ sha256='fbe9d0585b9322d44008f6baf78b391b22f64294338c6ce2b9eb6040d6373c52'; \ ;; \ - 'armel') \ - export GOARCH='arm' GOARM='5' GOOS='linux'; \ - ;; \ 'armhf') \ url='https://dl.google.com/go/go1.22rc1.linux-armv6l.tar.gz'; \ sha256='78e86eb1f449d88692829f1d794cd9f696b66c4f5e25f4ceb4ddd3ad7bee3683'; \ @@ -63,16 +60,6 @@ RUN set -eux; \ ;; \ *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \ esac; \ - build=; \ - if [ -z "$url" ]; then \ -# https://github.com/golang/go/issues/38536#issuecomment-616897960 - build=1; \ - url='https://dl.google.com/go/go1.22rc1.src.tar.gz'; \ - sha256='9aecbb8ebae41b93ea26ef5b014296fbbe70a07630249c0d8a275df3bd4d26ea'; \ - echo >&2; \ - echo >&2 "warning: current architecture ($arch) does not have a compatible Go binary release; will be building from source"; \ - echo >&2; \ - fi; \ \ wget -O go.tgz.asc "$url.asc"; \ wget -O go.tgz "$url" --progress=dot:giga; \ @@ -91,52 +78,6 @@ RUN set -eux; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ \ - if [ -n "$build" ]; then \ - savedAptMark="$(apt-mark showmanual)"; \ -# add backports for newer go version for bootstrap build: https://github.com/golang/go/issues/44505 - ( \ - . /etc/os-release; \ - echo "deb https://deb.debian.org/debian $VERSION_CODENAME-backports main" > /etc/apt/sources.list.d/backports.list; \ - \ - apt-get update; \ - apt-get install -y --no-install-recommends -t "$VERSION_CODENAME-backports" golang-go; \ - ); \ - \ - export GOCACHE='/tmp/gocache'; \ - \ - ( \ - cd /usr/local/go/src; \ -# set GOROOT_BOOTSTRAP + GOHOST* such that we can build Go successfully - export GOROOT_BOOTSTRAP="$(go env GOROOT)" GOHOSTOS="$GOOS" GOHOSTARCH="$GOARCH"; \ - ./make.bash; \ - ); \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark > /dev/null; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ -# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain - rm -rf \ - /usr/local/go/pkg/*/cmd \ - /usr/local/go/pkg/bootstrap \ - /usr/local/go/pkg/obj \ - /usr/local/go/pkg/tool/*/api \ - /usr/local/go/pkg/tool/*/go_bootstrap \ - /usr/local/go/src/cmd/dist/dist \ - "$GOCACHE" \ - ; \ - elif [ "$arch" = 'armhf' ]; then \ - [ -s /usr/local/go/go.env ]; \ - before="$(go env GOARM)"; [ "$before" != '7' ]; \ - { \ - echo; \ - echo '# https://github.com/docker-library/golang/issues/494'; \ - echo 'GOARM=7'; \ - } >> /usr/local/go/go.env; \ - after="$(go env GOARM)"; [ "$after" = '7' ]; \ - fi; \ - \ go version # don't auto-upgrade the gotoolchain diff --git a/Dockerfile-linux.template b/Dockerfile-linux.template index 19246b31..80be7f91 100644 --- a/Dockerfile-linux.template +++ b/Dockerfile-linux.template @@ -5,9 +5,13 @@ def alpine_version: env.variant | ltrimstr("alpine") ; + def sometimes_build_from_source: + # https://github.com/docker-library/golang/pull/500#issuecomment-1863578601 + [ "1.20" ] | index(env.version | rtrimstr("-rc")) + ; def always_build_from_source: # https://github.com/golang/go/issues/57007! (as of Go 1.21, the upstream release binaries are fully static and thus appropriate for Alpine) - is_alpine and ([ "1.20" ] | index(env.version | rtrimstr("-rc"))) + is_alpine and sometimes_build_from_source -}} {{ if is_alpine then ( -}} FROM alpine:{{ alpine_version }} @@ -52,6 +56,7 @@ ENV GOLANG_VERSION {{ .version }} { # https://salsa.debian.org/dpkg-team/dpkg/-/blob/main/data/cputable # https://wiki.debian.org/ArchitectureSpecificsMemo#Architecture_baselines + # https://deb.debian.org/debian/dists/unstable/Release ("Architectures:") # http://deb.debian.org/debian/dists/unstable/main/ # http://deb.debian.org/debian/dists/stable/main/ # https://deb.debian.org/debian-ports/dists/unstable/main/ @@ -89,7 +94,8 @@ RUN set -eux; \ | ( -}} {{ $osArch | @sh }}) \ -{{ if always_build_from_source or (.url | not) then ( -}} +{{ # TODO remove this "build-from-source" logic when 1.20 is EOL / 1.22 is GA -}} +{{ if (.url | not) or always_build_from_source then ( -}} export {{ .env | to_entries | map(.key + "=" + (.value | @sh)) | join(" ") }}; \ {{ ) else ( -}} url={{ .url | @sh }}; \ @@ -102,6 +108,7 @@ RUN set -eux; \ -}} *) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \ esac; \ +{{ if sometimes_build_from_source then ( -}} build=; \ if [ -z "$url" ]; then \ # https://github.com/golang/go/issues/38536#issuecomment-616897960 @@ -109,13 +116,14 @@ RUN set -eux; \ url={{ .arches.src.url | @sh }}; \ sha256={{ .arches.src.sha256 | @sh }}; \ {{ if always_build_from_source then ( -}} -# the precompiled binaries published by Go upstream are not compatible with Alpine, so we always build from source here 😅 +# the precompiled binaries published by Go upstream were not compatible with Alpine in Go 1.20, so we always build from source here 😅 {{ ) else ( -}} echo >&2; \ echo >&2 "warning: current architecture ($arch) does not have a compatible Go binary release; will be building from source"; \ echo >&2; \ {{ ) end -}} fi; \ +{{ ) else "" end -}} \ wget -O go.tgz.asc "$url.asc"; \ wget -O go.tgz "$url"{{ if is_alpine then "" else " --progress=dot:giga" end }}; \ @@ -134,6 +142,7 @@ RUN set -eux; \ tar -C /usr/local -xzf go.tgz; \ rm go.tgz; \ \ +{{ if sometimes_build_from_source then ( -}} if [ -n "$build" ]; then \ {{ if is_alpine then ( -}} apk add --no-cache --virtual .build-deps \ @@ -206,6 +215,7 @@ RUN set -eux; \ {{ ) else "" end -}} fi; \ \ +{{ ) else "" end -}} {{ if is_alpine then ( -}} apk del --no-network .fetch-deps; \ \ diff --git a/versions.json b/versions.json index 060fea02..488287f7 100644 --- a/versions.json +++ b/versions.json @@ -198,7 +198,7 @@ "GOARM": "5", "GOOS": "linux" }, - "supported": true + "supported": false }, "arm32v6": { "env": { @@ -590,7 +590,7 @@ "GOARM": "5", "GOOS": "linux" }, - "supported": true + "supported": false }, "arm32v6": { "env": { diff --git a/versions.sh b/versions.sh index 9e59762c..0d0cc86e 100755 --- a/versions.sh +++ b/versions.sh @@ -44,40 +44,43 @@ goVersions="$( | { version: $version, major: ( $major + if .stable then "" else "-rc" end ), - arches: ([ - .files[] - | select(.kind == "archive" or .kind == "source") - | ( - if .kind == "source" then - "src" - else - if .os != "linux" then - .os + "-" - else "" end - + ( - .arch - | sub("^386$"; "i386") - | sub("^arm64$"; "arm64v8") - | sub("^arm-?v?(?[0-9]+)l?$"; "arm32v\(.v)") - ) - end - ) as $bashbrewArch - | { - ( $bashbrewArch ): ( - { - sha256: .sha256, - url: ("https://dl.google.com/go/" + .filename), - env: { GOOS: .os, GOARCH: .arch }, - } - ), - } - ] | add) - } + arches: ( + [ + .files[] + | select(.kind == "archive" or .kind == "source") + | ( + if .kind == "source" then + "src" + else + if .os != "linux" then + .os + "-" + else "" end + + ( + .arch + | sub("^386$"; "i386") + | sub("^arm64$"; "arm64v8") + | sub("^arm-?v?(?[0-9]+)l?$"; "arm32v\(.v)") + ) + end + ) as $bashbrewArch + | { + ( $bashbrewArch ): ( + { + sha256: .sha256, + url: ("https://dl.google.com/go/" + .filename), + env: { GOOS: .os, GOARCH: .arch }, + } + ), + } + ] + | add - # the published binaries only support glibc, which translates to Debian, so the "correct" binary for v7 is v6 (TODO find some way to reasonably benchmark the compiler on a proper v7 chip and determine whether recompiling for GOARM=7 is worthwhile) - | if (.arches | has("arm32v7") | not) and (.arches | has("arm32v6")) then - .arches["arm32v7"] = (.arches["arm32v6"] | .env.GOARM = "7") - else . end + # upstream (still as of 2023-12-19) only publishes "armv6" binaries, which are appropriate for v7 as well + | if (has("arm32v7") | not) and has("arm32v6") then + .["arm32v7"] = .["arm32v6"] + else . end + ) + } ] ' )" @@ -127,7 +130,11 @@ for version in "${versions[@]}"; do ) | with_entries( .key as $bashbrewArch - | .value.supported = ($potentiallySupportedArches | index($bashbrewArch) != null) + | .value.supported = ( + # https://github.com/docker-library/golang/pull/500#issuecomment-1863578601 - as of Go 1.21+, we no longer build from source + (.value.url or ([ "1.20" ] | index(env.version | rtrimstr("-rc")))) + and ($potentiallySupportedArches | index($bashbrewArch)) + ) | .value.env += if $bashbrewArch == "i386" then # i386 in Debian is non-SSE2, Alpine appears to be similar (but interesting, not FreeBSD?) @@ -149,16 +156,19 @@ for version in "${versions[@]}"; do "bullseye", ( "3.19", - "3.18" + "3.18", + empty | "alpine" + .), if .arches | has("windows-amd64") and .["windows-amd64"].url then ( "ltsc2022", - "1809" + "1809", + empty | "windows/windowsservercore-" + .), ( "ltsc2022", - "1809" + "1809", + empty | "windows/nanoserver-" + .) else empty end ],