mirror of
https://git.ipng.ch/ipng/golang-cli.git
synced 2026-06-15 15:25:51 +00:00
34 lines
969 B
Makefile
34 lines
969 B
Makefile
# SPDX-FileCopyrightText: (C) Copyright 2026 Pim van Pelt <[email protected]>
|
|||
|
|
# SPDX-License-Identifier: Apache-2.0
|
||
|
|
|
||
|
|
.PHONY: help all check test fixstyle vet lint build cross
|
||
|
|
|
||
|
|
help: ## Show this help
|
||
|
|
@printf "Usage: make <target>\n\nTargets:\n"
|
||
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
||
|
|
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
||
|
|
|
||
|
|
all: check ## Alias for check
|
||
|
|
|
||
|
|
check: fixstyle vet lint test ## Run the full pre-commit gate (format, vet, lint, test)
|
||
|
|
|
||
|
|
test: ## Run all Go unit tests
|
||
|
|
go test ./...
|
||
|
|
|
||
|
|
fixstyle: ## Format the Go tree (gofmt)
|
||
|
|
gofmt -w .
|
||
|
|
|
||
|
|
vet: ## Run go vet across the tree
|
||
|
|
go vet ./...
|
||
|
|
|
||
|
|
lint: ## Run golangci-lint across the Go tree
|
||
|
|
golangci-lint run ./...
|
||
|
|
|
||
|
|
build: ## Build all packages for the host platform
|
||
|
|
go build ./...
|
||
|
|
|
||
|
|
cross: ## Verify the tree builds on Linux and OpenBSD
|
||
|
|
GOOS=linux GOARCH=amd64 go build ./...
|
||
|
|
GOOS=linux GOARCH=arm64 go build ./...
|
||
|
|
GOOS=openbsd GOARCH=amd64 go build ./...
|