I have a package which I'm trying to vendorize. It uses the capnproto2 package. It builds without error when the package is under $GOPATH/src/zombiezen.com/go/capnproto2 but fails when I move it to my vendor directory. My project is located under my 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)
My environment:
$ 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"
My project layout
$ pwd
/home/mjohn/workspace/gopath/src/mjohn/msg
$ ls
cmd/main.go
cmd/rpc.go
vendor/zombiezen.com/go/capnproto2
Obviously there's more in the capnproto2 directory, but this was a copy from $GOPATH/src/zombiezen.com/go/capnproto2.
Any ideas on why go doesn't recognize my vendor directory?
Thank you.