diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..73263d0 --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +# main + +build: + go build -o bin/ ./cmd/... +.PHONY: build + +check: + go test -race ./... +.PHONY: check + +lint: tools/bin/golangci-lint + tools/bin/golangci-lint run ./... +.PHONY: lint + +# tools + +tools/bin/%: tools/src/%/pin.go tools/src/%/go.mod + cd $(<D) && GOOS= GOARCH= go build -o $(abspath $@) $$(sed -En 's,^import "(.*)".*,\1,p' pin.go) + +# go mod tidy + +goversion = 1.18 + +go-mod-tidy: +.PHONY: go-mod-tidy + +go-mod-tidy: go-mod-tidy/main +go-mod-tidy/main: + rm -f go.sum + go mod tidy -go $(goversion) -compat $(goversion) +.PHONY: go-mod-tidy/main + +go-mod-tidy: $(patsubst tools/src/%/go.mod,go-mod-tidy/tools/%,$(wildcard tools/src/*/go.mod)) +go-mod-tidy/tools/%: tools/src/%/go.mod + rm -f tools/src/$*/go.sum + cd tools/src/$* && go mod tidy -go $(goversion) -compat $(goversion) +.PHONY: go-mod-tidy/tools/% |