From 56c0a75ea9aa515fc85423b72040809daccd0ab8 Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Tue, 10 Oct 2023 16:50:33 -0700 Subject: [PATCH] tool/gocross: handle VERSION file not found Fixes #9734 Signed-off-by: Maisem Ali --- tool/gocross/gocross-wrapper.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tool/gocross/gocross-wrapper.sh b/tool/gocross/gocross-wrapper.sh index fc4a94225..6a9104dd1 100755 --- a/tool/gocross/gocross-wrapper.sh +++ b/tool/gocross/gocross-wrapper.sh @@ -32,7 +32,10 @@ if [[ -d "$toolchain" ]]; then # A toolchain exists, but is it recent enough to compile gocross? If not, # wipe it out so that the next if block fetches a usable one. want_go_minor=$(grep -E '^go ' "go.mod" | cut -f2 -d'.') - have_go_minor=$(head -1 "$toolchain/VERSION" | cut -f2 -d'.') + have_go_minor="" + if [[ -f "$toolchain/VERSION" ]]; then + have_go_minor=$(head -1 "$toolchain/VERSION" | cut -f2 -d'.') + fi # Shortly before stable releases, we run release candidate # toolchains, which have a non-numeric suffix on the version # number. Remove the rc qualifier, we just care about the minor