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

Build constraints in generated files #190

Closed
ARR4N opened this issue Jul 5, 2024 · 2 comments · Fixed by #191
Closed

Build constraints in generated files #190

ARR4N opened this issue Jul 5, 2024 · 2 comments · Fixed by #191
Assignees
Labels
enhancement New feature or request

Comments

@ARR4N
Copy link
Contributor

ARR4N commented Jul 5, 2024

Requested feature The ability to specify build constraints to be added with //go:build <constraints> in the generated files.

Why the feature is needed Generated mocks are intended for testing but are regularly in non _test.go files to allow for cross-package imports. This risks the leakage of test-only code into production, which can easily be prevented with build constraints (example).

(Optional) Proposed solution #191

@jaceee
Copy link

jaceee commented Aug 30, 2024

+1
I really need this. Thanks for the PR too, that's exactly what I need.

@Gris87
Copy link

Gris87 commented Sep 18, 2024

+1
We need it too

@sywhang sywhang added the enhancement New feature or request label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants