BINARY := drive-health-metrics # VERSION is the single source of truth for the version string. COMMIT and DATE # are derived from git and the build clock. VERSION ?= $(shell cat VERSION 2>/dev/null || echo dev) COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null) DATE := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ') LDFLAGS := -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE) .PHONY: all build test vet fmt snapshot release clean tools all: test build ## build: native static binary into dist/ build: CGO_ENABLED=0 go build -trimpath -ldflags '$(LDFLAGS)' -o dist/$(BINARY) . ## test: run the unit tests (smartctl/text/NVMe/MegaCLI parsers + scoring) test: go test ./... vet: go vet ./... fmt: gofmt -w *.go ## snapshot: local GoReleaser build without publishing (artifacts in dist/) snapshot: goreleaser release --snapshot --clean ## release: full GoReleaser release (CI runs this on a tag) release: goreleaser release --clean clean: rm -rf dist