uber-go / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
1.85k stars 106 forks source link

Build constraints in generated files #190

Open ARR4N opened 1 week ago

ARR4N commented 1 week ago

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