Skip to content

Commit 5409769

Browse files
committed
Making "out" attribute optional
1 parent df17445 commit 5409769

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bazel/rules/gomock.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ _gomock_source = rule(
173173
toolchains = [GO_TOOLCHAIN],
174174
)
175175

176-
def gomock(name, out, library = None, source_importpath = "", source = None, interfaces = [], package = "", self_package = "", aux_files = {}, mockgen_tool = _MOCKGEN_TOOL, mockgen_args = [], imports = {}, copyright_file = None, mock_names = {}, **kwargs):
176+
def gomock(name, out="", library = None, source_importpath = "", source = None, interfaces = [], package = "", self_package = "", aux_files = {}, mockgen_tool = _MOCKGEN_TOOL, mockgen_args = [], imports = {}, copyright_file = None, mock_names = {}, **kwargs):
177177
"""Calls [mockgen](https://github.com/uber-go/mock) to generates a Go file containing mocks from the given library.
178178
179179
If `source` is given, the mocks are generated in source mode; otherwise in archive mode.
@@ -195,6 +195,8 @@ def gomock(name, out, library = None, source_importpath = "", source = None, int
195195
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/uber-go/mock#flags) for more information.
196196
kwargs: common attributes](https://bazel.build/reference/be/common-definitions#common-attributes) to all Bazel rules.
197197
"""
198+
if not out:
199+
out = name + ".go"
198200
if source:
199201
_gomock_source(
200202
name = name,

0 commit comments

Comments
 (0)