-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
vet.sh
executable file
·30 lines (24 loc) · 929 Bytes
/
vet.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
#!/bin/bash
# Vet all the files using go vet excluding errors which are currently explicitly ignore
# This script is intended to be used in the continuous integration process
# When editing, it is highly recommended to use ShellCheck (https://www.shellcheck.net/) to avoid common pitfalls
# Patterns to be ignored from the go lint output
IGNORED_PATTERNS=(
"^# "
# Field order is well-defined
"/quad\.Quad composite literal uses unkeyed fields" # 1.19
"/quad\.Quad struct literal uses unkeyed fields" # 1.20
# Code imported from b
" method Seek\(k int64\) .* should have signature "
)
# Patterns joined into a regular expression
REGEX=$(printf "|(%s)" "${IGNORED_PATTERNS[@]}")
REGEX=${REGEX:1}
# Execute go vet on all the files and filter output by the regualr expression
output=$( (go vet ./... 2>&1 | grep -Ev "$REGEX") | tee /dev/fd/2);
if [ -z "$output" ]
then
exit 0
else
exit 1
fi