lint: add golangci-lint
This commit is contained in:
		
							
								
								
									
										26
									
								
								.golangci.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										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
 | 
				
			||||||
							
								
								
									
										6
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								Makefile
									
									
									
									
									
								
							@@ -11,6 +11,8 @@ ZSH_COMPLETION := $(COMPLETIONS_DIR)/zsh
 | 
				
			|||||||
INSTALLED_BASH_COMPLETION := $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$(NAME)
 | 
					INSTALLED_BASH_COMPLETION := $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$(NAME)
 | 
				
			||||||
INSTALLED_ZSH_COMPLETION := $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_$(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
 | 
					.PHONY: build install clean clear uninstall check-no-root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
build: check-no-root $(BIN)
 | 
					build: check-no-root $(BIN)
 | 
				
			||||||
@@ -25,6 +27,10 @@ check-no-root:
 | 
				
			|||||||
		exit 1; \
 | 
							exit 1; \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# TODO: remove --tests=false
 | 
				
			||||||
 | 
					fmt:
 | 
				
			||||||
 | 
						$(GOLANGCI_LINT) run --fix --tests=false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
install: \
 | 
					install: \
 | 
				
			||||||
	$(INSTALED_BIN) \
 | 
						$(INSTALED_BIN) \
 | 
				
			||||||
	$(INSTALLED_BASH_COMPLETION) \
 | 
						$(INSTALLED_BASH_COMPLETION) \
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user