Good tutorials for go-ipfs library

I cannot find good tutorial about creating repo + node by means ipfs in go. Also, it will be nice to find how to create a daemon by means go lib.

The world is going crazy… Only JS is everywhere :sob:

1 Like

I tried this tutorial and unfortunately I can’t make the code to work for me :cry:

I get these errors:

# github.com/multiformats/go-multiaddr-net
../../go/pkg/mod/github.com/multiformats/go-multiaddr-net@v0.2.0/registry.go:25:17: undefined: manet.NetCodec
../../go/pkg/mod/github.com/multiformats/go-multiaddr-net@v0.2.0/registry.go:29:2: undefined: manet.RegisterNetCodec
# github.com/libp2p/go-libp2p-noise
../../go/pkg/mod/github.com/libp2p/go-libp2p-noise@v0.2.0/handshake.go:202:40: s.LocalPublicKey().Bytes undefined (type "github.com/libp2p/go-libp2p-core/crypto".PubKey has no field or method Bytes)
# github.com/ipfs/go-ipns
../../go/pkg/mod/github.com/ipfs/go-ipns@v0.1.0/ipns.go:276:20: pk.Bytes undefined (type "github.com/libp2p/go-libp2p-core/crypto".PubKey has no field or method Bytes)
# github.com/libp2p/go-libp2p/p2p/protocol/identify
../../go/pkg/mod/github.com/libp2p/go-libp2p@v0.14.3/p2p/protocol/identify/id.go:536:23: ownKey.Bytes undefined (type "github.com/libp2p/go-libp2p-core/crypto".PubKey has no field or method Bytes)

Do you have any suggestions? Has anybody encountered the same issues? (GoLang v1.16.6)

1 Like

Master works when doing go mod tidy first. I don’t get to reproduce the errors. But I know where they come from.

If you are trying your own code, please require go-libp2p-core v0.8.6 and not v0.9.0 and go-multiaddr v0.3.3 and not v0.4.0.

1 Like

Thank you @hector, yes I was trying my own code. Are there anywhere any resources that contain package compatibility information?

The code is your best resource. Go to go-ipfs/go.mod and use the same versions for ensure compatibility. Alternatively to libp2p/go-libp2p.

Normally things work with latest tagged versions of everything, but not always. A new libp2p release is coming up that will resolve these issues.

1 Like

Hi hector, I’ve been working to refactor ipget so I can use it to download state snapshots for blockchains. I want to embed it, and I want to do that in a single line of code.

Here’s the code:

If I use the latest versions, I get what @chrispang describes. Exactly that, even.

If I use current versions, I get:

# github.com/ipfs/go-ipfs/core/coreapi
../../../go/pkg/mod/github.com/ipfs/go-ipfs@v0.9.1/core/coreapi/path.go:52:18: undefined: resolver.ResolveOnce
../../../go/pkg/mod/github.com/ipfs/go-ipfs@v0.9.1/core/coreapi/path.go:64:3: unknown field 'DAG' in struct literal of type resolver.Resolver
../../../go/pkg/mod/github.com/ipfs/go-ipfs@v0.9.1/core/coreapi/path.go:65:3: unknown field 'ResolveOnce' in struct literal of type resolver.Resolver

and what I need to do, is create a stable, embeddable tool that allows people to make deterministic downloads.

Seems like you updated go-ipfs but not it’s dependencies in your go.mod.

I checked out your repo and it works for me.

had intermittent issues-- thank you for checking!

I am not sure I will continue to develop this software, but it was a fun exercise.