split Dockerfile into lint + build stages for faster CI feedback
All checks were successful
Check / check (pull_request) Successful in 2m26s

- Add dedicated lint stage using golangci/golangci-lint:v2.10.1 image
  (pinned by sha256 digest) for fast formatting and lint checks
- Keep build stage with golang:1.25-alpine for tests and compilation
- Remove manual golangci-lint download/install from builder stage
- Add fmt-check Makefile target for standalone format checking
- Refactor check target to use fmt-check, lint, test dependencies

The lint stage uses the official golangci-lint image which has the
linter pre-installed, eliminating the need to download it on every
build. Lint failures now surface immediately without waiting for
the download step.

closes #151
This commit is contained in:
clawbot
2026-03-01 10:32:31 -08:00
parent 578c6ec842
commit 2c4c1beaf9
2 changed files with 23 additions and 32 deletions

View File

@@ -1,4 +1,4 @@
.PHONY: all build lint fmt test check clean
.PHONY: all build lint fmt fmt-check test check clean
BINARY := upaasd
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
@@ -18,20 +18,15 @@ fmt:
goimports -w .
npx prettier --write --tab-width 4 static/js/*.js
fmt-check:
@test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1)
test:
go test -v -race -cover ./...
# Check runs all validation without making changes
# Used by CI and Docker build - fails if anything is wrong
check:
@echo "==> Checking formatting..."
@test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1)
@echo "==> Running linter..."
golangci-lint run --config .golangci.yml ./...
@echo "==> Running tests..."
go test -v -race ./...
@echo "==> Building..."
go build -ldflags "$(LDFLAGS)" -o /dev/null ./cmd/upaasd
check: fmt-check lint test
@echo "==> All checks passed!"
clean: