-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbake.sh
57 lines (47 loc) · 873 Bytes
/
bake.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
45
46
47
48
49
50
51
52
53
54
55
56
57
# Run golang container
task:wrap() {
cd $CWD
local PORT=${PORT:-4000}
docker run --rm \
-v $PWD:/app/src/project \
-v $PWD/.go:/go \
-w /app/src/project \
-p $PORT:8080 \
-e GOPATH=/go:/app \
-ti golang $@
}
# Run go in workspace
task:go() {
task:wrap go $@
}
# Execute go run ... in workspace
task:run() {
task:go run $@
}
# Build current subproject
task:build() {
local FILE=$1
shift 1
task:go build -o build/$FILE $@
}
# Create new sub-project in project's root
task:new() {
local NAME=$1
if [ -d "$NAME" ]
then
echo "Project '$NAME' already exists"
exit 1
fi
mkdir $NAME
echo "# $NAME" > $NAME/readme.md
}
# Initialize subproject
task:init() {
cd $CWD
# Install dependency management tool
task:go get -u github.com/golang/dep/cmd/dep
}
# Run go's dep utility
task:dep() {
task:wrap dep $@
}