亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Bazel - BUILD 不引用外部依賴

Bazel - BUILD 不引用外部依賴

Go
泛舟湖上清波郎朗 2022-12-26 10:21:44
我正在嘗試使用 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'我正在用 gazelle 生成我的 BUILD 文件,它為 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 是由 gazelle 自動生成的:go_repository(    name = "org_golang_google_grpc",    importpath = "google.golang.org/grpc",    sum = "h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8=",    version = "v1.47.0",)我錯過了什么?
查看完整描述

1 回答

?
猛跑小豬

TA貢獻1858條經驗 獲得超8個贊

在 WORKSPACE 中,gazelle 生成的本地 go_repositories() 必須在 gazelle_dependencies() 之前調用,如果它不存在,它將定義一個古老版本的 org_golang_google_grpc,而新版本的本地 go_repository 將被靜默忽略。參考


查看完整回答
反對 回復 2022-12-26
  • 1 回答
  • 0 關注
  • 279 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號