From 72d1d5e15978a78fa95389da769cc766380624c4 Mon Sep 17 00:00:00 2001 From: i343759 Date: Thu, 16 Apr 2026 10:51:32 +0300 Subject: [PATCH] Add cflinuxfs5 support to install_go.sh Drop cflinuxfs3 from the stack allowlist, update Go from 1.22.5 to 1.25.6, and use the cflinuxfs4 binary with a cflinuxfs5 fallback. This matches the pattern already used by nodejs, ruby, go, python, staticfile, dotnet-core, and nginx buildpacks. When deploying via git URL, CF runs bin/supply as a shell script which sources scripts/install_go.sh to bootstrap Go compilation. The stack check only allowed cflinuxfs3 and cflinuxfs4, causing cflinuxfs5 deployments to fail with 'Unsupported stack'. --- scripts/install_go.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/install_go.sh b/scripts/install_go.sh index a09027c3d..7a78a702f 100644 --- a/scripts/install_go.sh +++ b/scripts/install_go.sh @@ -5,24 +5,27 @@ set -u set -o pipefail function main() { - if [[ "${CF_STACK:-}" != "cflinuxfs3" && "${CF_STACK:-}" != "cflinuxfs4" ]]; then + if [[ "${CF_STACK:-}" != "cflinuxfs4" && "${CF_STACK:-}" != "cflinuxfs5" ]]; then echo " **ERROR** Unsupported stack" echo " See https://docs.cloudfoundry.org/devguide/deploy-apps/stacks.html for more info" exit 1 fi local version expected_sha dir - version="1.22.5" - expected_sha="ddb12ede43eef214c7d4376761bd5ba6297d5fa7a06d5635ea3e7a276b3db730" + version="1.25.6" + expected_sha="0ed64e3b9cb9b1c2ec57880dae2427b0ee2676f2ae2fb53c2e1bb838c500f9fb" dir="/tmp/go${version}" mkdir -p "${dir}" if [[ ! -f "${dir}/bin/go" ]]; then - local url - # TODO: use exact stack based dep, after go buildpack has cflinuxfs4 support - #url="https://buildpacks.cloudfoundry.org/dependencies/go/go_${version}_linux_x64_${CF_STACK}_${expected_sha:0:8}.tgz" - url="https://buildpacks.cloudfoundry.org/dependencies/go/go_${version}_linux_x64_cflinuxfs3_${expected_sha:0:8}.tgz" + local url stack_for_download + # Use cflinuxfs4 binary for cflinuxfs5 (compatible) + stack_for_download="${CF_STACK}" + if [[ "${CF_STACK}" == "cflinuxfs5" ]]; then + stack_for_download="cflinuxfs4" + fi + url="https://buildpacks.cloudfoundry.org/dependencies/go/go_${version}_linux_x64_${stack_for_download}_${expected_sha:0:8}.tgz" echo "-----> Download go ${version}" curl "${url}" \