diff --git a/docs/go/extras/extras.md b/docs/go/extras/extras.md index 35a6ec30b2..f0fafc4946 100644 --- a/docs/go/extras/extras.md +++ b/docs/go/extras/extras.md @@ -77,7 +77,7 @@ go_embed_data_dependencies()
 gomock(name, library, out, source, interfaces, package, self_package, aux_files, mockgen_tool,
-       imports, copyright_file, mock_names)
+       imports, copyright_file, mock_names, kwargs)
 
Calls [mockgen](https://github.com/golang/mock) to generates a Go file containing mocks from the given library. @@ -102,5 +102,6 @@ If `source` is given, the mocks are generated in source mode; otherwise in refle | imports | dictionary of name-path pairs of explicit imports to use. See [mockgen's -imports](https://github.com/golang/mock#flags) for more information. | {} | | copyright_file | optional file containing copyright to prepend to the generated contents. See [mockgen's -copyright_file](https://github.com/golang/mock#flags) for more information. | None | | mock_names | dictionary of interface name to mock name pairs to change the output names of the mock objects. Mock names default to 'Mock' prepended to the name of the interface. See [mockgen's -mock_names](https://github.com/golang/mock#flags) for more information. | {} | +| kwargs |

-

| none | diff --git a/extras/gomock.bzl b/extras/gomock.bzl index e1fc93fda9..047171e2a6 100644 --- a/extras/gomock.bzl +++ b/extras/gomock.bzl @@ -150,7 +150,7 @@ _gomock_source = rule( toolchains = [GO_TOOLCHAIN], ) -def gomock(name, library, out, source = None, interfaces = [], package = "", self_package = "", aux_files = {}, mockgen_tool = _MOCKGEN_TOOL, imports = {}, copyright_file = None, mock_names = {}): +def gomock(name, library, out, source = None, interfaces = [], package = "", self_package = "", aux_files = {}, mockgen_tool = _MOCKGEN_TOOL, imports = {}, copyright_file = None, mock_names = {}, **kwargs): """Calls [mockgen](https://github.com/golang/mock) to generates a Go file containing mocks from the given library. If `source` is given, the mocks are generated in source mode; otherwise in reflective mode. @@ -168,6 +168,7 @@ def gomock(name, library, out, source = None, interfaces = [], package = "", sel imports: dictionary of name-path pairs of explicit imports to use. See [mockgen's -imports](https://github.com/golang/mock#flags) for more information. copyright_file: optional file containing copyright to prepend to the generated contents. See [mockgen's -copyright_file](https://github.com/golang/mock#flags) for more information. mock_names: dictionary of interface name to mock name pairs to change the output names of the mock objects. Mock names default to 'Mock' prepended to the name of the interface. See [mockgen's -mock_names](https://github.com/golang/mock#flags) for more information. + kwargs: common attributes](https://bazel.build/reference/be/common-definitions#common-attributes) to all Bazel rules. """ if source: _gomock_source( @@ -182,6 +183,7 @@ def gomock(name, library, out, source = None, interfaces = [], package = "", sel imports = imports, copyright_file = copyright_file, mock_names = mock_names, + **kwargs ) else: _gomock_reflect( @@ -195,6 +197,7 @@ def gomock(name, library, out, source = None, interfaces = [], package = "", sel imports = imports, copyright_file = copyright_file, mock_names = mock_names, + **kwargs ) def _gomock_reflect(name, library, out, mockgen_tool, **kwargs): diff --git a/tests/extras/gomock/BUILD.bazel b/tests/extras/gomock/BUILD.bazel index 5d807565cf..5b04496f7e 100644 --- a/tests/extras/gomock/BUILD.bazel +++ b/tests/extras/gomock/BUILD.bazel @@ -19,6 +19,7 @@ gomock( library = ":client", package = "client", source = "client.go", + visibility = ["//visibility:public"], ) go_test(