lint: add golangci-lint

This commit is contained in:
Maxim Slipenko 2024-12-28 12:02:05 +03:00
parent 5d1d3d7c45
commit df87bfcc63
2 changed files with 32 additions and 0 deletions

26
.golangci.yml Normal file

@ -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

@ -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) \