Browse Source

golang: Add more error handling for go-gcc-helper

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lilik-openwrt-22.03
Jeffery To 4 years ago
parent
commit
7aaaa8ae64
No known key found for this signature in database GPG Key ID: C616D9E719E868E4
1 changed files with 25 additions and 7 deletions
  1. +25
    -7
      lang/golang/golang/files/go-gcc-helper

+ 25
- 7
lang/golang/golang/files/go-gcc-helper View File

@ -1,23 +1,41 @@
#!/bin/sh
me=go-gcc-helper
name=$(basename $0)
name="${0##*/}"
case $name in
log() {
# shellcheck disable=SC2039
local IFS=" "
printf '%s\n' "$me: $*"
}
case "$name" in
gcc)
cmd=$GO_GCC_HELPER_CC
if [ -z "$GO_GCC_HELPER_CC" ]; then
log "missing GO_GCC_HELPER_CC"
exit 1
fi
cmd="$GO_GCC_HELPER_CC"
;;
g++)
cmd=$GO_GCC_HELPER_CXX
if [ -z "$GO_GCC_HELPER_CXX" ]; then
log "missing GO_GCC_HELPER_CXX"
exit 1
fi
cmd="$GO_GCC_HELPER_CXX"
;;
*)
echo "$me: unknown command \"$name\""
log "unknown command \"$name\""
exit 1
;;
esac
export PATH="$GO_GCC_HELPER_PATH"
if [ -n "$GO_GCC_HELPER_PATH" ]; then
export PATH="$GO_GCC_HELPER_PATH"
else
log "missing GO_GCC_HELPER_PATH"
fi
echo "$me: running $cmd $@"
log "running $cmd $*"
$cmd "$@"

Loading…
Cancel
Save