libp2p / go-libp2p-examples

Example libp2p applications
MIT License
338 stars 145 forks source link

Cannot build chat-with-rendezvous on Windows 10 #14

Closed Hixon10 closed 5 years ago

Hixon10 commented 5 years ago

Hello.

I completed these steps:

  1. go get -u -d github.com/libp2p/go-libp2p/...
  2. cd $GOPATH/src/github.com/libp2p/go-libp2p
  3. go get github.com/whyrusleeping/gx
  4. go get github.com/whyrusleeping/gx-go
  5. gx --verbose install --global
  6. gx-go rewrite
  7. cd $GOPATH/src/github.com/libp2p/go-libp2p-examples
  8. go get -t -d ./...
  9. cd $GOPATH/src/github.com/libp2p/go-libp2p-examples/chat-with-rendezvous
  10. go build chat.go

I have the following errors:

$GOPATH\src\github.com\libp2p\go-libp2p-examples\chat-with-rendezvous>go build chat.go
# command-line-arguments
.\chat.go:98:24: cannot use handleStream (type func("github.com/libp2p/go-libp2p-net".Stream)) as type "gx/ipfs/QmfDPh144WGBqRxZb1TGDHerbMnZATrHZggAPw7putNnBq/go-libp2p-net".StreamHandler in argument
to host.SetStreamHandler
.\chat.go:100:24: cannot use host (type "gx/ipfs/QmeA5hsqgLryvkeyqeQdvGDqurLkYi3XEPLZP3pzuBJXh2/go-libp2p-host".Host) as type "github.com/libp2p/go-libp2p-host".Host in argument to dht.New:
        "gx/ipfs/QmeA5hsqgLryvkeyqeQdvGDqurLkYi3XEPLZP3pzuBJXh2/go-libp2p-host".Host does not implement "github.com/libp2p/go-libp2p-host".Host (wrong type for Addrs method)
                have Addrs() []"gx/ipfs/QmYmsdtJ3HsodkePE3eU3TsCaP2YvPZJ4LoXnNkDE5Tpt7/go-multiaddr".Multiaddr
                want Addrs() []"github.com/multiformats/go-multiaddr".Multiaddr
.\chat.go:110:31: cannot use *peerinfo (type "github.com/libp2p/go-libp2p-peerstore".PeerInfo) as type "gx/ipfs/QmfAQMFpgDU2U4BXG64qVr8HSiictfWvkSBz7Y2oDj65st/go-libp2p-peerstore".PeerInfo in argument to host.Connect
.\chat.go:147:11: invalid operation: p.ID == host.ID() (mismatched types "github.com/libp2p/go-libp2p-peer".ID and "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer".ID)
.\chat.go:152:39: cannot use p.ID (type "github.com/libp2p/go-libp2p-peer".ID) as type "gx/ipfs/QmbNepETomvmXfz1X5pHNFD2QuPqnqi47dTd94QJWSorQ3/go-libp2p-peer".ID in argument to host.NewStream

$GOPATH\src\github.com\libp2p\go-libp2p-examples\chat-with-rendezvous>
raulk commented 5 years ago

@Hixon10 don't do a gx-go rewrite. That's only necessary if using gx for dependency version management. Try the following:

  1. cd $GOPATH/src/github.com/libp2p/go-libp2p
  2. gx-go uw (undoes rewrites)
  3. cd $GOPATH/src/github.com/libp2p/go-libp2p-examples/chat-with-rendezvous
  4. go build
  5. ./chat
Hixon10 commented 5 years ago

@raulk thank you! It works.