Open toyokaku opened 3 years ago
go_library( name = "server", srcs = [ "server.go", ":hello_go_mock", ], importpath = "depot/codelab/hello/server", visibility = ["//visibility:public"], deps = [ "//codelab/proto/hello", "@com_github_golang_mock//gomock", "@org_golang_google_grpc//:go_default_library", ], ) gomock( name = "hello_go_mock", out = "hello_mock.go", interfaces = [ "HelloClient", "HelloServer", ], library = "//codelab/proto/hello", package = "server", )
other package needs this mock so I put it in go_library However after bazel run //:gazelle
bazel run //:gazelle
go_library( name = "server", srcs = [ "server.go", ":hello_go_mock", ], importpath = "depot/codelab/hello/server", visibility = ["//visibility:public"], deps = ["//codelab/proto/hello"], ) gomock( ... )
deps are gone and tests will fail I have to put # gazelle: ignore in the BUILD file that contains gomock()
Any option to generate file in the directory instead of bazel-bin?
Hm, I wonder if there's a way for bazel_gomock to convince gazelle to leave this alone without special casing. Generating a file to go into source hasn't, in the past, been the Bazel Go Way.
other package needs this mock so I put it in go_library However after
bazel run //:gazelle
deps are gone and tests will fail I have to put # gazelle: ignore in the BUILD file that contains gomock()
Any option to generate file in the directory instead of bazel-bin?