Skip to content
Snippets Groups Projects
Makefile 917 B
Newer Older
Christophe de Vienne's avatar
Christophe de Vienne committed
GOLANGCI_LINT_VERSION = v1.63.4
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 $(GOLANGCI_LINT_ARGS)

.PHONY: lint-fix
lint-fix: $(GOLANGCI_LINT_BIN) ## Lint & fix the files
	$(GOLANGCI_LINT_BIN) run --fix $(GOLANGCI_LINT_ARGS)
Axel Prel's avatar
Axel Prel committed

test:
	go test ./...