Skip to content

Commit

Permalink
Update to Go 1.23.0 (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v authored Aug 29, 2024
1 parent e40765c commit a20e3ab
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 26 deletions.
6 changes: 0 additions & 6 deletions .github/updatecli.d/bump-go-release-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,3 @@ find "go" -type f -name Dockerfile.tmpl -print0 |
${SED} -E -e "s#(ARG GOLANG_DOWNLOAD_SHA256)=.+#\1=${GOLANG_DOWNLOAD_SHA256_AMD}#g" "$line"
fi
done

if [ -e go/base/install-go.sh ] ; then
${SED} -E -e "s#(GOLANG_VERSION)=[0-9]+\.[0-9]+(\.[0-9]+)?#\1=${GO_RELEASE_VERSION}#g" go/base/install-go.sh
${SED} -E -e "s#(GOLANG_DOWNLOAD_SHA256_AMD)=.+#\1=${GOLANG_DOWNLOAD_SHA256_AMD}#g" go/base/install-go.sh
${SED} -E -e "s#(GOLANG_DOWNLOAD_SHA256_ARM)=.+#\1=${GOLANG_DOWNLOAD_SHA256_ARM}#g" go/base/install-go.sh
fi
2 changes: 1 addition & 1 deletion .github/workflows/bump-golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
branch: 'main'
# NOTE: when a new golang version please update me with 1.<go-version>
go-minor: '1.22'
go-minor: '1.23'
command: '--experimental apply'
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.22.6
1.23.0
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ In the folder you can find the `sources.list` file that contains the list of rep
this file is different for each Debian version. In some cases, this file must point to `http://archive.debian.org/debian` instead of `http://deb.debian.org/debian` to be able to install the packages, this happens when the Debian version reach the end of life.

The base image is the one that install the `go` compiler, and the build tools for the rest of Docker images.
There is a scrip `install-go.sh` that download, check the SHA256, and install the `go` compiler, during the build of the Docker image.
When a new version of go i released, the `install-go.sh` script must be updated to install the new version.
When a new version of go is released, the aDockerimage.tmpla files must be updated to install the new version.

## go/base-arm Docker image

Expand Down
2 changes: 1 addition & 1 deletion go/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(SELF_DIR)/../Makefile.common

NAME := golang-crossbuild
VERSION := 1.22.6
VERSION := 1.23.0
DEBIAN_VERSION ?= 9
SUFFIX := -$(shell basename $(CURDIR))
TAG_EXTENSION ?=
Expand Down
13 changes: 9 additions & 4 deletions go/base-arm/Dockerfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,18 @@ RUN \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*

ARG GOLANG_VERSION=1.22.6
ARG GOLANG_VERSION=1.23.0
ARG GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$GOLANG_VERSION.linux-arm64.tar.gz
ARG GOLANG_DOWNLOAD_SHA256=c15fa895341b8eaf7f219fada25c36a610eb042985dc1a912410c1c90098eaf2
ARG GOLANG_DOWNLOAD_SHA256=62788056693009bcf7020eedc778cdd1781941c6145eab7688bd087bce0f8659

RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
&& rm -rf /usr/local/go \
&& tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
ENV PATH $PATH:/usr/local/go/bin

RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
Expand All @@ -58,8 +59,12 @@ COPY rootfs /
RUN ldd --version

WORKDIR /

RUN mkdir -p /root/.config/go/telemetry && echo "off 2024-08-23" > /root/.config/go/telemetry/mode
RUN go mod init github.com/elastic/golang-crossbuild-$GOLANG_VERSION-arm \
&& go get -d . \
&& go get . \
&& go env \
&& echo "toolcompile=$(go tool compile -V)" \
&& go build -o /crossbuild /entrypoint.go \
&& rm -rf /go/* /root/.cache/* /entrypoint.go

Expand Down
22 changes: 15 additions & 7 deletions go/base/Dockerfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ RUN apt-get -o Acquire::Check-Valid-Until=false update -y --no-install-recommend
RUN ln -s /usr/bin/pip3 /usr/bin/pip
{{- end }}

COPY install-go.sh /tmp/install-go.sh
RUN chmod ugo+rx /tmp/install-go.sh \
&& /tmp/install-go.sh \
&& rm /tmp/install-go.sh
ARG GOLANG_VERSION=1.23.0
ARG GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ARG GOLANG_DOWNLOAD_SHA256=905a297f19ead44780548933e0ff1a1b86e8327bb459e92f9c0012569f76f5e3

RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
&& rm -rf /usr/local/go \
&& tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
ENV PATH $PATH:/usr/local/go/bin

RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
Expand All @@ -48,9 +53,12 @@ COPY rootfs /
RUN ldd --version

WORKDIR /
RUN mkdir -p /root/.config/go/telemetry && echo "off 2024-08-23" > /root/.config/go/telemetry/mode
RUN go mod init github.com/elastic/golang-crossbuild-$GOLANG_VERSION \
&& go get -d . \
&& go build -o /crossbuild /entrypoint.go \
&& go get . \
&& go env \
&& echo "toolcompile=$(go tool compile -V)" \
&& CGO_ENABLED=0 go build -o /crossbuild /entrypoint.go \
&& rm -rf /go/* /root/.cache/* /entrypoint.go

RUN curl -sSLO https://storage.googleapis.com/obs-ci-cache/beats/libpcap-1.8.1.tar.gz \
Expand Down
8 changes: 4 additions & 4 deletions go/base/install-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# This script install the Go version correct for each architecture.
set -e

GOLANG_VERSION=1.22.6
GOLANG_VERSION=1.23.0
GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
GOLANG_DOWNLOAD_SHA256_AMD=999805bed7d9039ec3da1a53bfbcafc13e367da52aa823cb60b68ba22d44c616
GOLANG_DOWNLOAD_SHA256_ARM=c15fa895341b8eaf7f219fada25c36a610eb042985dc1a912410c1c90098eaf2
GOLANG_DOWNLOAD_SHA256_AMD=905a297f19ead44780548933e0ff1a1b86e8327bb459e92f9c0012569f76f5e3
GOLANG_DOWNLOAD_SHA256_ARM=62788056693009bcf7020eedc778cdd1781941c6145eab7688bd087bce0f8659

GO_TAR_FILE=/tmp/golang.tar.gz

Expand All @@ -21,5 +21,5 @@ if [ "$(uname -m)" != "x86_64" ]; then
echo "$GOLANG_DOWNLOAD_SHA256_ARM ${GO_TAR_FILE}" | sha256sum -c -
fi

tar -C /usr/local -xzf "${GO_TAR_FILE}"
rm -rf /usr/local/go && tar -C /usr/local -xzf "${GO_TAR_FILE}"
rm "${GO_TAR_FILE}"

0 comments on commit a20e3ab

Please sign in to comment.