-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·52 lines (52 loc) · 1.07 KB
/
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
#!/bin/bash
if [[ $1 == "" || $1 == "help" ]]
then
printf 'This sctipt launch and build server.\n\n'
printf 'Examples - [ $ ./build "option" ]\n\n'
printf 'Options: \n\n'
printf 'start - execute server\n'
printf 'build - execute "go build" command\n'
printf 'install - exetute "go install" command\n'
printf 'run - exetute "go run" command\n'
fi
if [[ $1 == "start" ]]
then
printf 'Launch server...\n'
./main
if (( $? != 0 ))
then
printf "[ERROR] Launch server exit which error code $?"
exit $?
fi
fi
if [[ $1 == "build" ]]
then
printf 'Start compile server...'
go build main.go
if (( $? != 0 ))
then
printf "[ERROR] Compile server exit which error code $?"
exit $?
fi
fi
if [[ $1 == "run" ]]
then
printf 'Run server...'
go run main.go
if (( $? != 0 ))
then
printf "[ERROR] Run server exit which error code $?"
exit $?
fi
fi
if [[ $1 == "install" ]]
then
printf 'Install server...'
go install main.go
if (( $? != 0 ))
then
printf "[ERROR] Install server exit which error code $?"
exit $?
fi
fi
exit 0