|-- mySubpackage (You can create your own subpackages, too)
| |
| |-- foo.go
|
|-- vendor
|-- github.com
|
|-- Masterminds
|
|-- ... etc.
我改了一下,去掉了目录结构中的 myProject 文件夹,如下所示:
$GOPATH/src
|
|-- glide.yaml
|
|-- glide.lock
|
|-- main.go (Your main go code can live here)
|
|-- mySubpackage (You can create your own subpackages, too)
| |
| |-- foo.go
|
|-- vendor
|-- github.com
|
|-- Masterminds
|
|-- ... etc.
然后 go build 一直提示找不到相关的包(其实 glide 已经把它下载到 vendor 目录中了) 。
后来回过头看 “理解 Go 1.5 vendor”,里面有一段有关 Vendor 的英文介绍:
If there is a source directory d/vendor, then, when compiling a source file within the subtree rooted at d, import "p" is interpreted as import "d/vendor/p" if that exists.
When there are multiple possible resolutions,the most specific (longest) path wins.
The short form must always be used: no import path can contain “/vendor/” explicitly.
Import comments are ignored in vendored packages.