check / check (push) Successful in 1m17s
The Dockerfile builder stage takes ARG VERSION (default `dev`) and passes it to `make build` on the command line, which overrides the Makefile's `git describe` default. script/docker computes the version from `git describe` on the host and passes it as --build-arg VERSION, because .dockerignore leaves .git out of the build context and `git describe` inside the build only ever produced `dev`. A build that passes no argument, such as script/cibuild, still reports `dev`. `logger.Identify`, which logs `starting` with the version, was never called; `main` now calls it first, so the version is in the startup log. Model: opus-5-5
47 lines
836 B
Makefile
47 lines
836 B
Makefile
.PHONY: all bootstrap setup build lint fmt fmt-check test check clean hooks docker
|
|
|
|
BINARY := dnswatcher
|
|
# `make build VERSION=...` overrides this; the Dockerfile does so, as the
|
|
# image has no .git to describe.
|
|
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
|
LDFLAGS := -X main.Version=$(VERSION)
|
|
|
|
# Standard targets are thin shims; the implementations live in script/
|
|
# per the scripts-to-rule-them-all pattern (see the Entrypoints section
|
|
# of README.md).
|
|
|
|
all: check build
|
|
|
|
bootstrap:
|
|
@script/bootstrap
|
|
|
|
setup:
|
|
@script/setup
|
|
|
|
build:
|
|
go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/dnswatcher
|
|
|
|
test:
|
|
@script/test
|
|
|
|
lint:
|
|
@script/lint
|
|
|
|
fmt:
|
|
@script/fmt
|
|
|
|
fmt-check:
|
|
@script/fmt-check
|
|
|
|
check:
|
|
@script/check
|
|
|
|
docker:
|
|
@script/docker
|
|
|
|
hooks:
|
|
@script/install-precommit
|
|
|
|
clean:
|
|
rm -rf bin/
|