将 dep 用于 golang 时如何从供应商文件夹中排除内部依赖项
How to exclude internal dependencies from vendor folder when using dep for golang
我有一个项目依赖于内部 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/
我怎样才能从供应商目录中删除它们?
ignored = [
"gitlab.internal.com/vapi/goabc*",
"gitlab.internal.com/vapi/goxyz*"
]
成功了,之前我没有放置通配符和其他包导入迫使 dep 无论如何都要下载项目。
我有一个项目依赖于内部 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/ 我怎样才能从供应商目录中删除它们?
ignored = [
"gitlab.internal.com/vapi/goabc*",
"gitlab.internal.com/vapi/goxyz*"
]
成功了,之前我没有放置通配符和其他包导入迫使 dep 无论如何都要下载项目。