forked from influxdata/influxdb-observability
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-checks.sh
executable file
·52 lines (46 loc) · 921 Bytes
/
run-checks.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
set -e
cd "$(dirname "$0")"
BASEDIR=$(pwd)
if ! hash go; then
echo "please install go and try again"
exit 1
fi
if ! hash staticcheck; then
echo "installing staticcheck"
if ! go install honnef.co/go/tools/cmd/[email protected]; then
echo "failed to install staticcheck"
exit 1
fi
fi
for package in common influx2otel otel2influx jaeger-influxdb tests-integration; do
echo checking ${package}
cd "${BASEDIR}/${package}"
go mod tidy
if ! git diff --exit-code -- go.mod go.sum; then
fail=1
fi
if ! go build ./...; then
fail=1
fi
if ! go test ./...; then
fail=1
fi
if [[ -n $(gofmt -s -l . | head -n 1) ]]; then
fail=1
gofmt -s -d .
fi
if ! go vet ./...; then
fail=1
fi
if ! staticcheck -f stylish ./...; then
fail=1
fi
done
echo
if [ -n "$fail" ]; then
echo "at least one check failed"
exit 1
else
echo "all checks OK"
fi