我正在尝试为我的项目创建一个仅嵌入文件集合的 Bazel 规则。嵌入规则如下:go_embed_data( name = "my_files_go", src = [ "embedded/src1", "embedded/src2" ], package = "my_lib", var = "myFiles",)然后我将其添加到我的 go_library 规则中:go_library( name = "library", srcs = [ "library.go", ], importpath = "github.com/nickfelker/golang-app", deps = [ ":my_files_go" "//otherLib", ],)但是,当我尝试构建它时,我最终得到了一个在其他地方找不到的模糊错误。Error: <target //library:my_files_go> (rule 'go_embed_data') doesn't contain declared provider 'GoArchive'ERROR: Analysis of target '//:binary' failed; build aborted: Analysis of target '//library:library' failed我应该如何解决这个错误?
1 回答
繁花如伊
TA贡献2012条经验 获得超12个赞
为其创建的规则go_embed_data不作为该go_library规则的依赖项。相反,它应该被视为其中之一srcs,如下所示:
go_embed_data(
name = "my_files_go",
src = [
"embedded/src1", "embedded/src2"
],
package = "my_lib",
var = "myFiles",
)
go_library(
name = "library",
srcs = [
":my_files_go",
"library.go",
],
importpath = "github.com/nickfelker/golang-app",
deps = [
"//otherLib",
],
)
- 1 回答
- 0 关注
- 114 浏览
添加回答
举报
0/150
提交
取消