Open linzhp opened 5 years ago
Hm, I'm worried about this one because there's no way for folks to know what to include in their other targets to use this one.
Do you have any ideas on how to solve that?
The gomock rule can be feeded into a go_library rule like this:
gomock(
name = "rosetta_mock",
interfaces = ["Client"],
library = ":go_default_library",
package = "rosettamock",
)
go_library(
name = "go_mock_library",
srcs = [":rosetta_mock"],
importpath = "mock/go-rosetta/rosetta",
visibility = ["//visibility:public"],
deps = [
"@com_github_golang_mock//gomock:go_default_library",
],
)
Right! If we can get a README update in this patch, that'd be cool!
@jmhodges I updated the README. Can you take another look?
When the mocks are in they own package, the
gomock
rule can be feeded into ago_library
rule like this:In this case, the
out
parameter is not necessary. Furthermore, it will cause Gazelle to addmocks.go
intogo_default_library
unless we exclude it using# gazelle:exclude
explicitly. This PR sets a default value to theout
parameter, so we don't need to specify it when we don't use it directly.