Skip to content
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

Merged
merged 1 commit into from
Nov 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ local-image-run: ## Run a locally build image to use the tools of this repositor

##@ Dependencies

.SILENT: update-deps update-deps-go
.PHONY: update-deps update-deps-go
.SILENT: update-deps update-deps-go update-mocks
.PHONY: update-deps update-deps-go update-mocks

update-deps: update-deps-go ## Update all dependencies for this repo
echo -e "${COLOR}Commit/PR the following changes:${NOCOLOR}"
Expand All @@ -134,6 +134,15 @@ update-deps-go: ## Update all golang dependencies for this repo
$(MAKE) test-go-unit
./hack/update-all.sh

update-mocks: ## Update all generated mocks
go generate ./...
for f in $(shell find . -name fake_*.go); do \
cp hack/boilerplate/boilerplate.go.txt tmp ;\
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, not a problem :)

sed -i 's/YEAR/$(shell date +"%Y")/g' tmp ;\
cat $$f >> tmp ;\
mv tmp $$f ;\
done

##@ Helpers

.PHONY: help
Expand Down
16 changes: 16 additions & 0 deletions pkg/anago/anagofakes/fake_release_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pkg/anago/anagofakes/fake_release_impl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pkg/changelog/changelogfakes/fake_impl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 21 additions & 16 deletions pkg/kubepkg/kubepkgfakes/fake_impl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions pkg/mail/mailfakes/fake_apiclient.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions pkg/mail/mailfakes/fake_send_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions pkg/notes/notesfakes/fake_mo_diff.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading