From 40e86fbfd6daeb137dcda3acd92842dd7d9a8f13 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 7 Jun 2022 20:10:23 +0300 Subject: [PATCH] [#159] Tidy Makefile - Remove help target. Help target will always ignore variable targets, it is confusing. - Remove imports target. Go fmt is enough. Signed-off-by: Alex Vanin --- Makefile | 23 +++-------------------- README.md | 2 +- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 319b6ec..5d34aec 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ REPO ?= $(shell go list -m) VERSION ?= $(shell git describe --tags --dirty --always) GO_VERSION ?= 1.17 +LINT_VERSION ?= 1.46.2 BUILD ?= $(shell date -u --iso=seconds) HUB_IMAGE ?= nspccdev/neofs-http-gw @@ -13,7 +14,7 @@ BINDIR = bin DIRS = $(BINDIR) BINS = $(BINDIR)/neofs-http-gw -.PHONY: help all $(BINS) $(DIRS) docker/$(BINS) dep test cover fmts fmt imports image image-push dirty-image lint docker/lint version clean +.PHONY: all $(BINS) $(DIRS) docker/$(BINS) dep test cover fmt image image-push dirty-image lint docker/lint version clean # Make all binaries all: $(BINS) @@ -59,19 +60,11 @@ cover: @go test -v -race ./... -coverprofile=coverage.txt -covermode=atomic @go tool cover -html=coverage.txt -o coverage.html -# Run all code formatters -fmts: fmt imports - # Reformat code fmt: @echo "⇒ Processing gofmt check" @GO111MODULE=on gofmt -s -w ./ -# Reformat imports -imports: - @echo "⇒ Processing goimports check" - @GO111MODULE=on goimports -w ./ - # Build clean Docker image image: @echo "⇒ Build NeoFS HTTP Gateway docker image " @@ -107,22 +100,12 @@ docker/lint: -v `pwd`:/src \ -u `stat -c "%u:%g" .` \ --env HOME=/src \ - golangci/golangci-lint:v1.46.2 bash -c 'cd /src/ && make lint' + golangci/golangci-lint:v$(LINT_VERSION) bash -c 'cd /src/ && make lint' # Print 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 vendor diff --git a/README.md b/README.md index cbfa992..cf80699 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Other notable make targets: dep Check and ensure dependencies image Build clean docker image dirty-image Build dirty docker image with host-built binaries -fmts Run all code formatters +fmt Format the code lint Run linters version Show current version ```