Skip to content

Commit

Permalink
fix: update CI script
Browse files Browse the repository at this point in the history
The scripts/ci/check-system-go-matches-go-mod.sh is failing because
newer go toolchains include the bugfix version in go.mod's go
directive. Update the script to check the major and minor versions
reported by both tools match.
  • Loading branch information
mhilton committed Jun 10, 2024
1 parent c452876 commit ddbcf66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/influxdata/influxdb/v2

go 1.21
go 1.21.0

toolchain go1.21.9

Expand Down
7 changes: 4 additions & 3 deletions scripts/ci/check-system-go-matches-go-mod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ set -eo pipefail
# Check that the same major/minor version of go is used in the mod file as on CI to prevent
# the two from accidentally getting out-of-sync.
function main () {
local -r version_diff=$(go mod edit -go=$(go version | sed -n 's/^.*go\([0-9]*.[0-9]*\).*$/\1/p') -print | diff - go.mod)
if [ -n "$version_diff" ]; then
local -r go_version=$(go version | sed -n 's/^.*go\([0-9]*.[0-9]*\).*$/\1/p')
local -r go_mod_go_version=$(sed -n 's/^go \([0-9]*.[0-9]*\).*$/\1/p')
if [ "$go_version" != "$go_mod_go_version" ]; then
>&2 echo Error: unexpected difference in go version:
>&2 echo "$version_diff"
>&2 echo "go version: $go_version, go.mod version: $go_mod_go_version"
exit 1
fi
}
Expand Down

0 comments on commit ddbcf66

Please sign in to comment.