I'm using dep
to manage dependencies in my Go project.
I have a simple project in ~/go/src/github.com/my-repo/myproject
, with one file example.go
:
package main
import (
tcrypto "github.com/tendermint/go-crypto"
"github.com/tendermint/tendermint/types"
)
type ExampleSigner struct{}
// Implements types.Signer
func (signer ExampleSigner) Sign(msg []byte) tcrypto.Signature {
return tcrypto.Signature{}
}
// Implements types.Signer
func (signer ExampleSigner) PubKey() tcrypto.PubKey {
return tcrypto.PubKey{}
}
func main() {
mySigner := ExampleSigner{}
validator := types.LoadPrivValidator("foo")
validator.SetSigner(mySigner)
}
Running dep init
, then dep ensure
, then go install
works fine. (Running the code won't do anything meaningful - this is just enough code to reproduce the compilation error below).
Now, I want to use a modified version of github.com/tendermint/tendermint
, so per the documentation, I've removed the directory from ./vendor
and have a modified copy in my $GOPATH
:
~/go/src/github.com/tendermint/tendermint <---- (modified copy)
~/go/src/github.com/my-repo/myproject/vendor/github.com/tendermint/tendermint
^^^^^^^^^^
(I deleted this directory)
I now get the following compilation errors, assuming I've installed the tendermint/tendermint
dependencies using glide install
:
# github.com/my-repo/myproject
./example.go:25:21: cannot use mySigner (type ExampleSigner) as type "github.com/tendermint/tendermint/types".Signer in argument to validator.SetSigner:
ExampleSigner does not implement "github.com/tendermint/tendermint/types".Signer (wrong type for PubKey method)
have PubKey() "github.com/my-repo/myproject/vendor/github.com/tendermint/go-crypto".PubKey
want PubKey() "github.com/tendermint/tendermint/vendor/github.com/tendermint/go-crypto".PubKey
If I delete the ~/go/src/github.com/tendermint/tendermint/vendor
directory, I then get these errors instead:
../../tendermint/tendermint/types/events.go:5:2: cannot find package "github.com/tendermint/abci/types" in any of:
/usr/local/go/src/github.com/tendermint/abci/types (from $GOROOT)
/home/djones/go/src/github.com/tendermint/abci/types (from $GOPATH)
../../tendermint/tendermint/types/genesis.go:10:2: cannot find package "github.com/tendermint/go-crypto" in any of:
/usr/local/go/src/github.com/tendermint/go-crypto (from $GOROOT)
/home/djones/go/src/github.com/tendermint/go-crypto (from $GOPATH)
../../tendermint/tendermint/types/block.go:11:2: cannot find package "github.com/tendermint/go-wire" in any of:
/usr/local/go/src/github.com/tendermint/go-wire (from $GOROOT)
/home/djones/go/src/github.com/tendermint/go-wire (from $GOPATH)
../../tendermint/tendermint/types/block.go:12:2: cannot find package "github.com/tendermint/go-wire/data" in any of:
/usr/local/go/src/github.com/tendermint/go-wire/data (from $GOROOT)
/home/djones/go/src/github.com/tendermint/go-wire/data (from $GOPATH)
../../tendermint/tendermint/types/block.go:13:2: cannot find package "github.com/tendermint/tmlibs/common" in any of:
/usr/local/go/src/github.com/tendermint/tmlibs/common (from $GOROOT)
/home/djones/go/src/github.com/tendermint/tmlibs/common (from $GOPATH)
../../tendermint/tendermint/types/events.go:8:2: cannot find package "github.com/tendermint/tmlibs/events" in any of:
/usr/local/go/src/github.com/tendermint/tmlibs/events (from $GOROOT)
/home/djones/go/src/github.com/tendermint/tmlibs/events (from $GOPATH)
../../tendermint/tendermint/types/priv_validator.go:15:2: cannot find package "github.com/tendermint/tmlibs/log" in any of:
/usr/local/go/src/github.com/tendermint/tmlibs/log (from $GOROOT)
/home/djones/go/src/github.com/tendermint/tmlibs/log (from $GOPATH)
../../tendermint/tendermint/types/block.go:14:2: cannot find package "github.com/tendermint/tmlibs/merkle" in any of:
/usr/local/go/src/github.com/tendermint/tmlibs/merkle (from $GOROOT)
/home/djones/go/src/github.com/tendermint/tmlibs/merkle (from $GOPATH)
Is there any way to avoid these errors, without having to commit my modified tendermint/tendermint
to a repo somewhere and use source
in my Gopkg.toml
?