grpcurl/Makefile

57 lines
876 B
Makefile

SRCS := $(shell find . -name '*.go')
PKGS := $(shell go list ./...)
.PHONY: all
all: lint test
.PHONY: install
install:
go install $(PKGS)
.PHONY: golint
golint:
go get github.com/golang/lint/golint
for file in $(SRCS); do \
golint $${file}; \
if [ -n "$$(golint $${file})" ]; then \
exit 1; \
fi; \
done
.PHONY: checkgofmt
checkgofmt:
gofmt -s -l $(SRCS)
if [ -n "$$(gofmt -s -l $(SRCS))" ]; then \
exit 1; \
fi
.PHONY: vet
vet:
go vet $(PKGS)
.PHONY:
errcheck:
go get github.com/kisielk/errcheck
errcheck $(PKGS)
.PHONY: staticcheck
staticcheck:
@go get honnef.co/go/tools/cmd/staticcheck
staticcheck $(PKGS)
.PHONY: unused
unused:
@go get honnef.co/go/tools/cmd/unused
unused $(PKGS)
.PHONY: lint
lint: golint checkgofmt vet errcheck staticcheck unused
.PHONY: test
test:
go test -race $(PKGS)
.PHONY: clean
clean:
go clean -i $(PKGS)