Files

52 lines
1.2 KiB
Makefile
Raw Permalink Normal View History

# yetano-clients is a library (atlassian/jira, atlassian/confluence):
# nothing to build or publish, only to check. A release is a git tag --
# see README.md, "Versioning".
.PHONY: all
all: ci
.PHONY: test
test:
go test ./... -race
.PHONY: fmt
fmt:
@out="$$(gofmt -l .)"; \
if [ -n "$$out" ]; then \
echo "not gofmt'ed:"; echo "$$out"; exit 1; \
fi
.PHONY: fmt-fix
fmt-fix:
gofmt -w .
.PHONY: vet
vet:
go vet ./...
# govulncheck at a pinned version via "go run" -- no global install. Not
# part of test on purpose: it needs network access to vuln.go.dev, and
# since that database changes daily, a check would start failing without
# any code change (see ../TODO.md "govulncheck in allen Go-Modulen").
GOVULNCHECK ?= go run golang.org/x/vuln/cmd/govulncheck@v1.9.0
.PHONY: vulncheck
vulncheck:
$(GOVULNCHECK) ./...
.PHONY: tidy
tidy:
go mod tidy
.PHONY: ci
ci: fmt vet test vulncheck
.PHONY: help
help:
@echo "Targets:"
@echo " ci fmt + vet + test + vulncheck (the default)"
@echo " fmt fail if a file is not gofmt'ed (fmt-fix rewrites them)"
@echo " vet go vet"
@echo " test go test -race"
@echo " vulncheck govulncheck $(subst go run ,,$(GOVULNCHECK))"
@echo " tidy go mod tidy"