From 1724d9fb2e130eec7e15d0d203a3860502386ca8 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 10 May 2022 18:13:14 +0200 Subject: [PATCH] add "lint" to Justfile --- Justfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Justfile b/Justfile index 3d23175..fac93d1 100644 --- a/Justfile +++ b/Justfile @@ -10,3 +10,17 @@ dev: build: CGO_ENABLED=0 go build -ldflags '-s -w' -v -o build/codeberg-pages-server ./ + +lint: tool-golangci tool-gofumpt + [ $(gofumpt -extra -l . | wc -l) != 0 ] && { echo 'code not formated'; exit 1; }; \ + golangci-lint run + +tool-golangci: + @hash golangci-lint> /dev/null 2>&1; if [ $? -ne 0 ]; then \ + ggo install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; \ + fi + +tool-gofumpt: + @hash gofumpt> /dev/null 2>&1; if [ $? -ne 0 ]; then \ + go install mvdan.cc/gofumpt@latest; \ + fi