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

Allow adding headers to generated fakes #153

Merged
merged 1 commit into from
May 1, 2020

Conversation

hoegaarden
Copy link
Contributor

@hoegaarden hoegaarden commented Jan 20, 2020

When the -header flag is specified and is a valid file path, the
content of that file will be prepended to the generated fake. This is
useful for e.g. specify a licence header.

The header flag can be specified in the go:generate and the
counterfeiter:generate line or in both, where the later takes
precedence over the former.

This is an attempt to address #98 (comment).

)

const (
MaxHeaderBytes = 50 * 1024 // 50kb for the header should be enough?
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like an unnecessary optimization. At a minimum, I would want to make it so large as to be somewhat ridiculous.

When the `-header` flag is specified and is a valid file path, the
content of that file will be prepended to the generated fake. This is
useful for e.g. specify a licence header.

The header flag can be specified in the `go:generate` and the
`counterfeiter:generate` line or in both, where the later takes
precedence over the former.
@hoegaarden
Copy link
Contributor Author

@joefitzgerald I removed the limit on the header's size. /PTAL

@benmoss
Copy link

benmoss commented Apr 29, 2020

I just had to wrestle with the same problem and ended up hacking around the lack of this feature: https://github.com/benmoss/cluster-api/blob/3ff999ed3eabc2ad9976e024418a6d71455af19d/hack/add-mock-boilerplate.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants