使用 Glide - 供应商不工作
Go with Glide - vendor doesnt work
我正在使用 go version go1.10.3 darwin/amd64
和 glide version v0.13.1
项目位于 /Users/robopuff/Development/GoRethink
,它的树形如下:
.
├── glide.lock
├── glide.yaml
├── main.go
├── rethinkdb_data
│ ├── 001fbc34-bd63-445f-8590-709ac7475294
│ ├── log_file
│ ├── metadata
│ └── tmp
└── vendor
├── github.com
│ ├── cenkalti
│ │ └── backoff
│ ├── golang
│ │ └── protobuf
│ ├── hailocab
│ │ └── go-hostpool
│ ├── opentracing
│ │ └── opentracing-go
│ └── sirupsen
│ └── logrus
├── golang.org
│ └── x
│ ├── crypto
│ ├── net
│ └── sys
└── gopkg.in
├── fatih
│ └── pool.v2
└── gorethink
└── gorethink.v4
在运行go run main.go
之后我欢迎有一个错误
❯ go run main.go
main.go:7:2: cannot find package "gopkg.in/gorethink/gorethink.v4" in any of:
/usr/local/go/src/gopkg.in/gorethink/gorethink.v4 (from $GOROOT)
/Users/robopuff/go/src/gopkg.in/gorethink/gorethink.v4 (from $GOPATH)
不应该先去编译器看看vendor吗?
该问题的正确答案是通读 Docs, especially Workspaces 并理解它。
我正在使用 go version go1.10.3 darwin/amd64
和 glide version v0.13.1
项目位于 /Users/robopuff/Development/GoRethink
,它的树形如下:
.
├── glide.lock
├── glide.yaml
├── main.go
├── rethinkdb_data
│ ├── 001fbc34-bd63-445f-8590-709ac7475294
│ ├── log_file
│ ├── metadata
│ └── tmp
└── vendor
├── github.com
│ ├── cenkalti
│ │ └── backoff
│ ├── golang
│ │ └── protobuf
│ ├── hailocab
│ │ └── go-hostpool
│ ├── opentracing
│ │ └── opentracing-go
│ └── sirupsen
│ └── logrus
├── golang.org
│ └── x
│ ├── crypto
│ ├── net
│ └── sys
└── gopkg.in
├── fatih
│ └── pool.v2
└── gorethink
└── gorethink.v4
在运行go run main.go
之后我欢迎有一个错误
❯ go run main.go
main.go:7:2: cannot find package "gopkg.in/gorethink/gorethink.v4" in any of:
/usr/local/go/src/gopkg.in/gorethink/gorethink.v4 (from $GOROOT)
/Users/robopuff/go/src/gopkg.in/gorethink/gorethink.v4 (from $GOPATH)
不应该先去编译器看看vendor吗?
该问题的正确答案是通读 Docs, especially Workspaces 并理解它。