我们的项目使用go 标准项目布局。另外,我正在使用pre-commit.com中的 pre-commit-hooks 。
在此设置中,go-vet
抱怨:
go vet...................................................................Failed
- hook id: go-vet
- exit code: 1
no Go files in <main directory of the package>
这是因为由于项目布局,main.go
文件位于cmd/tool/main.go
.
我怎样才能解决这个问题?我不想禁用 go-vet ...
编辑:对不起,我没有意识到go vet
钩子不是来自 pre-commit.com 本身......
那是我的 .pre-commit-config.yaml:
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: git://github.com/dnephin/pre-commit-golang
rev: master
hooks:
- id: go-build
- id: go-critic
- id: go-cyclo
args: [-over=30]
- id: go-fmt
- id: go-imports
# - id: go-lint
- id: go-mod-tidy
# - id: go-unit-tests
- id: go-vet
# - id: golangci-lint
# - id: gometalinter
# - id: validate-toml
exclude: (^vendor/|_test.go$)