[#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 <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2022-06-07 20:10:23 +03:00 committed by Alex Vanin
parent 5baa2774d5
commit 40e86fbfd6
2 changed files with 4 additions and 21 deletions

View file

@ -3,6 +3,7 @@
REPO ?= $(shell go list -m) REPO ?= $(shell go list -m)
VERSION ?= $(shell git describe --tags --dirty --always) VERSION ?= $(shell git describe --tags --dirty --always)
GO_VERSION ?= 1.17 GO_VERSION ?= 1.17
LINT_VERSION ?= 1.46.2
BUILD ?= $(shell date -u --iso=seconds) BUILD ?= $(shell date -u --iso=seconds)
HUB_IMAGE ?= nspccdev/neofs-http-gw HUB_IMAGE ?= nspccdev/neofs-http-gw
@ -13,7 +14,7 @@ BINDIR = bin
DIRS = $(BINDIR) DIRS = $(BINDIR)
BINS = $(BINDIR)/neofs-http-gw 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 # Make all binaries
all: $(BINS) all: $(BINS)
@ -59,19 +60,11 @@ cover:
@go test -v -race ./... -coverprofile=coverage.txt -covermode=atomic @go test -v -race ./... -coverprofile=coverage.txt -covermode=atomic
@go tool cover -html=coverage.txt -o coverage.html @go tool cover -html=coverage.txt -o coverage.html
# Run all code formatters
fmts: fmt imports
# Reformat code # Reformat code
fmt: fmt:
@echo "⇒ Processing gofmt check" @echo "⇒ Processing gofmt check"
@GO111MODULE=on gofmt -s -w ./ @GO111MODULE=on gofmt -s -w ./
# Reformat imports
imports:
@echo "⇒ Processing goimports check"
@GO111MODULE=on goimports -w ./
# Build clean Docker image # Build clean Docker image
image: image:
@echo "⇒ Build NeoFS HTTP Gateway docker image " @echo "⇒ Build NeoFS HTTP Gateway docker image "
@ -107,22 +100,12 @@ docker/lint:
-v `pwd`:/src \ -v `pwd`:/src \
-u `stat -c "%u:%g" .` \ -u `stat -c "%u:%g" .` \
--env HOME=/src \ --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 # Print version
version: version:
@echo $(VERSION) @echo $(VERSION)
# Show this help prompt
help:
@echo ' Usage:'
@echo ''
@echo ' make <target>'
@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 up
clean: clean:
rm -rf vendor rm -rf vendor

View file

@ -30,7 +30,7 @@ Other notable make targets:
dep Check and ensure dependencies dep Check and ensure dependencies
image Build clean docker image image Build clean docker image
dirty-image Build dirty docker image with host-built binaries dirty-image Build dirty docker image with host-built binaries
fmts Run all code formatters fmt Format the code
lint Run linters lint Run linters
version Show current version version Show current version
``` ```