我有一个我试图供应的软件包。它使用capnproto2包。当包在$ GOPATH / src / zombiezen.com / go / capnproto2下时,它会构建没有错误,但是当我将它移动到我的供应商目录时失败。我的项目位于我的GOPATH之下。
$ go build
../fram/rim/fsd.go:7:8: cannot find package "zombiezen.com/go/capnproto2" in any of:
/home/mjohn/software/go/src/zombiezen.com/go/capnproto2 (from $GOROOT)
/home/mjohn/workspace/gopath/src/zombiezen.com/go/capnproto2 (from $GOPATH)
../fram/rim/schema.capnp.go:7:2: cannot find package "zombiezen.com/go/capnproto2/encoding/text" in any of:
/home/mjohn/software/go/src/zombiezen.com/go/capnproto2/encoding/text (from $GOROOT)
/home/mjohn/workspace/gopath/src/zombiezen.com/go/capnproto2/encoding/text (from $GOPATH)
../fram/rim/schema.capnp.go:8:2: cannot find package "zombiezen.com/go/capnproto2/schemas" in any of:
/home/mjohn/software/go/src/zombiezen.com/go/capnproto2/schemas (from $GOROOT)
/home/mjohn/workspace/gopath/src/zombiezen.com/go/capnproto2/schemas (from $GOPATH)
我的环境:
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mjohn/workspace/gopath"
GORACE=""
GOROOT="/home/mjohn/software/go"
GOTOOLDIR="/home/mjohn/software/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build069056451=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
我的项目布局
$ pwd
/home/mjohn/workspace/gopath/src/mjohn/msg
$ ls
cmd/main.go
cmd/rpc.go
vendor/zombiezen.com/go/capnproto2
显然在capnproto2目录中有更多内容,但这是来自$ GOPATH / src / zombiezen.com / go / capnproto2的副本。
关于为什么去的任何想法都不能识别我的供应商目录?
谢谢。
答案 0 :(得分:2)
包mjohn/fram/rim
无法导入zombiezen.com/go/capnproto2
,但供应商目录位于mjohn/msg
包中。
您可以完整地提供商mjohn/fram/rim
,包括mjohn/msg
包中的依赖项,也可以在导入它的zombiezen.com/go/capnproto2
包中提供商mjohn/fram/rim
。