File size: 503 Bytes
2e6b65c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
GOPATH=$(shell go env GOPATH)
GOLANGCI_LINT=$(GOPATH)/bin/golangci-lint

.PHONY: lint lint-fix lint-install lint-precommit

lint-install:
	go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

lint:
	$(GOLANGCI_LINT) run ./...

lint-fix:
	$(GOLANGCI_LINT) run --fix ./...

# Pre-commit hook
lint-precommit:
	@echo "#!/bin/sh" > .git/hooks/pre-commit
	@echo '$(GOLANGCI_LINT) run --fast ./...' >> .git/hooks/pre-commit
	@chmod +x .git/hooks/pre-commit
	@echo "Pre-commit hook installed"