Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
frantjc committed Oct 30, 2022
1 parent ffc1693 commit 6151b3e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
run:
timeout: 5m
linters:
enable:
- depguard
- dupl
- exportloopref
- gocyclo
- gosec
- gocritic
- goconst
- importas
- megacheck
- nakedret
- nolintlint
- prealloc
- revive
- unconvert
# test
- tenv
- testpackage
- thelper
# auto-fix
- godot
- gofmt
- goimports
- misspell
# pass locally but not as a part of
# uses: golangci/golangci-lint-action@v3.2.0
# - gofumpt
# - whitespace
# disabled because of go 1.18
# track support at
# https://github.com/golangci/golangci-lint/issues/2649
disable:
- structcheck
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/frantjc/pre-commit-hooks
rev: v1.0.0
hooks:
- id: go-fmt
- id: golangci-lint
- id: go-build
- id: go-test
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: check-yaml
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: end-of-file-fixer
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
GO = go
GOLANGCI-LINT = golangci-lint
DOCKER = docker
INSTALL = sudo install

Expand Down Expand Up @@ -30,7 +31,7 @@ build:
-o ./bin \
./cmd/addendum

image img:
image img:
@$(DOCKER) build -t $(IMAGE) $(BUILD_ARGS) .

fmt vet test:
Expand All @@ -39,8 +40,12 @@ fmt vet test:
download vendor verify:
@$(GO) mod $@

lint:
@$(GOLANGCI-LINT) run --fix

.PHONY: \
install \
image img \
fmt vet test \
vendor verify
download vendor verify \
lint

0 comments on commit 6151b3e

Please sign in to comment.