Closed josmad closed 4 years ago
Could you post the build target you're using this in? I'm trying to figure out how this and #26 are operating differently
As far as I can tell, the other PR extracts the package name of the mock from the fully qualified package name provided in the self_package
option. This PR propagates the self_package
option in source mode. The Bazel plugin already propagated the self_package
option in reflect mode, I guess the author of the original PR forgot to add it for source mode.
Bazel gomock stanza:
gomock(
name = "private_mocks",
out = "mocks.go",
interfaces = [
"test",
],
library = ":go_default_library",
package = "mock_test",
self_package = "github.com/josmad/go_samples/mock_test",
source = "sample.go",
)
Some of my packages generates mocks from unexported interfaces (requires source mode) and use the mocks for tests. Propagating
self_package
is necessary to avoid errors like