-
Notifications
You must be signed in to change notification settings - Fork 0
/
go.zsh
46 lines (37 loc) · 1.09 KB
/
go.zsh
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
45
46
function gomodgraph() {
if ! [ -x "$(command -v dot)" ]; then
echo 'Error: dot not available in PATH. Install with "brew install graphviz" and retry.'
return
fi
if ! [ -x "$(command -v modgraphviz)" ]; then
echo 'modgraphviz not found. Installing now...'
(mkdir /tmp/modgraphviz && go get golang.org/x/exp/cmd/modgraphviz)
fi
go mod graph | modgraphviz | dot -Tpng | open -f -a /System/Applications/Preview.app
}
function sourceLocalEnv() {
set -a # automatically export all variables
source local.env
set +a
}
function gowtest() {
set -a # automatically export all variables
source local.env
set +a
args=${@:-./...}
nodemon --ext go --ignore "**/vendor/**" -x "gotest "$args" || exit 1"
}
function gorun() {
set -a # automatically export all variables
source local.env
set +a
go run cmd/main.go
}
function gowbuild() {
args=${@:-cmd/main.go}
nodemon --ext go -x "go build $args || exit 1"
}
function gowbuildall() {
args=${@:-./...}
nodemon --ext go -x "go build $args || exit 1"
}