Makefile: fmt, vet, test, vulncheck, ci
The library has nothing to build; the Makefile only checks, with govulncheck pinned like in the programs (go run ...@v1.9.0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
840e4e96e3
commit
7d5feb21a1
2 files changed
+58
No files matched your search
@@ -0,0 +1,52 @@
|
||||
# yetano-webui-template is a library (package layout): nothing to build or
|
||||
# publish, only to check. A release is a git tag -- see README.md,
|
||||
# "Versioning note".
|
||||
|
||||
.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"
|
||||
Reference in new issue
Block a user