bazel_gomock icon indicating copy to clipboard operation
bazel_gomock copied to clipboard

setting default package name when self_package is known

Open linzhp opened this issue 6 years ago • 3 comments
trafficstars

When self_package is passed, it is possible to infer package name parameter so users don't need to pass duplicate information

linzhp avatar Sep 23 '19 20:09 linzhp

Could you post the build target you're needing to use this in? I'm trying to figure out how this and #28 are operating differently

jmhodges avatar Oct 17 '19 03:10 jmhodges

I agree with https://github.com/jmhodges/bazel_gomock/pull/28#issuecomment-543095961, this PR is different from #28. This is more for convenience. If we know the full package path via self_package, the package name can be deduced from that for most cases. It allows us to do something like:

gomock(
    name = "private_mocks",
    out = "mocks.go",
    interfaces = [
        "test",
    ],
    library = ":go_default_library",
    self_package = "github.com/josmad/go_samples/mock_test",
)

Note that package attribute is missing, and the rule uses mock_test by default

linzhp avatar Oct 23 '19 05:10 linzhp

@jmhodges Any more concerns on this PR?

linzhp avatar Jan 07 '20 22:01 linzhp