Skip to content
Snippets Groups Projects
Makefile 733 B

GOLANGCI_LINT_VERSION = v1.30.0
GOLANGCI_LINT_BIN = tools/bin/golangci-lint-$(GOLANGCI_LINT_VERSION)

help:  ## Display this help
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
		| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

$(GOLANGCI_LINT_BIN):
	mkdir -p tools/bin
	if (which curl) then \
		curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh; \
	else \
		wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh; \
	fi \
		| sh -s -- -b $$(go env GOPATH)/bin $(GOLANGCI_LINT_VERSION) \
	&& cp $$(go env GOPATH)/bin/golangci-lint $(GOLANGCI_LINT_BIN)

lint: $(GOLANGCI_LINT_BIN) ## Lint the files
	$(GOLANGCI_LINT_BIN) run