From e1b7f629ef51f3992dd6c35c06ebf741e14afadf Mon Sep 17 00:00:00 2001 From: Brett Elliott Date: Mon, 17 May 2021 18:03:21 +0200 Subject: [PATCH] Print out error when unable to download module Use shell syntax instead of pipe so error messages are printed out. Before this change, if it could not download a module, it would just exit without printing an error message due to the pipe. With this change it now prints out the error message(unable to download) from the underlying process. --- cluster-autoscaler/hack/update-vendor.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cluster-autoscaler/hack/update-vendor.sh b/cluster-autoscaler/hack/update-vendor.sh index 7c6608cc3a01..42d0b9405bc8 100755 --- a/cluster-autoscaler/hack/update-vendor.sh +++ b/cluster-autoscaler/hack/update-vendor.sh @@ -50,8 +50,14 @@ rm -rf ${WORKDIR} for MOD in "${MODS[@]}"; do V=$( - go mod download -json "${MOD}@kubernetes-${VERSION}" | - sed -n 's|.*"Version": "\(.*\)".*|\1|p' + GOMOD="${MOD}@kubernetes-${VERSION}" + JSON=$(go mod download -json "${GOMOD}") + retval=$? + if [ $retval -ne 0 ]; then + echo "Error downloading module ${GOMOD}." + exit 1 + fi + echo "${JSON}" | sed -n 's|.*"Version": "\(.*\)".*|\1|p' ) go mod edit "-replace=${MOD}=${MOD}@${V}" done