Revision a09b6f2ee3d05036112172f3f2816638e8c8953f authored by Olaf Conradi on 04 March 2023, 23:51:57 UTC, committed by Olaf Conradi on 04 March 2023, 23:51:57 UTC
1 parent 94f1b49
Raw File
vet.sh
#!/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"

    # 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
back to top