Makefile (758B)
1 ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort) 2 EXAMPLE_GO_MOD_DIRS := $(shell find ./example/ -type f -name 'go.mod' -exec dirname {} \; | sort) 3 4 test: 5 set -e; for dir in $(ALL_GO_MOD_DIRS); do \ 6 echo "go test in $${dir}"; \ 7 (cd "$${dir}" && \ 8 go test && \ 9 env GOOS=linux GOARCH=386 go test && \ 10 go vet); \ 11 done 12 13 go_mod_tidy: 14 set -e; for dir in $(ALL_GO_MOD_DIRS); do \ 15 echo "go mod tidy in $${dir}"; \ 16 (cd "$${dir}" && \ 17 go get -u ./... && \ 18 go mod tidy -go=1.19); \ 19 done 20 21 fmt: 22 gofmt -w -s ./ 23 goimports -w -local github.com/uptrace/bun ./ 24 25 run-examples: 26 set -e; for dir in $(EXAMPLE_GO_MOD_DIRS); do \ 27 echo "go run . in $${dir}"; \ 28 (cd "$${dir}" && go run .); \ 29 done