gpt4 book ai didi

go - Bazel 没有将 BUILD 文件添加到外部依赖项

转载 作者:行者123 更新时间:2023-12-05 04:46:30 25 4
gpt4 key购买 nike

我有一个工作区,我在其中使用瞪羚生成我的 BUILD 文件,由于某种原因,com_github_ipfs_go_merkledag 依赖项在尝试解析它时破坏了构建 github.com/gogo/protobuf/gogoproto 依赖。设置和运行如下。

工作区:

# Declare indirect dependencies and init toolchains.
go_rules_dependencies()

go_register_toolchains(version = "1.16")

go_embed_data_dependencies()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")

rules_proto_dependencies()

rules_proto_toolchains()

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

gazelle_dependencies()

命令:

bazel run //:gazelle
bazel run //:gazelle -- update-repos -from_file=go.mod
bazel build //...

输出:

...
no such package '@com_github_ipfs_go_merkledag//github.com/gogo/protobuf/gogoproto':
BUILD file not found in directory 'github.com/gogo/protobuf/gogoproto' of external repository @com_github_ipfs_go_merkledag.
Add a BUILD file to a directory to mark it as a package. and referenced by '@com_github_ipfs_go_merkledag//pb:merkledag_pb_go_proto'
...

不确定这个问题的解决方案是什么?

最佳答案

将构建指令添加到 go_repository 以忽略

go_repository(
name = "com_github_ipfs_go_merkledag",
importpath = "github.com/ipfs/go-merkledag",
sum = "h1:ixNu/5MJSaT/Qs073T0/HsWKwnOoBgqSq1g+GaJIen0=",
version = "v0.4.0",
build_directives = [
"gazelle:proto disable",
],
)

关于go - Bazel 没有将 BUILD 文件添加到外部依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68776492/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com