go - Golang cannot find/use vendor folder -


does have clue why _in front of $gopath , $goroot when import github.com/juju/errors e.g.

repo structure

-$gopath/src/github.com/codelingo/lexicon/vendor -$gopath/src/github.com/codelingo/lexicon/codelingo/ast/go/src/main.go -$gopath/src/github.com/codelingo/lexicon/codelingo/ast/go/src/node/node.go 

main.go line number

1 package main 2 3 import ( 4   "encoding/json" 5   "fmt" 6   "os" 7   "strings" 8 9   "github.com/juju/errors" 10 11  "./key" 12  "./node" 13  "./parser" 14  "./property" 15  "./util" 16 ) // rest of main.go 

node.go line number

1 package node 2 3 import ( 4   "encoding/json" 5   "github.com/juju/errors" 6   "reflect" 7) //rest of node.go  $ go run main.go  node/node.go:5:2: cannot find package "_/home/jzhu/go/src/github.com/codelingo/lexicon/codelingo/ast/go/src/vendor/github.com/juju/errors" in of:     /usr/local/go/src/_/home/jzhu/go/src/github.com/codelingo/lexicon/codelingo/ast/go/src/vendor/github.com/juju/errors (from $goroot)     /home/jzhu/go/src/_/home/jzhu/go/src/github.com/codelingo/lexicon/codelingo/ast/go/src/vendor/github.com/juju/errors (from $gopath) 

the vendor folder contains above packages , main.go can use (e.g. import ("github.com/juju/errors")).

the vendor folder under $gopath (/home/jzhu/go)

note: there weird "_" in front of package path.

i expecting following looks vendor tree.

vendor/github.com/codelingo/lingo/service/server/service.go:10:2: cannot find package "github.com/codelingo/platform/controller/graphdb/query/result" in of:     /home/jzhu/go/src/github.com/codelingo/platform/vendor/github.com/codelingo/platform/controller/graphdb/query/result (vendor tree)     /home/jzhu/go/src/github.com/vendor/github.com/codelingo/platform/controller/graphdb/query/result     /usr/local/go/src/github.com/codelingo/platform/controller/graphdb/query/result (from $goroot)     /home/jzhu/go/src/github.com/codelingo/platform/controller/graphdb/query/result (from $gopath) 

environment:

$go env  goarch="amd64" gobin="" goexe="" gohostarch="amd64" gohostos="linux" goos="linux" gopath="/home/jzhu/go" gorace="" goroot="/usr/local/go" gotooldir="/usr/local/go/pkg/tool/linux_amd64" gccgo="gccgo" cc="gcc" gogccflags="-fpic -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build894537960=/tmp/go-build -gno-record-gcc-switches" cxx="g++" cgo_enabled="1" pkg_config="pkg-config" cgo_cflags="-g -o2" cgo_cppflags="" cgo_cxxflags="-g -o2" cgo_fflags="-g -o2" cgo_ldflags="-g -o2"  $ go version go version go1.8.3 linux/amd64  $ glide --version glide version 0.13.0-dev 

the solution use correct relative path package in import. e.g import "github.com/codelingo/lexicon/codelingo/ast/go/src/node" instead of import "./node" in main.go

https://github.com/masterminds/glide/issues/602


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -