vcom/Makefile
vrubelroman 829b1237b2 ci: gofmt/vet/race/vendor checks via Makefile; release reuses CI
- Makefile targets: build, test, race, fmt-check, vet, vendor-check, lint, ci
- ci.yml runs fmt-check, vet, vendor-check, build and race tests; also on
  rework/** branches and callable from release.yml
- gofmt the three files that were not formatted

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 23:02:31 +03:00

47 lines
1.2 KiB
Makefile

# Developer and CI entry points. CI (.github/workflows/*.yml) calls these
# targets so local runs and CI stay identical.
GO ?= go
GOFLAGS ?= -mod=vendor
export GOFLAGS
# Go sources we own (vendor/ is third-party and not reformatted).
GOFILES = $(shell git ls-files '*.go' | grep -v '^vendor/')
# Targets mutate vendor/ (vendor-check) and then build from it: never run them
# concurrently, even under `make -j`.
.NOTPARALLEL:
.PHONY: all build test race lint fmt-check vet vendor-check ci fmt
all: build
build:
$(GO) build ./...
test:
$(GO) test -count=1 ./...
race:
$(GO) test -race -count=1 ./...
fmt:
gofmt -w $(GOFILES)
fmt-check:
@out="$$(gofmt -l $(GOFILES) $$(git ls-files --others --exclude-standard '*.go' | grep -v '^vendor/'))"; \
if [ -n "$$out" ]; then echo "gofmt needed for:"; echo "$$out"; exit 1; fi
vet:
$(GO) vet ./...
# go mod vendor must be a no-op: go.mod, go.sum and vendor/ are committed.
vendor-check:
GOFLAGS= $(GO) mod vendor
git diff --exit-code -- vendor go.mod go.sum
@untracked="$$(git ls-files --others --exclude-standard vendor)"; \
if [ -n "$$untracked" ]; then echo "untracked files in vendor/:"; echo "$$untracked"; exit 1; fi
lint: fmt-check vet vendor-check
ci: lint build race