-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add update-mocks Makefile target #1794
Conversation
The new `update-mocks` Make target allows us to generate the mocks with preserving the boilerplate header. Signed-off-by: Sascha Grunert <[email protected]>
update-mocks: ## Update all generated mocks | ||
go generate ./... | ||
for f in $(shell find . -name fake_*.go); do \ | ||
cp hack/boilerplate/boilerplate.go.txt tmp ;\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the files that we set the //go:generate...
we can add
//go:generate /usr/bin/env bash -c "cat ../../hack/boilerplate/boilerplate.go.txt service_mock.go > _service_mock.go && mv _service_mock.go service_mock.go"
so that will add the headers as well when we run the go generate ./...
wdty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'm not sure if I prefer moving the complexity directly into the go generate
invocation. We also have this discussion open around that: maxbrunsfeld/counterfeiter#98
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, not a problem :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cpanato, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
The new
update-mocks
Make target allows us to generate the mocks withpreserving the boilerplate header.
Which issue(s) this PR fixes:
None
Special notes for your reviewer:
None
Does this PR introduce a user-facing change?