From 8b77a98ff284f0f3d3e2b95a8ac4d769c2ee41c3 Mon Sep 17 00:00:00 2001 From: Vithurshan Selvarajah <31311292+vithurshanselvarajah@users.noreply.github.com> Date: Wed, 21 Jan 2026 18:57:21 +0000 Subject: [PATCH] Go >=1.17 build fix Go >=1.17 uses module mode by default. The changes introduce new system variables (GO111MODULE, GOMODCACHE & GOCACHE) to allow the build to complete. The changes will also include these GO caches in its cleanup --- rmmagent-linux.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rmmagent-linux.sh b/rmmagent-linux.sh index 4377005..80a10fe 100644 --- a/rmmagent-linux.sh +++ b/rmmagent-linux.sh @@ -96,6 +96,11 @@ function agent_compile() { tar -xf "$TMPDIR/rmmagent.tar.gz" -C "$TMPDIR/" rm "$TMPDIR/rmmagent.tar.gz" cd "$TMPDIR/rmmagent-master" + # Force module mode and use a local module cache + export GO111MODULE=on + export GOMODCACHE="$TMPDIR/go-mod-cache" + export GOCACHE="$TMPDIR/go-build-cache" + mkdir -p "$GOMODCACHE" case $system in amd64) env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o "$TMPDIR/temp_rmmagent" ;; x86) env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w" -o "$TMPDIR/temp_rmmagent" ;; @@ -103,7 +108,7 @@ function agent_compile() { armv6) env CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags "-s -w" -o "$TMPDIR/temp_rmmagent" ;; esac cd "$TMPDIR" - rm -R "$TMPDIR/rmmagent-master" + rm -R "$TMPDIR/rmmagent-master" "$GOMODCACHE" "$GOCACHE" } function update_agent() {