Add make fmt to pre-commit

This commit is contained in:
David Dworken 2024-08-11 12:26:09 -07:00
parent 8da11eb3fa
commit c93fcbb8e2
No known key found for this signature in database
3 changed files with 7 additions and 4 deletions

View File

@ -2,11 +2,8 @@ repos:
- repo: https://github.com/Bahjat/pre-commit-golang
rev: a4be1d0f860565649a450a8d480e541844c14a07
hooks:
- id: go-fmt-import
- id: go-vet
- id: gofumpt # requires github.com/mvdan/gofumpt
- id: go-static-check # install https://staticcheck.io/docs/
exclude: /vndor/
- id: golangci-lint # requires github.com/golangci/golangci-lint
- repo: local
hooks:
@ -15,3 +12,8 @@ repos:
entry: errcheck -exclude .errcheck_excludes.txt ./...
language: system
pass_filenames: false
- id: make-fmt # requires 'go install mvdan.cc/gofumpt@latest' and 'go install github.com/daixiang0/gci@latest'
name: make-fmt
entry: make fmt
language: system
pass_filenames: false

View File

@ -1,7 +1,7 @@
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
fmt:
fmt: ## Format all files
gofumpt -l -w -extra .
gci write --custom-order -s standard -s 'Prefix(github.com/ddworken/hishtory)' -s default .

View File

@ -6,6 +6,7 @@ import (
"testing"
"github.com/ddworken/hishtory/shared/testutils"
"github.com/stretchr/testify/require"
)