-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
29 lines (22 loc) · 812 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
BINARIES := $(patsubst cmd/%,bin/%,$(wildcard cmd/*))
GOLANGCI-LINT-VRS := "1.42.0"
.PHONY: all clean test lint
all: $(BINARIES)
@echo "built all binaries"
lint:
@[ "$$($$(go env GOPATH)/bin/golangci-lint --version 2>/dev/null | awk '{print $$4}')" = "${GOLANGCI-LINT-VRS}" ] || \
curl -L -q https://install.goreleaser.com/github.com/golangci/golangci-lint.sh \
| sh -s -- -b $$(go env GOPATH)/bin v${GOLANGCI-LINT-VRS}
@$$(go env GOPATH)/bin/golangci-lint run -c .golangci.yaml
test: lint
@go vet ./...
@go test -v -coverprofile coverage.out ./...
@go tool cover -func=coverage.out
@go tool cover -html=coverage.out -o coverage.html
bin/%:
@CGO_ENABLED=0 go build -a -ldflags "-w -s" -v -o bin/$* cmd/$*/main.go
@upx bin/$*
release:
@goreleaser release --rm-dist
clean:
@git clean -xdf