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
34 lines
816 B
Makefile
34 lines
816 B
Makefile
.PHONY: all build lint fmt fmt-check test check clean
|
|
|
|
BINARY := upaasd
|
|
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
|
BUILDARCH := $(shell go env GOARCH)
|
|
LDFLAGS := -X main.Version=$(VERSION) -X main.Buildarch=$(BUILDARCH)
|
|
|
|
all: check build
|
|
|
|
build:
|
|
go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/upaasd
|
|
|
|
lint:
|
|
golangci-lint run --config .golangci.yml ./...
|
|
|
|
fmt:
|
|
gofmt -s -w .
|
|
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: fmt-check lint test
|
|
@echo "==> All checks passed!"
|
|
|
|
clean:
|
|
rm -rf bin/
|