Skip to content

Commit 1353b25

Browse files
fix: use a single source of truth for the go version (elastic#15583) (elastic#15606)
go version is defined in two places: go.mod and .go-version they often get out of sync and it's not clear which is used where. CI is using the version defined in go.mod which might be outdated compared to .go-version. bump go version in go.mod and ensure scripts are using it consistently remove old jenkins scripts (cherry picked from commit c24a1cb) Co-authored-by: kruskall <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 19a0a15 commit 1353b25

File tree

15 files changed

+12
-86
lines changed

15 files changed

+12
-86
lines changed

.buildkite/hooks/pre-command

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ GH_TOKEN="${VAULT_GITHUB_TOKEN}"
7676
export GH_TOKEN
7777

7878
echo "--- Setting up the :golang: environment..."
79-
GO_VERSION=$(cat .go-version)
79+
GO_VERSION=$(grep '^go' go.mod | cut -d' ' -f2)
8080
WORKSPACE=$(git rev-parse --show-toplevel)
8181
export GO_VERSION WORKSPACE
8282
get_os_details

.ci/scripts/bench.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ if [ "${CI}" == "true" ] ; then
170170
export BUILDKITE_TOKEN="${BUILDKITE_TOKEN_SECRET}"
171171

172172
echo "--- Setting up the :golang: environment..."
173-
GO_VERSION=$(cat .go-version)
173+
GO_VERSION=$(grep '^go' go.mod | cut -d' ' -f2)
174174
OS_NAME=linux
175175
OS_ARCH=amd64
176176
retry 5 curl -sL -o "${BASE_PROJECT}"/gvm "https://github.com/andrewkroh/gvm/releases/download/v0.5.2/gvm-${OS_NAME}-${OS_ARCH}"

.ci/scripts/unit-test.sh

-24
This file was deleted.

.github/workflows/ci.yml

-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ jobs:
3737
go.sum
3838
tools/go.sum
3939
- run: make check-full
40-
- name: Ensure .go-version is up to date
41-
run: make update-go-version
42-
if: ${{ github.ref == 'main' }}
4340

4441
test:
4542
strategy:

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ get-version:
148148
get-version-only:
149149
@echo $(APM_SERVER_ONLY_VERSION)
150150

151-
# update-go-version updates .go-version, documentation, and build files
151+
# update-go-version updates documentation, and build files
152152
# to use the most recent patch version for the major.minor Go version
153153
# defined in go.mod.
154154
.PHONY: update-go-version

cmd/intake-receiver/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/elastic/apm-server/cmd/intake-receiver
22

3-
go 1.23.0
3+
go 1.23.6
44

55
require (
66
github.com/stretchr/testify v1.6.1

functionaltests/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/elastic/apm-server/functionaltests
22

3-
go 1.23.2
3+
go 1.23.6
44

55
require (
66
github.com/elastic/apm-perf v0.0.0-20241230130730-2ad47482b731

go.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ GITCOMMITTIMESTAMPUNIX ?= $(shell git log -1 --pretty=%ct)
55
GITREFFILE ?= $(GITDIR)/$(shell git rev-parse --symbolic-full-name HEAD)
66
GITROOT ?= $(shell git rev-parse --show-toplevel)
77

8-
GOLANG_VERSION=$(shell cat $(GITROOT)/.go-version)
8+
GOLANG_VERSION=$(shell grep '^go' go.mod | cut -d' ' -f2)
99
GOARCH:=$(shell go env GOARCH)
1010

1111
APM_SERVER_ONLY_VERSION=$(shell grep "const Version" $(GITROOT)/internal/version/version.go | cut -d'=' -f2 | tr -d '" ')

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/elastic/apm-server
22

3-
go 1.23.0
3+
go 1.23.6
44

55
require (
66
github.com/KimMachineGun/automemlimit v0.7.0

packaging/docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ARG GOLANG_VERSION
88
################################################################################
99
FROM golang:${GOLANG_VERSION} as builder
1010
WORKDIR /src
11-
COPY go.mod go.sum .go-version /src/
11+
COPY go.mod go.sum /src/
1212
RUN --mount=type=cache,target=/go/pkg/mod go mod download
1313
COPY Makefile *.mk /src/
1414
COPY cmd /src/cmd

packaging/docker/Dockerfile.wolfi

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ARG GOLANG_VERSION
77
################################################################################
88
FROM docker.elastic.co/wolfi/go:${GOLANG_VERSION} as builder
99
WORKDIR /src
10-
COPY go.mod go.sum .go-version /src/
10+
COPY go.mod go.sum /src/
1111
RUN --mount=type=cache,target=/go/pkg/mod go mod download
1212
COPY Makefile *.mk /src/
1313
COPY cmd /src/cmd

script/common.bash

-44
This file was deleted.

script/update_go_version.sh

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# This script updates .go-version, documentation, and build files to use the
3+
# This script updates go.mod files to use the
44
# most recent patch version for the major.minor Go version defined in go.mod.
55
set -e
66

@@ -11,6 +11,3 @@ cd $SDIR/..
1111
MAJOR_MINOR_VERSION=$(grep '^go' go.mod | cut -d' ' -f2 | cut -d. -f1-2)
1212

1313
find ./ -type f -name "go.mod" -execdir go get go@$MAJOR_MINOR_VERSION \; -execdir go get toolchain@none \;
14-
15-
GO_VERSION=$(grep '^go' go.mod | cut -d' ' -f2)
16-
echo $GO_VERSION > .go-version

systemtest/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/elastic/apm-server/systemtest
22

3-
go 1.23.0
3+
go 1.23.6
44

55
require (
66
github.com/docker/docker v27.5.1+incompatible

tools/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/elastic/apm-server/tools
22

3-
go 1.23.0
3+
go 1.23.6
44

55
require (
66
github.com/elastic/apm-perf v0.0.0-20240925232339-499ba2a27fd4

0 commit comments

Comments
 (0)