-1

我正在使用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
└── github.com
    ├── dustin
    │   └── go-humanize
    ├── jaxxstorm
    │   └── flexvolume
    ├── kolyshkin
    │   └── goploop-cli
    └── urfave
        └── cli
            ├── altsrc
        └── autocomplete

11 个目录

但我的项目仍然忽略了供应商目录:

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

4

1 回答 1

0

真的很愚蠢,git repo 也需要在$GOPATH. 我将我的回购符号链接到$GOPATH/src/github.com/vendor/project并且一切正常。

于 2017-02-09T05:31:04.550 回答