go-ipfs-log icon indicating copy to clipboard operation
go-ipfs-log copied to clipboard

Example doesn't work

Open Murphy-hub opened this issue 2 years ago • 1 comments

Example doesn't work

There is no Peerstore struct in github.com/libp2p/go-libp2p-peerstore

Murphy-hub avatar May 16 '22 08:05 Murphy-hub

Yep, and it seems a bit odd that the example has a _test suffix. It would be nice to have an example that can be built as a standalone tool, to add entries to a log one-by-one, and to list the whole log, depending on command-line args; or something like that.

$ go test example/example_log_append_test.go 
# command-line-arguments [command-line-arguments.test]
example/example_log_append_test.go:25:67: undefined: "github.com/libp2p/go-libp2p-peerstore".Peerstore
example/example_log_append_test.go:26:38: too many arguments in call to "github.com/ipfs/go-ipfs/core/node/libp2p".DefaultHostOption
example/example_log_append_test.go:80:15: undefined: "github.com/libp2p/go-libp2p-peerstore".PeerInfo
example/example_log_append_test.go:108:38: not enough arguments in call to identityprovider.CreateIdentity
        have (*identityprovider.CreateIdentityOptions)
        want (context.Context, *identityprovider.CreateIdentityOptions)
example/example_log_append_test.go:119:38: not enough arguments in call to identityprovider.CreateIdentity
        have (*identityprovider.CreateIdentityOptions)
        want (context.Context, *identityprovider.CreateIdentityOptions)
FAIL    command-line-arguments [build failed]
FAIL

I was trying to write something similar to the example, as an ipfs client rather than trying to link all of ipfs into it (because I always have the standard version of ipfs daemon running on my desktop machine). I'm not getting very far with that yet, either. It seems that because you use coreapi, the only client library that will work is go-ipfs-http-api, not the old github.com/ipfs/go-ipfs-api right? But it claims to be less stable than the old one. It would be nice to have an example that acts as a client to the ipfs daemon that is already running. (Yes I know that's not what you want for Berty itself, on a phone.) (And I do keep wondering if I am thinking wrong: is it not appropriate for ipfs to be a standard system service? Why does everyone keep duplicating server code into applications? It seems to me that most ipfs-using desktop applications should be clients. OTOH maybe the HTTP API is too much overhead for anything substantial?)

Anyway if I try to build either my example, or a copy of yours (renamed to be an example rather than a test), I get some problems with outdated stuff getting pulled in somehow:

# github.com/lucas-clemente/quic-go/internal/qtls
../../../src/go/pkg/mod/github.com/lucas-clemente/[email protected]/internal/qtls/go118.go:6:13: cannot use "quic-go doesn't build on Go 1.18 yet." (untyped string constant) as int value in variable declaration
# github.com/ipfs/go-ipfs/blocks/blockstoreutil
../../../src/go/pkg/mod/github.com/ipfs/[email protected]/blocks/blockstoreutil/remove.go:57:54: undefined: blockstore.ErrNotFound
# github.com/ipfs/go-filestore
../../../src/go/pkg/mod/github.com/ipfs/[email protected]/filestore.go:120:39: undefined: blockstore.ErrNotFound
../../../src/go/pkg/mod/github.com/ipfs/[email protected]/filestore.go:131:18: undefined: blockstore.ErrNotFound
../../../src/go/pkg/mod/github.com/ipfs/[email protected]/filestore.go:132:25: undefined: blockstore.ErrNotFound
../../../src/go/pkg/mod/github.com/ipfs/[email protected]/filestore.go:133:22: undefined: blockstore.ErrNotFound
../../../src/go/pkg/mod/github.com/ipfs/[email protected]/filestore.go:148:18: undefined: blockstore.ErrNotFound
../../../src/go/pkg/mod/github.com/ipfs/[email protected]/filestore.go:162:18: undefined: blockstore.ErrNotFound
../../../src/go/pkg/mod/github.com/ipfs/[email protected]/fsrefstore.go:106:21: undefined: blockstore.ErrNotFound
../../../src/go/pkg/mod/github.com/ipfs/[email protected]/fsrefstore.go:151:26: undefined: blockstore.ErrNotFound
../../../src/go/pkg/mod/github.com/ipfs/[email protected]/util.go:264:49: undefined: blockstore.ErrNotFound
  • the latest quic-go is 0.27 and no longer has that issue, but I don't understand how 0.24 becomes a dependency
  • the latest go-filestore is 1.2.0; ErrNotFound comes from a different module now (ipld?) but that should be ok in the newest versions of everything

ec1oud avatar May 29 '22 15:05 ec1oud

Hello @Murphy-hub . We are reviewing old issues and came across this question. Are you still working on this project?

jefft0 avatar Feb 16 '24 15:02 jefft0

Closing as inactive.

jefft0 avatar Mar 08 '24 08:03 jefft0