Unable to use Go SDK examples

I’m trying to prototype something with the Go SDK, but running into an issue. The problem is that the examples aren’t working. For example, I don’t have the in the in the documentation mentioned aeternity.NewNode, but I do have aeternity.NewCli. Also ctx := aeternity.NewContextFromURL(node, acc.Address, false) results in the error NewContextFromURL not declared by package aeternity.

I am using Go 1.13 on Arch linux with Go modules enabled and I have tried both go get github.com/aeternity/aepp-sdk-go@latest and go get github.com/aeternity/aepp-sdk-go@master.

What am I doing wrong?

Thanks in advance for the help!

Hi Arjan,
You’re using an old version of aepp-sdk-go. Try using v5.1.0, especially in imports, it looks similar to this but may not be 100% accurate:

import "github.com/aeternity/aepp-sdk-go/v5/aeternity"

I just updated the example in the README. I know, it’s perpetually out of date (but the files under integration_tests/ are always up to date!). Will come up with a process to integrate it soon. aepp-sdk-go/README.md at develop · aeternity/aepp-sdk-go · GitHub

I added the v5 version to the import, but once I do go mod tidy I still get a bunch of errors:

go mod tidy
go: finding github.com/joho/godotenv v1.3.0
go: finding github.com/aeternity/aepp-sdk-go v1.0.2
go: finding github.com/aeternity/aepp-sdk-go/v5 v5.1.0
go: downloading github.com/joho/godotenv v1.3.0
go: downloading github.com/aeternity/aepp-sdk-go/v5 v5.1.0
go: downloading github.com/aeternity/aepp-sdk-go v1.0.2
go: extracting github.com/aeternity/aepp-sdk-go/v5 v5.1.0
go: extracting github.com/aeternity/aepp-sdk-go v1.0.2
go: extracting github.com/joho/godotenv v1.3.0
go: downloading github.com/satori/go.uuid v1.2.0
go: downloading github.com/go-openapi/strfmt v0.19.2
go: downloading github.com/randomshinichi/rlpae v0.0.0-20190813143754-207301e28aeb
go: downloading golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
go: downloading github.com/go-openapi/runtime v0.19.3
go: extracting github.com/satori/go.uuid v1.2.0
go: extracting github.com/go-openapi/strfmt v0.19.2
go: downloading github.com/go-openapi/errors v0.19.2
go: extracting github.com/go-openapi/runtime v0.19.3
go: downloading gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
go: downloading go.mongodb.org/mongo-driver v1.0.3
go: extracting github.com/randomshinichi/rlpae v0.0.0-20190813143754-207301e28aeb
go: extracting gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
go: extracting github.com/go-openapi/errors v0.19.2
go: downloading github.com/kr/pretty v0.1.0
go: extracting github.com/kr/pretty v0.1.0
go: downloading github.com/mitchellh/mapstructure v1.1.2
go: downloading github.com/go-openapi/loads v0.19.2
go: downloading github.com/go-openapi/validate v0.19.2
go: downloading github.com/kr/text v0.1.0
go: extracting go.mongodb.org/mongo-driver v1.0.3
go: downloading github.com/go-openapi/analysis v0.19.2
go: downloading github.com/stretchr/testify v1.3.0
go: extracting github.com/mitchellh/mapstructure v1.1.2
go: extracting github.com/kr/text v0.1.0
go: downloading github.com/go-openapi/swag v0.19.4
go: extracting golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
go: downloading github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d
go: downloading github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
go: downloading golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f
go: downloading github.com/google/go-cmp v0.3.0
go: extracting github.com/go-openapi/loads v0.19.2
go: downloading github.com/go-stack/stack v1.8.0
go: extracting github.com/go-openapi/validate v0.19.2
go: extracting github.com/stretchr/testify v1.3.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/google/uuid v1.1.1
go: downloading github.com/go-openapi/spec v0.19.2
go: extracting github.com/go-openapi/analysis v0.19.2
go: downloading github.com/pmezard/go-difflib v1.0.0
go: extracting github.com/google/go-cmp v0.3.0
go: downloading github.com/tidwall/pretty v1.0.0
go: extracting github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
go: downloading github.com/go-openapi/jsonpointer v0.19.2
go: extracting github.com/go-openapi/swag v0.19.4
go: downloading github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63
go: extracting github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d
go: downloading gopkg.in/yaml.v2 v2.2.2
go: extracting github.com/google/uuid v1.1.1
go: extracting github.com/davecgh/go-spew v1.1.1
go: extracting github.com/go-stack/stack v1.8.0
go: extracting gopkg.in/yaml.v2 v2.2.2
go: extracting golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f
go: extracting github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63
go: extracting github.com/go-openapi/jsonpointer v0.19.2
go: extracting github.com/tidwall/pretty v1.0.0
go: extracting github.com/pmezard/go-difflib v1.0.0
go: extracting github.com/go-openapi/spec v0.19.2
go: downloading github.com/go-openapi/jsonreference v0.19.2
go: extracting github.com/go-openapi/jsonreference v0.19.2
go: downloading github.com/PuerkitoBio/purell v1.1.1
go: extracting github.com/PuerkitoBio/purell v1.1.1
go: downloading golang.org/x/text v0.3.2
go: downloading golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
go: downloading github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: extracting github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: extracting golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
go: extracting golang.org/x/text v0.3.2
go: downloading github.com/matoous/go-nanoid v0.0.0-20180109130436-958d370425a1
go: extracting github.com/matoous/go-nanoid v0.0.0-20180109130436-958d370425a1
github.com/arjanvaneersel/aebaltics imports
        github.com/aeternity/aepp-sdk-go/v5/aeternity imports
        github.com/aeternity/aepp-sdk-go/swagguard/compiler/client: module github.com/aeternity/aepp-sdk-go@latest (v1.0.2) found, but does not contain package github.com/aeternity/aepp-sdk-go/swagguard/compiler/client
