Revision 533a847b2e8c77d238d4eedd0df353dcf2e5b010 authored by Iddan Aaronsohn on 04 April 2020, 10:23:59 UTC, committed by Iddan Aaronsohn on 04 April 2020, 10:23:59 UTC
1 parent 2be3b7e
lint.sh
#!/bin/bash
# Lint all the files using go lint 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=(
" comment "
"graph\/proto\/primitive.pb.go"
"func name will be used as refs.RefsOf by other packages, and that stutters; consider calling this Of"
"method CapitalizedUri should be CapitalizedURI"
"func name will be used as path.PathFromIterator by other packages, and that stutters; consider calling this FromIterator"
)
# Patterns joined into a regular expression
REGEX=$(printf "|(%s)" "${IGNORED_PATTERNS[@]}")
REGEX=${REGEX:1}
# Execute go lint on all the files and filter output by the regualr expression
output=$( ( (golint ./... | egrep -v "$REGEX") 2>&1 ) | tee /dev/fd/2);
if [ -z "$output" ]
then
exit 0
else
exit 1
fi
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...