#!/bin/bash TARGET=mqttListener export PATH=$PATH:~/go/bin RED='\e[0;31m' GREEN='\e[0;32m' LIGHT_YELLOW='\e[93m' NC='\e[0m' # No Color BOLD='\e[1m' NORMAL='\e[21m' ####################################################################################### # functions die() { echo -e "\n${RED}$@${NC}" 1>&2 ; exit 1; } ####################################################################################### #cd /src if ! command -v govvv &> /dev/null ; then die "govv is not installed" fi ####################################################################################### # build echo -e "${NC}\n " echo -e "\nBuilding for Linux 64-bit:" env GOOS=linux GOARCH=amd64 go build -a -v -ldflags "$(govvv -flags)" -o ${TARGET}-linux-amd64 echo -e "\t\t${GREEN}... done${NC}" echo -e "\nBuilding for arm:" env GOOS=linux GOARCH=arm go build -a -v -ldflags "$(govvv -flags)" -o ${TARGET}-linux-arm echo -e "\t\t${GREEN}... done${NC}" echo -e "\nstipping arm binary:" strip -o ${TARGET}-linux-arm-stripped ${TARGET}-linux-arm echo -e "\t\t${GREEN}... done${NC}"