我正在使用按顶级语言组织的 monorepo,因此所有 Go 模块都位于go存储库根目录中。我想设置一个指向go目录而不是存储库根目录的虚导入 URL,这样go/就不需要包含在导入路径中。
当前文件结构:
/
go/
module1/
module2/
所需的导入格式:
import (
"go.example.com/module1"
"go.example.com/module2"
)
目前可能但不希望:
import (
"go.example.com/go/module1"
"go.example.com/go/module2"
)
根据文档<meta>,元素的格式go.example.com应为以下形式:
<meta name="go-import" content="import-prefix vcs repo-root">
所以在这种情况下我会:
<meta name="go-import" content="go.example.com git github.com/example/repo">
这会将 后面的import-prefix路径转换为相对于存储库根目录的路径,以便在存储库中go.example.com/this/path查找this/path目录。相反,我希望路径相对于 repo 中的go目录而不是 repo root。
有没有什么办法可以告知go get后面的路径go.example.com应该是相对于github.com/example/repo/go而不仅仅是github.com/example/repo?
缥缈止盈
相关分类