gpt4 book ai didi

go - Bazel ** BUILD **文件中的 `importmap`和 `importpath`有什么区别

转载 作者:行者123 更新时间:2023-12-01 20:25:43 30 4
gpt4 key购买 nike

这两个声明在Golang项目 Bazel BUILD 文件中具有什么不同功能。

示例场景:

go_library(
name = "go_default_library",
srcs = [
"etcd.go",
"strategy.go",
],
importmap = "path_to_package",
importpath = "path_to_package",
deps = [
"//path_to_dependacy:go_default_library",
"//path_to_dependacy:go_default_library",
"//path_to_dependacy:go_default_library",
],
)

最佳答案

importpathtype: stringdefault: required value

The source import path of this library. Other libraries can import this library using this path. This must either be specified in go_library or inherited from one of the libraries in embed.


importmap type: string default: ""

The actual import path of this library. This is mostly only visible to the compiler and linker, but it may also be seen in stack traces. This may be set to prevent a binary from linking multiple packages with the same import path e.g., from different vendor directories.



资料来源: Bazel Docs

关于go - Bazel ** BUILD **文件中的 `importmap`和 `importpath`有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59019448/

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