I’m trying to migrate a small bit of code to use go-libp2p-core
. After updating the imports and some types I get the following error:
# github.com/ipfs/go-bitswap/testnet
../../../../pkg/mod/github.com/ipfs/go-bitswap@v0.0.3/testnet/peernet.go:30:30: cannot use client (type "github.com/libp2p/go-libp2p-core/host".Host) as type "github.com/libp2p/go-libp2p-host".Host in argument to "github.com/ipfs/go-bitswap/network".NewFromIpfsHost:
"github.com/libp2p/go-libp2p-core/host".Host does not implement "github.com/libp2p/go-libp2p-host".Host (wrong type for ConnManager method)
have ConnManager() connmgr.ConnManager
want ConnManager() ifconnmgr.ConnManager
# github.com/libp2p/go-libp2p-autonat-svc
../../../../pkg/mod/github.com/libp2p/go-libp2p-autonat-svc@v0.0.2/svc.go:50:3: cannot use dialer (type "github.com/libp2p/go-libp2p-core/host".Host) as type "github.com/libp2p/go-libp2p-host".Host in field value:
"github.com/libp2p/go-libp2p-core/host".Host does not implement "github.com/libp2p/go-libp2p-host".Host (wrong type for ConnManager method)
have ConnManager() connmgr.ConnManager
want ConnManager() ifconnmgr.ConnManager
Corresponding changes can be found here: https://github.com/ChainSafe/gossamer/pull/158
It seems that github.com/ipfs/go-bitswap@v0.0.3
is rather outdated and does not have go-libp2p-core
. When I update it withgo get -u github.com/ipfs/go-bitswap
, it pulls the latest version (w/ go-libp2p-core
) and I get this:
# github.com/libp2p/go-libp2p/p2p/host/routed
../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.1.1/p2p/host/routed/routed.go:190:5: cannot use (*RoutedHost)(nil) (type *RoutedHost) as type host.Host in assignment:
*RoutedHost does not implement host.Host (missing EventBus method)
# github.com/libp2p/go-libp2p/p2p/host/basic
../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.1.1/p2p/host/basic/basic_host.go:85:5: cannot use (*BasicHost)(nil) (type *BasicHost) as type host.Host in assignment:
*BasicHost does not implement host.Host (missing EventBus method)
../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.1.1/p2p/host/basic/basic_host.go:151:32: cannot use h (type *BasicHost) as type host.Host in argument to identify.NewIDService:
*BasicHost does not implement host.Host (missing EventBus method)
../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.1.1/p2p/host/basic/basic_host.go:178:32: cannot use h (type *BasicHost) as type host.Host in argument to ping.NewPingService:
*BasicHost does not implement host.Host (missing EventBus method)
Could someone point me in the right direction?