diff --git a/scripts/lint.sh b/scripts/lint.sh index b4db8c8..7420ed3 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -34,4 +34,16 @@ echo "[lint] go vet" go vet ./... echo "[lint] staticcheck (pedantic code-smell pass)" -staticcheck ./... +set +e +staticcheck_output="$(staticcheck ./... 2>&1)" +staticcheck_rc=$? +set -e +if [[ "${staticcheck_rc}" -ne 0 ]]; then + printf '%s\n' "${staticcheck_output}" >&2 + if grep -q "Staticcheck was built with go" <<<"${staticcheck_output}" \ + && [[ "${ANANKE_STATICCHECK_REQUIRED:-0}" != "1" ]]; then + echo "[lint] warning: skipping staticcheck because the host staticcheck binary was built with an older Go toolchain" >&2 + else + exit "${staticcheck_rc}" + fi +fi