github.com/arjanvaneersel/aebaltics imports
        github.com/aeternity/aepp-sdk-go/v5/aeternity imports
        github.com/aeternity/aepp-sdk-go/swagguard/compiler/client/operations: module github.com/aeternity/aepp-sdk-go@latest (v1.0.2) found, but does not contain package github.com/aeternity/aepp-sdk-go/swagguard/compiler/client/operations
github.com/arjanvaneersel/aebaltics imports
        github.com/aeternity/aepp-sdk-go/v5/aeternity imports
        github.com/aeternity/aepp-sdk-go/swagguard/compiler/models: module github.com/aeternity/aepp-sdk-go@latest (v1.0.2) found, but does not contain package github.com/aeternity/aepp-sdk-go/swagguard/compiler/models
github.com/arjanvaneersel/aebaltics imports
        github.com/aeternity/aepp-sdk-go/v5/aeternity imports
        github.com/aeternity/aepp-sdk-go/swagguard/node/client: module github.com/aeternity/aepp-sdk-go@latest (v1.0.2) found, but does not contain package github.com/aeternity/aepp-sdk-go/swagguard/node/client
github.com/arjanvaneersel/aebaltics imports
        github.com/aeternity/aepp-sdk-go/v5/aeternity imports
        github.com/aeternity/aepp-sdk-go/swagguard/node/client/external: module github.com/aeternity/aepp-sdk-go@latest (v1.0.2) found, but does not contain package github.com/aeternity/aepp-sdk-go/swagguard/node/client/external
github.com/arjanvaneersel/aebaltics imports
        github.com/aeternity/aepp-sdk-go/v5/aeternity imports
        github.com/aeternity/aepp-sdk-go/swagguard/node/models: module github.com/aeternity/aepp-sdk-go@latest (v1.0.2) found, but does not contain package github.com/aeternity/aepp-sdk-go/swagguard/node/models

For what it’s worth: Before doing go tidy I completely removed the pkg directory in my gopath, as well as remove go.mod + go.sum and did a new go mod init to ensure there are absolutely no references to the old version.

Unfortunately I don’t have that much experience with go modules - I’ll have to get back to you on that.

This is my fault - import paths within aepp-sdk-go did not specify the major version so aepp-sdk-go ended up importing v1 of itself. Fixed it - will make a PR and minor/patch release soon.

Great. Thanks for your efforts!

v5.1.1 is out. Should solve your problems.

1 Like