go - Glide 包管理器的使用

标签 go glide-golang

我正在使用 Glide管理我的 golang 依赖项,但是当尝试在干净的环境中构建我的项目时,vendor 目录被忽略:

./glide install
[INFO]  Downloading dependencies. Please wait...
[INFO]  --> Found desired version locally github.com/dustin/go-humanize 7a41df006ff9af79a29f0ffa9c5f21fbe6314a2d!
[INFO]  --> Found desired version locally github.com/jaxxstorm/flexvolume b65378104ef0f49af77d6f73d87da7e78d0f8252!
[INFO]  --> Found desired version locally github.com/kolyshkin/goploop-cli 5365b446a713e31ac4f2026b05a6dac27bbdf21c!
[INFO]  --> Found desired version locally github.com/urfave/cli 0bdeddeeb0f650497d603c4ad7b20cfe685682f6!
[INFO]  Setting references.
[INFO]  --> Setting version for github.com/kolyshkin/goploop-cli to 5365b446a713e31ac4f2026b05a6dac27bbdf21c.
[INFO]  --> Setting version for github.com/dustin/go-humanize to 7a41df006ff9af79a29f0ffa9c5f21fbe6314a2d.
[INFO]  --> Setting version for github.com/urfave/cli to 0bdeddeeb0f650497d603c4ad7b20cfe685682f6.
[INFO]  --> Setting version for github.com/jaxxstorm/flexvolume to b65378104ef0f49af77d6f73d87da7e78d0f8252.
[INFO]  Exporting resolved dependencies...
[INFO]  --> Exporting github.com/urfave/cli
[INFO]  --> Exporting github.com/jaxxstorm/flexvolume
[INFO]  --> Exporting github.com/dustin/go-humanize
[INFO]  --> Exporting github.com/kolyshkin/goploop-cli
[INFO]  Replacing existing vendor dependencies

所有的 vendor 部门都在那里

vendor
└── github.com
    ├── dustin
    │   └── go-humanize
    ├── jaxxstorm
    │   └── flexvolume
    ├── kolyshkin
    │   └── goploop-cli
    └── urfave
        └── cli
            ├── altsrc
        └── autocomplete

11个目录

但我的项目仍然忽略 vendor 目录:

go build -o ploop main.go
    main.go:4:2: cannot find package "github.com/jaxxstorm/flexvolume" in any of:
        /usr/lib/golang/src/github.com/jaxxstorm/flexvolume (from $GOROOT)
        /tmp/go/src/github.com/jaxxstorm/flexvolume (from $GOPATH)
    main.go:7:2: cannot find package "github.com/kolyshkin/goploop-cli" in any of:
        /usr/lib/golang/src/github.com/kolyshkin/goploop-cli (from $GOROOT)
        /tmp/go/src/github.com/kolyshkin/goploop-cli (from $GOPATH)
    main.go:8:2: cannot find package "github.com/urfave/cli" in any of:
        /usr/lib/golang/src/github.com/urfave/cli (from $GOROOT)
        /tmp/go/src/github.com/urfave/cli (from $GOPATH)

我认为我不需要设置 GOVENDOREXPERIMENT 因为我正在使用 go1.7.4

最佳答案

真的很愚蠢,git 仓库也需要在 $GOPATH 中。我将我的 repo 符号链接(symbolic link)到 $GOPATH/src/github.com/vendor/project 并且一切正常。

关于go - Glide 包管理器的使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42126415/

相关文章:

go - 尝试在 golang 中使用 io.CopyN() 读取时客户端卡住了

go - 如何使用 go get 命令从 github 中提取包的旧分支

postgresql - 我如何在 gorm 1.20.0 中关闭数据库实例

go - 如何检查一行或字符串是否包含 Golang 中的模板变量?

loops - For 循环逻辑通过查看 future 的点值来标记一系列数据点的趋势类型

postgresql - 戈尔姆 : upsert not inserting proper values

go - 在golang中从另一个内部调用的模拟函数

go - 变量在 if 语句中不可访问。语言设计?

fork - 如何 fork 一个进程

go - 滑行更新失败 -> 无法将依赖项导出到 vendor 目录 : Error moving files: exit status 1. 输出 : Access is denied. 0 目录已移动