@@ -5,35 +5,29 @@ all: build tidy lint fmt test
55# ------------------------------------------------------------------------
66env=CGO_ENABLED =1
77op = op run --env-file="./.env" --
8+ SHELL := $(shell which bash)
9+ fuzzsh =https://raw.githubusercontent.com/devnw/workflows/refs/heads/main/fuzz.sh
10+
11+ pre-commit : update upgrade tidy fmt lint build test
812
913test :
1014 CGO_ENABLED=1 go test -v -cover -failfast -race ./...
1115
1216fuzz :
13- @fuzzTime=$$ {FUZZ_TIME:-10}; \
14- files=$$(grep -r --include='**_test.go' --files-with-matches 'func Fuzz' . ) ; \
15- for file in $$ files; do \
16- funcs=$$(grep -o 'func Fuzz\w*' $$file | sed 's/func //' ) ; \
17- for func in $$ funcs; do \
18- echo " Fuzzing $$ func in $$ file" ; \
19- parentDir=$$(dirname $$file ) ; \
20- go test $$ parentDir -run=$$ func -fuzz=$$ func -fuzztime=$$ {fuzzTime}s; \
21- if [ $$ ? -ne 0 ]; then \
22- echo " Fuzzing $$ func in $$ file failed" ; \
23- exit 1; \
24- fi ; \
25- done ; \
26- done
17+ curl -fsSL $(fuzzsh ) | $(SHELL )
2718
2819bench :
2920 go test -bench=. -benchmem ./...
3021
3122test-all : test fuzz
3223
33- lint :
24+ fmt :
25+ nixfmt flake.nix
3426 goimports -w .
27+ gofmt -s -w .
28+
29+ lint :
3530 golangci-lint run
36- pre-commit run --all-files
3731
3832gomod2nix :
3933 gomod2nix generate
@@ -51,17 +45,11 @@ upgrade:
5145update :
5246 git submodule update --recursive
5347
54- fmt :
55- gofmt -s -w .
56-
5748tidy : fmt
5849 go mod tidy
5950
6051release :
61- if [ -z " $( tag) " ]; then \
62- echo " tag is required" ; \
63- exit 1; \
64- fi
52+ if [ -z " $( tag) " ]; then echo " tag is required" ; exit 1; fi
6553 git tag -a ${tag} -m " ${tag} "
6654 git push origin ${tag}
6755
@@ -102,4 +90,4 @@ FORCE:
10290# Phony targets
10391# -------------------------------------------------------------------------
10492
105- .PHONY : build test lint fuzz
93+ .PHONY : build test lint fuzz all clean FORCE
0 commit comments