我有一个项目依赖于内部 git 存储库中的另外两个项目。它已经存在于 GOPATH 中。
我面临的问题是,dep-init -gopath
仍会复制 vendor/目录下的那些项目。
因此,我使用的 GoLand IDE 很困惑从哪里解决依赖关系。 (我希望它从 GOPATH 而不是 Vendor 目录解析)如果我删除 vendor/目录,程序将运行。
我的 Gopkg.toml 文件如下所示:
[[constraint]]
branch = "master"
name = "github.com/sirupsen/logrus"
[[constraint]]
branch = "master"
name = "github.com/stretchr/testify"
[[constraint]]
branch = "master"
name = "gitlab.internal.com/vapi/goabc"
[[constraint]]
branch = "master"
name = "gitlab.internal.com/vapi/goxyz"
[prune]
go-tests = true
unused-packages = true
在哪里
"gitlab.internal.com/vapi/goabc"
和 "gitlab.internal.com/vapi/goxyz"
是这个项目依赖的内部项目。
我尝试将依赖项添加到忽略列表 [ https://golang.github.io/dep/docs/Gopkg.toml.html#ignored]
但是goxyz和goabc还是下载到了vendor/ 我怎样才能从 vendor 目录中删除它们?
最佳答案
ignored = [
"gitlab.internal.com/vapi/goabc*",
"gitlab.internal.com/vapi/goxyz*"
]
成功了,之前我没有放置通配符和其他包导入迫使 dep 无论如何都要下载项目。
关于go - 将 dep 用于 golang 时如何从 vendor 文件夹中排除内部依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55336907/