bazelbuild / rules_go

Go rules for Bazel
Apache License 2.0
1.37k stars 649 forks source link

No such attribute 'mockgen_model_library' in '_gomock_prog_exec' rule #3673

Closed yongruilin closed 1 year ago

yongruilin commented 1 year ago

What version of rules_go are you using?

0.39.1

What version of gazelle are you using?

0.26.0

What version of Bazel are you using?

Build label: 5.4.0

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

Debian GNU/Linux

Any other potentially useful information about your toolchain?

What did you do?

In the BUILD.bazel

load("@bazel_gomock//:gomock.bzl", "gomock")

gomock(
    name = "client",
    out = "client.go",
    interfaces = "api",
    library = "//pkg/controllers/common",
    package = "mocks,
    mockgen_model_library = "//vendor/github.com/golang/mock/mockgen/model",
    mockgen_tool = "//vendor/github.com/golang/mock/mockgen",
)

What did you expect to see?

Successfully generate mock go code.

What did you see instead?

 ERROR: no such attribute 'mockgen_model_library' in '_gomock_prog_exec' rule
yongruilin commented 1 year ago

I think the bug is that https://github.com/bazelbuild/rules_go/blob/master/extras/gomock.bzl#L232 rule _gomock_prog_exec should not pass in the **kwargs. Or we pop the "mockgen_model_library" here https://github.com/bazelbuild/rules_go/blob/master/extras/gomock.bzl#L207. I can submit a PR to fix it if needed.