Skip to content

Commit 0a3bf62

Browse files
committed
Fix bazel_gomock ignores mockgen_args in archive mode
Fixes #264
1 parent 6a0445c commit 0a3bf62

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bazel/rules/gomock.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ def gomock(name, out, library = None, source_importpath = "", source = None, int
222222
package = package,
223223
self_package = self_package,
224224
mockgen_tool = mockgen_tool,
225+
mockgen_args = mockgen_args,
225226
copyright_file = copyright_file,
226227
mock_names = mock_names,
227228
**kwargs
@@ -239,6 +240,7 @@ def _gomock_archive_impl(ctx):
239240
args.add("-destination", ctx.outputs.out)
240241
args.add("-package", ctx.attr.package)
241242
args.add("-self_package", ctx.attr.self_package)
243+
args.add_all(ctx.attr.mockgen_args)
242244
args.add(ctx.attr.library[GoInfo].importpath)
243245
args.add_joined(ctx.attr.interfaces, join_with = ",")
244246

@@ -297,6 +299,10 @@ _gomock_archive = rule(
297299
executable = True,
298300
cfg = "exec",
299301
),
302+
"mockgen_args": attr.string_list(
303+
doc = "Additional arguments to pass to the mockgen tool",
304+
mandatory = False,
305+
),
300306
"use_underlying_names": attr.bool(
301307
doc = "Use alias underlying type names in generated mocks instead of the alias names directly",
302308
default = False,

0 commit comments

Comments
 (0)