build: simplify make format, remove make formatcheck (#843)

This commit is contained in:
Christian Schwarz 2024-11-04 11:25:30 +01:00 committed by GitHub
parent f1608aba15
commit 98073c7dca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 10 deletions

View File

@ -198,7 +198,6 @@ jobs:
fi fi
# other checks # other checks
- run: make formatcheck
- run: make zrepl-bin test-platform-bin - run: make zrepl-bin test-platform-bin
- run: make vet - run: make vet
- run: make lint - run: make lint

View File

@ -4,9 +4,12 @@ linters:
- revive - revive
linters-settings: linters-settings:
goimports:
local-prefixes: github.com/zrepl/zrepl
revive: revive:
rules: rules:
- name: time-equal - name: time-equal
issues: issues:
exclude-rules: exclude-rules:
- path: _test\.go - path: _test\.go

View File

@ -320,7 +320,7 @@ cover-full:
##################### DEV TARGETS ##################### ##################### DEV TARGETS #####################
# not part of the build, must do that manually # not part of the build, must do that manually
.PHONY: generate formatcheck format .PHONY: generate format
build/install: build/install:
rm -rf build/install.tmp rm -rf build/install.tmp
@ -345,15 +345,9 @@ generate: build/install
true true
GOIMPORTS := goimports -srcdir . -local 'github.com/zrepl/zrepl' GOIMPORTS := goimports -srcdir . -local 'github.com/zrepl/zrepl'
FINDSRCFILES := find . -type f -name '*.go' -not -path "./vendor/*" -not -name '*.pb.go' -not -name '*_enumer.go'
formatcheck: format: build/install
@# goimports doesn't have a knob to exit with non-zero status code if formatting is needed @ build/install/gobin/goimports -w -local 'github.com/zrepl/zrepl' $$(find . -type f -name '*.go' -not -path "./vendor/*" -not -name '*.pb.go' -not -name '*_enumer.go')
@# see https://go-review.googlesource.com/c/tools/+/237378
@ affectedfiles=$$($(GOIMPORTS) -l $(shell $(FINDSRCFILES)) | tee /dev/stderr | wc -l); test "$$affectedfiles" = 0
format:
@ $(GOIMPORTS) -w -d $(shell $(FINDSRCFILES))
##################### NOARCH ##################### ##################### NOARCH #####################
.PHONY: noarch $(ARTIFACTDIR)/bash_completion $(ARTIFACTDIR)/_zrepl.zsh_completion $(ARTIFACTDIR)/go_env.txt docs docs-clean .PHONY: noarch $(ARTIFACTDIR)/bash_completion $(ARTIFACTDIR)/_zrepl.zsh_completion $(ARTIFACTDIR)/go_env.txt docs docs-clean