-
Notifications
You must be signed in to change notification settings - Fork 0
/
golang_test.sh
executable file
·47 lines (42 loc) · 1.04 KB
/
golang_test.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
#!/bin/bash
#
# From root of project, run: `bash scripts/golang_test.sh`
clear
# Color Console Output
RESET='\033[0m' # Text Reset
REDBOLD='\033[1;31m' # Red (Bold)
GREENBOLD='\033[1;32m' # Green (Bold)
YELLOWBOLD='\033[1;33m' # Yellow (Bold)
CYANBOLD='\033[1;36m' # Cyan (Bold)
# echo -e "${CYANBOLD}Running: go generate${RESET}"
# go generate ./...
# status=$?
# if test $status -ne 0
# then
# echo -e "${REDBOLD}...Error: 'go generate' command failed!${RESET}"
# echo ""
# exit 1
# fi
# echo -e "${GREENBOLD}...Complete.${RESET}"
echo -e "${CYANBOLD}Clearing test cache...${RESET}"
go clean -testcache
status=$?
if test $status -ne 0
then
echo -e "${REDBOLD}...Error: 'go clean' command failed!${RESET}"
echo ""
exit 1
fi
echo -e "${GREENBOLD}...Complete.${RESET}"
echo ""
echo -e "${CYANBOLD}Running tests...${RESET}"
gotestsum --format testname
status=$?
if test $status -ne 0
then
echo -e "${REDBOLD}...Error: 'go test' command failed!${RESET}"
echo ""
exit 1
fi
echo -e "${GREENBOLD}...Complete.${RESET}"
echo ""