ChainSafe / ChainSafe/gossamer
chore(mocks): re-arrange mocks to have less files
- Dominant language
- Go
- Stars
- 454
- Forks
- 144
- PR merge metrics
- No merged PRs in 30d
Description
## Task summary
Right now, our `//go:generate mock*` comments are spread in our codebase without consistency, and usually each write the generated Go mock to a unique file.
We should make mock generation consistent in our codebase and limit the number of mock files written, with the following, for each Go package:
1. Move all `//go:generate mock*` comments in a new file `mocks_generate_test.go`
2. Combine all Mockgen writing to a test file `//go:generate mockgen -destination=*_test.go` comments together as `//go:generate mockgen -destination=mocks_test.go -package $GOPACKAGE . Interface1,Interface2,...`
3. Combine all Mockgen writing to non test file `//go:generate mockgen -destination=*.go` comments together as `//go:generate mockgen -destination=mocks.go -package $GOPACKAGE . Interface1,Interface2,...`
Note mockery cannot be combined in the same `//go:generate` comment since you can only generate one particular mock per mockery call. Each `//go:generate mockery` comment should be kept as is and write to a separate unique mock file.
Contributor guide
Assessment
This issue has not been assessed yet.