-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·58 lines (46 loc) · 943 Bytes
/
build.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
58
#!/bin/bash
fileName="package.properties"
build(){
read -p "enter your GOPATH(no enter will use parent path of src): " goPath
setEnv
echo "installing package!"
reimport
echo "build successfully!"
}
run(){
read -p "enter your GOPATH(no enter will use parent path of src): " goPath
setEnv
echo "running...."
go run main/main.go
}
reimport() {
echo "==============import=============="
setEnv
echo "Current GOPATH :"
echo $GOPATH
for line in `cat $fileName`
do
echo "installing $line!"
go get "$line" -v -u
done
}
setEnv(){
echo "==============Set path=============="
if [ -n "$goPath" ]; then
export GOPATH=$goPath
else
currentPath=`pwd`
export GOPATH=${currentPath%src*}
fi
}
case "$1" in
build)
build ;;
reimport)
reimport ;;
run)
run ;;
*)
echo $"Usage: $0 {build|reimport|run}"
exit 1
esac