mockguard
checks if mockgen is used in conventional filename and options.
mockguard
provides default convention. Please see config.go
You can overwrite via commandline option or golangci setting.
- FileName
- Content
$ go install github.com/cloverrose/mockguard/cmd/mockguard@latest
$ go build -o bin/ ./cmd/...
$ go vet -vettool=`which mockguard` ./...
When you specify config
go vet -vettool=`which mockguard` \
-mockguard.FileName=types.go \
-mockguard.Content='//go:generate mockgen -source=$GOFILE -package=$GOPACKAGE --destination=mock_$GOFILE' \
./...
https://golangci-lint.run/plugins/module-plugins/
Here are reference settings
.custom-gcl.yml
version: v1.62.0
plugins:
- module: 'github.com/cloverrose/mockguard'
import: 'github.com/cloverrose/mockguard'
version: v0.1.0
.golangci.yml
linters-settings:
custom:
mockguard:
type: "module"
description: check mockgen usage.
settings:
FileName: types.go
Content: "//go:generate mockgen -source=$GOFILE -package=$GOPACKAGE --destination=mock_$GOFILE"