#!/usr/bin/env bash set -euo pipefail REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "${REPO_DIR}" export PATH="$(go env GOPATH)/bin:${PATH}" STATICCHECK_VERSION="${ANANKE_STATICCHECK_VERSION:-2025.1.1}" run_with_retry() { local attempts="$1" shift local try=1 local delay=3 local rc=0 while true; do "$@" && return 0 rc=$? if [[ "${try}" -ge "${attempts}" ]]; then return "${rc}" fi echo "[lint] retry ${try}/${attempts} after rc=${rc}: $*" >&2 sleep "${delay}" delay=$((delay * 2)) try=$((try + 1)) done } if ! command -v staticcheck >/dev/null 2>&1 || ! staticcheck -version 2>/dev/null | grep -q "${STATICCHECK_VERSION}"; then echo "[lint] installing staticcheck ${STATICCHECK_VERSION}" run_with_retry 4 go install "honnef.co/go/tools/cmd/staticcheck@${STATICCHECK_VERSION}" fi echo "[lint] go vet" go vet ./... echo "[lint] staticcheck (pedantic code-smell pass)" staticcheck ./...