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:

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

I get these errors:

../../go/pkg/mod/ undefined: manet.NetCodec
../../go/pkg/mod/ undefined: manet.RegisterNetCodec
../../go/pkg/mod/ s.LocalPublicKey().Bytes undefined (type "".PubKey has no field or method Bytes)
../../go/pkg/mod/ pk.Bytes undefined (type "".PubKey has no field or method Bytes)
../../go/pkg/mod/ ownKey.Bytes undefined (type "".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:

../../../go/pkg/mod/ undefined: resolver.ResolveOnce
../../../go/pkg/mod/ unknown field 'DAG' in struct literal of type resolver.Resolver
../../../go/pkg/mod/ 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.