-
Notifications
You must be signed in to change notification settings - Fork 1
/
local.sh
44 lines (36 loc) · 830 Bytes
/
local.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -e -o pipefail
trap '[ "$?" -eq 0 ] || echo "Error Line:<$LINENO> Error Function:<${FUNCNAME}>"' EXIT
cd `dirname $0`
CURRENT=`pwd`
function test
{
setenv
go test -v $(go list ./... | grep -v vendor) --count 1 -race -coverprofile=$CURRENT/coverage.txt -covermode=atomic
}
function setenv
{
if [ -e $CURRENT/local_env.sh ]; then
source $CURRENT/local_env.sh
fi
}
function build
{
cd $CURRENT/cmd/dns
go build -trimpath -ldflags='-s -w' -o $CURRENT/dist/dns-darwin
}
function linux_build
{
cd $CURRENT/cmd/dns
GOOS=linux GOARCH=amd64 go build -trimpath -ldflags='-s -w' -o $CURRENT/dist/dns-linux
}
function release
{
# export GITHUB_TOKEN=blahblah
# before --> git tag -a 'version' -m ''
cd $CURRENT/cmd/dns
goreleaser release --rm-dist
}
CMD=$1
shift
$CMD $*