Skip to content

Commit

Permalink
Print out error when unable to download module
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brett-elliott committed May 21, 2021
1 parent 58eef9c commit e1b7f62
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cluster-autoscaler/hack/update-vendor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e1b7f62

Please sign in to comment.