tb-dotfiles/home/.zshrc.d/01_update_go_apps.sh

27 lines
439 B
Bash
Raw Normal View History

#!/bin/bash
2018-01-18 10:50:03 -05:00
# updates go binary installs that you care about.
# if the GOAPPS environment variable is set, it is expected to be
# an array
update_go_apps() {
(
cd || exit $?
2018-01-18 10:50:03 -05:00
local APPS=("${@}")
if [ -z "${APPS[0]}" ]; then
if [ -z "${GOAPPS}" ]; then
exit 0
fi
2018-01-18 10:50:03 -05:00
APPS=("${GOAPPS[@]}")
fi
2018-01-18 10:50:03 -05:00
local APP
for APP in "${APPS[@]}"; do
echo "Updating ${APP}"
go get -u "${APP}" || exit $?
done
) || return $?
2018-01-18 10:50:03 -05:00
}