aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Abhinav Gupta <mail@abhinavg.net> 2023-04-29 11:48:57 -0700
committerGravatar GitHub <noreply@github.com> 2023-04-29 11:48:57 -0700
commit83efe3481a5c001ae37116e8a5b0240552fa6c04 (patch)
tree8e9f85e1b16baf46e65ff54f091a715020a9327c /Makefile
parent29d8e3f3835cc7543c390a8a8f5bdfd67bcd3c2d (diff)
downloadsally-83efe3481a5c001ae37116e8a5b0240552fa6c04.tar.gz
sally-83efe3481a5c001ae37116e8a5b0240552fa6c04.tar.zst
sally-83efe3481a5c001ae37116e8a5b0240552fa6c04.zip
ci: gofmt, golint => revive, update tools and actions (#87)
Fixes up the `make lint` target to also check that all files are properly gofmt-ed, replaces the deprecated `golint` check with `revive`, and sets up dependabot to also update tools and actions regularly.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 20 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 4b9b0cd..2bab362 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,13 @@
export GOBIN = $(shell pwd)/bin
export PATH := $(GOBIN):$(PATH)
-GOLINT = bin/golint
+GO_FILES = $(shell find . \
+ -path '*/.*' -prune -o \
+ '(' -type f -a -name '*.go' ')' -print)
+
+REVIVE = bin/revive
STATICCHECK = bin/staticcheck
+TOOLS = $(REVIVE) $(STATICCHECK)
TEST_FLAGS ?= -race
@@ -10,7 +15,15 @@ TEST_FLAGS ?= -race
all: lint install test
.PHONY: lint
-lint: golint staticcheck
+lint: gofmt revive staticcheck
+
+.PHONY: gofmt
+gofmt:
+ $(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX))
+ @gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true
+ @[ ! -s "$(FMT_LOG)" ] || \
+ (echo "gofmt failed. Please reformat the following files:" | \
+ cat - $(FMT_LOG) && false)
.PHONY: staticcheck
staticcheck: $(STATICCHECK)
@@ -19,12 +32,12 @@ staticcheck: $(STATICCHECK)
$(STATICCHECK): tools/go.mod
cd tools && go install honnef.co/go/tools/cmd/staticcheck
-.PHONY: golint
-golint: $(GOLINT)
- $(GOLINT) ./...
+.PHONY: revive
+revive: $(REVIVE)
+ $(REVIVE) -set_exit_status ./...
-$(GOLINT): tools/go.mod
- cd tools && go install golang.org/x/lint/golint
+$(REVIVE): tools/go.mod
+ cd tools && go install github.com/mgechev/revive
.PHONY: install
install: