From 8c2eaf83468d6024ae18977b4e87fc85dcaf0f52 Mon Sep 17 00:00:00 2001 From: Paul Meyer Date: Tue, 17 Dec 2024 09:34:41 +0100 Subject: [PATCH 1/2] scripts: add go-directive-sync, run with generate Signed-off-by: Paul Meyer --- packages/scripts.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/packages/scripts.nix b/packages/scripts.nix index 2d8c7047d3..83ef304ba5 100644 --- a/packages/scripts.nix +++ b/packages/scripts.nix @@ -100,8 +100,12 @@ protoc-gen-go protoc-gen-go-grpc nix-update + scripts.go-directive-sync ]; text = '' + echo "Syncing go directive versions in go.mod/go.work files" >&2 + go-directive-sync + while IFS= read -r dir; do echo "Running go mod tidy on $dir" >&2 go mod tidy @@ -531,4 +535,32 @@ ]; text = builtins.readFile ./test-peerpods.sh; }; + + # Sync the go directive between go.mod/go.work files (that is, the 'go' statement of these files). + # We take the latest version we find and use that everywhere. + go-directive-sync = writeShellApplication { + name = "go-directive-sync"; + runtimeInputs = with pkgs; [ + go + findutils + coreutils + ]; + text = '' + set -euo pipefail + + modFiles=$(find . -regex '.*/go[.]\(mod\|work\)$') + + goVers=() + while IFS= read -r f; do + ver=$(grep -E '^go [0-9]+[.][0-9]+[.][0-9]+$' "$f") + goVers+=("$ver") + done <<< "$modFiles" + + maxVer=$(printf "%s\n" "''${goVers[@]}" | sort -V | tail -n1) + + while IFS= read -r f; do + sed -i "s/^go [0-9]\+\.[0-9]\+\.[0-9]\+$/''${maxVer}/" "$f" + done <<< "$modFiles" + ''; + }; } From 8676dc90875437fd9f3999d23f311b17b93f0526 Mon Sep 17 00:00:00 2001 From: Paul Meyer Date: Tue, 17 Dec 2024 09:35:01 +0100 Subject: [PATCH 2/2] treewide: sync go directive Signed-off-by: Paul Meyer --- go.work | 2 +- service-mesh/go.mod | 2 +- tools/tdx-measure/go.mod | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.work b/go.work index 8c724b09ee..872479975c 100644 --- a/go.work +++ b/go.work @@ -1,4 +1,4 @@ -go 1.22.7 +go 1.23.0 use ( . diff --git a/service-mesh/go.mod b/service-mesh/go.mod index 02f03d57a7..8464fa80ac 100644 --- a/service-mesh/go.mod +++ b/service-mesh/go.mod @@ -1,6 +1,6 @@ module github.com/edgelesssys/contrast/service-mesh -go 1.22.0 +go 1.23.0 require ( github.com/coreos/go-iptables v0.8.0 diff --git a/tools/tdx-measure/go.mod b/tools/tdx-measure/go.mod index dde7d095a5..c206d1b7ce 100644 --- a/tools/tdx-measure/go.mod +++ b/tools/tdx-measure/go.mod @@ -1,6 +1,6 @@ module github.com/edgelesssys/contrast/tdx-measure -go 1.22.0 +go 1.23.0 require ( github.com/foxboron/go-uefi v0.0.0-20241017190036-fab4fdf2f2f3