From df87bfcc6300eab65c70fb513444daa0b5af1b0a Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Sat, 28 Dec 2024 12:02:05 +0300 Subject: [PATCH] lint: add golangci-lint --- .golangci.yml | 26 ++++++++++++++++++++++++++ Makefile | 6 ++++++ 2 files changed, 32 insertions(+) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..396728b --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,26 @@ +run: + timeout: 5m + +linters-settings: + goimports: + local-prefixes: "plemya-x.ru/alr" + gofmt: + simplify: true + gofumpt: + extra-rules: true + +linters: + enable: + - gofmt + - gofumpt + - goimports + - gocritic + - govet + - staticcheck + - unused + - errcheck + - typecheck +# - forbidigo + +issues: + fix: true \ No newline at end of file diff --git a/Makefile b/Makefile index 91dc4d2..011c51d 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,8 @@ ZSH_COMPLETION := $(COMPLETIONS_DIR)/zsh INSTALLED_BASH_COMPLETION := $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$(NAME) INSTALLED_ZSH_COMPLETION := $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_$(NAME) +GOLANGCI_LINT := go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2 + .PHONY: build install clean clear uninstall check-no-root build: check-no-root $(BIN) @@ -25,6 +27,10 @@ check-no-root: exit 1; \ fi +# TODO: remove --tests=false +fmt: + $(GOLANGCI_LINT) run --fix --tests=false + install: \ $(INSTALED_BIN) \ $(INSTALLED_BASH_COMPLETION) \