forked from sandia-minimega/minimega
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.bash
More file actions
executable file
·41 lines (33 loc) · 836 Bytes
/
check.bash
File metadata and controls
executable file
·41 lines (33 loc) · 836 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
33
34
35
36
37
38
39
40
41
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. $SCRIPT_DIR/env.bash
# set the version from the repo
VERSION=`git --git-dir $SCRIPT_DIR/.git rev-parse HEAD`
DATE=`date --rfc-3339=date`
echo "package version
var (
Revision = \"$VERSION\"
Date = \"$DATE\"
)" > $SCRIPT_DIR/src/version/version.go
echo "CHECKING FMT"
OUTPUT="$(find $SCRIPT_DIR/src ! \( -path '*vendor*' -prune \) -type f -name '*.go' -exec gofmt -d -l {} \;)"
if [ -n "$OUTPUT" ]; then
echo "$OUTPUT"
echo "gofmt - FAILED"
exit 1
fi
echo "gofmt - OK"
echo
# note: we redirect go vet's output on STDERR to STDOUT
echo "VET PACKAGES"
for i in `ls $SCRIPT_DIR/src | grep -v vendor | grep -v plumbing`
do
echo $i
go vet $i
if [[ $? != 0 ]]; then
echo "go vet - FAILED"
exit 1
fi
done
echo "govet - OK"
echo