英文:
Glide package manager usage
问题
我正在使用Glide来管理我的Golang依赖项,但是在尝试在干净的环境中构建我的项目时,vendor
目录被忽略了:
./glide install
[INFO] 正在下载依赖项,请稍候...
[INFO] --> 在本地找到所需的版本 github.com/dustin/go-humanize 7a41df006ff9af79a29f0ffa9c5f21fbe6314a2d!
[INFO] --> 在本地找到所需的版本 github.com/jaxxstorm/flexvolume b65378104ef0f49af77d6f73d87da7e78d0f8252!
[INFO] --> 在本地找到所需的版本 github.com/kolyshkin/goploop-cli 5365b446a713e31ac4f2026b05a6dac27bbdf21c!
[INFO] --> 在本地找到所需的版本 github.com/urfave/cli 0bdeddeeb0f650497d603c4ad7b20cfe685682f6!
[INFO] 正在设置引用。
[INFO] --> 为 github.com/kolyshkin/goploop-cli 设置版本为 5365b446a713e31ac4f2026b05a6dac27bbdf21c。
[INFO] --> 为 github.com/dustin/go-humanize 设置版本为 7a41df006ff9af79a29f0ffa9c5f21fbe6314a2d。
[INFO] --> 为 github.com/urfave/cli 设置版本为 0bdeddeeb0f650497d603c4ad7b20cfe685682f6。
[INFO] --> 为 github.com/jaxxstorm/flexvolume 设置版本为 b65378104ef0f49af77d6f73d87da7e78d0f8252。
[INFO] 正在导出已解析的依赖项...
[INFO] --> 导出 github.com/urfave/cli
[INFO] --> 导出 github.com/jaxxstorm/flexvolume
[INFO] --> 导出 github.com/dustin/go-humanize
[INFO] --> 导出 github.com/kolyshkin/goploop-cli
[INFO] 正在替换现有的供应商依赖项
所有的供应商依赖项都在这里
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: 找不到包"github.com/jaxxstorm/flexvolume",在以下任何位置都找不到:
/usr/lib/golang/src/github.com/jaxxstorm/flexvolume (来自$GOROOT)
/tmp/go/src/github.com/jaxxstorm/flexvolume (来自$GOPATH)
main.go:7:2: 找不到包"github.com/kolyshkin/goploop-cli",在以下任何位置都找不到:
/usr/lib/golang/src/github.com/kolyshkin/goploop-cli (来自$GOROOT)
/tmp/go/src/github.com/kolyshkin/goploop-cli (来自$GOPATH)
main.go:8:2: 找不到包"github.com/urfave/cli",在以下任何位置都找不到:
/usr/lib/golang/src/github.com/urfave/cli (来自$GOROOT)
/tmp/go/src/github.com/urfave/cli (来自$GOPATH)
我认为我不需要设置GOVENDOREXPERIMENT
,因为我正在使用go1.7.4
版本。
英文:
I'm using Glide to manage my golang dependencies, but when trying to build my project on a clean environment, the vendor
directory is being ignore:
./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
All the vendor deps are there
vendor
└── github.com
├── dustin
│   └── go-humanize
├── jaxxstorm
│   └── flexvolume
├── kolyshkin
│   └── goploop-cli
└── urfave
└── cli
├── altsrc
└── autocomplete
11 directories
but my project still ignores the vendor dir:
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)
I don't think I need to set GOVENDOREXPERIMENT
because I'm using go1.7.4
答案1
得分: 0
非常愚蠢,git仓库也需要在$GOPATH
中。我将我的仓库创建了一个符号链接到$GOPATH/src/github.com/vendor/project
,然后一切都正常工作了。
英文:
Very stupid really, the git repo also needs to be in the$GOPATH
. I symlinked my repo to $GOPATH/src/github.com/vendor/project
and everything worked.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论