From 83967312e01edeee2f39d157d8a5c335f2c0932a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 15 Jun 2022 14:17:01 +0300 Subject: [PATCH] [#471] Tidy Makefile - Remove help target. Help target will always ignore variable targets, it is confusing. - Remove goimports from format target. Gofmt is enough. - Add linter image version variable. Signed-off-by: Alex Vanin --- Makefile | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 76fb77ed5..fc8228801 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ REPO ?= $(shell go list -m) VERSION ?= $(shell git describe --tags 2>/dev/null || cat VERSION 2>/dev/null || echo "develop") GO_VERSION ?= 1.17 +LINT_VERSION ?= 1.46.2 BINDIR = bin # Binaries to build @@ -15,7 +16,7 @@ REPO_BASENAME = $(shell basename `go list -m`) HUB_IMAGE ?= "nspccdev/$(REPO_BASENAME)" HUB_TAG ?= "$(shell echo ${VERSION} | sed 's/^v//')" -.PHONY: help all dep docker/ clean format test cover lint docker/lint image-push image dirty-image +.PHONY: all $(BINS) $(BINDIR) dep docker/ test cover format image image-push dirty-image lint docker/lint version clean protoc # Make all binaries all: $(BINS) @@ -64,8 +65,6 @@ cover: format: @echo "⇒ Processing gofmt check" @gofmt -s -w ./ - @echo "⇒ Processing goimports check" - @goimports -w ./ # Build clean Docker image image: dep @@ -102,22 +101,12 @@ docker/lint: -v `pwd`:/src \ -u `stat -c "%u:%g" .` \ --env HOME=/src \ - golangci/golangci-lint:v1.40 bash -c 'cd /src/ && make lint' + golangci/golangci-lint:v$(LINT_VERSION) bash -c 'cd /src/ && make lint' # Show current version version: @echo $(VERSION) -# Show this help prompt -help: - @echo ' Usage:' - @echo '' - @echo ' make ' - @echo '' - @echo ' Targets:' - @echo '' - @awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort -u - # Clean up clean: rm -rf $(BINDIR)