From 85c043ad7f4b36a5edac687abe6fb787f5f19d0f Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Sat, 11 Jul 2026 14:12:28 +0100 Subject: [PATCH] fix: add golangci-lint to pre-commit hook, clarify R2_ENDPOINT in env example Pre-commit now runs golangci-lint (3m timeout) after go vet, before staticcheck. R2_ENDPOINT comment updated to clarify it is prod-only and local dev uses S3_* vars. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- .env.example | 3 ++- .githooks/pre-commit | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 195d823..02aa8bd 100644 --- a/.env.example +++ b/.env.example @@ -23,7 +23,8 @@ S3_BUCKET=crussell S3_PROFILE_PICS_BUCKET=crussell-profile-pics AWS_REGION=eu-west-2 -# Prod: Set R2_ENDPOINT for Cloudflare R2 (overrides S3_* vars in non-dev builds) +# Prod only: Cloudflare R2 (overrides S3_* vars in non-dev builds). +# Local dev uses the S3_* vars above (from .env). Not needed for local builds. R2_ENDPOINT= # R2_ACCESS_KEY= # R2_SECRET_KEY= diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 8a70271..f230274 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -41,6 +41,13 @@ if [ -n "$BACKEND_FILES" ]; then fi cd .. + printf "${YELLOW}Checking golangci-lint...${NC}\n" + if ! cd backend && golangci-lint run ./... --timeout 3m 2>&1; then + printf "${RED}✖ golangci-lint failed${NC}\n" + FAILED=1 + fi + cd .. + printf "${YELLOW}Checking staticcheck...${NC}\n" if ! cd backend && staticcheck -tags "test,dev" ./... 2>&1; then printf "${RED}✖ staticcheck failed${NC}\n"