forked from prebid/prebid-cache
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate.sh
More file actions
executable file
·32 lines (25 loc) · 828 Bytes
/
validate.sh
File metadata and controls
executable file
·32 lines (25 loc) · 828 Bytes
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
#!/bin/bash
set -e
AUTOFMT=true
while true; do
case "$1" in
--nofmt ) AUTOFMT=false; shift ;;
* ) break ;;
esac
done
die() { echo -e "$@" 1>&2 ; exit 1; }
# check there are no formatting issues
GOFMT_LINES=`gofmt -l *.go backends metrics | wc -l | xargs`
if $AUTOFMT; then
# if there are files with formatting issues, they will be automatically corrected using the gofmt -w <file> command
if [[ $GOFMT_LINES -ne 0 ]]; then
FMT_FILES=`gofmt -l *.go backends metrics | xargs`
for FILE in $FMT_FILES; do
echo "Running: gofmt -w $FILE"
`gofmt -w $FILE`
done
fi
else
test $GOFMT_LINES -eq 0 || die "gofmt needs to be run, ${GOFMT_LINES} files have issues. Below is a list of files to review:\n`gofmt -l *.go backends metrics`"
fi
go test $(go list ./... | grep -v /vendor/)