我试着用bazel运行一些grpc测试。我正在使用"google.golang.org/grpc/credentials/insecure"不安全地拨号。
在运行bazel test ...时,我会得到以下错误:
no such package '@org_golang_google_grpc//credentials/insecure': BUILD file not found in directory 'credentials/insecure' of external repository @org_golang_google_grpc. Add a BUILD file to a directory to mark it as a package. and referenced by '//go/internal/handlers/helloworld:helloworld_test'我正在用瞪羚生成我的构建文件,它为go_test输出这个
go_test(
name = "helloworld_test",
srcs = ["helloworld_test.go"],
deps = [
":helloworld",
"//protos/helloworld",
"@com_github_stretchr_testify//assert",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//credentials/insecure",
"@org_golang_google_grpc//test/bufconn",
"@org_uber_go_zap//:zap",
"@org_uber_go_zap//zaptest",
],
)我的go.mod文件包含dep:google.golang.org/grpc v1.47.0
我的deps.bzl是由瞪羚自动生成的:
go_repository(
name = "org_golang_google_grpc",
importpath = "google.golang.org/grpc",
sum = "h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8=",
version = "v1.47.0",
)我遗漏了什么?
发布于 2022-06-28 11:56:32
在工作区中,由gazelle生成的本地go_repositories()必须在gazelle_dependencies()之前调用,如果org_golang_google_grpc还不存在,它将定义一个古老的org_golang_google_grpc版本,并且更新版本的本地go_repository将被忽略。参考文献
https://stackoverflow.com/questions/72677834
复制相似问题