It works well (even if “make test” fails), because I launched the node on testnet and I created a wallet, two accounts, an asset and I transferred the asset using the two accounts. All done by “goal” commands.
So, the algorand software is in the directory:
$HOME/go-algorand
while the “Go SDK” references a different directory:
1.) Now the “go-algorand” installation (with algod, goal, etc.) is still in $HOME/go, while the “Go SDK” is in $HOME/go2. How to set the environment variable $GOPATH with two paths? Is there a way to have both in $HOME/go?
2.) Using “Go SDK” there are compiler errors importing from the new v2 :
You don’t really need the normal Algorand installation to be in the GOPATH for any development. But if you want to, I would just install again Algorand in $GOPATH/go2. Note also that actually GOPATH is like PATH and may contain multiple path separated by :. Thus you could in theory set export GOPATH=$HOME/go2:$HOME/go. But you sometimes hit unexpected behaviors when you do so
You need to do algodClient.Status().Do(ctx) where ctx is a context that you may create as ctx := context.Background()
I reinstalled Algorand from scratch, starting again from the github sources. Now I have this, where algoc is my first application developed using go-algorand-sdk and acting as a client to algod (in testnet). Everything works fine!
In a related issue, I was receiving this error after a go update (1.16.2) and go SDK update (1.5.1), when running in VSCode. I was getting this error. : go.mod file not found in current directory or any parent directory; see 'go help modules'