Go SDK Installation error

Hi all.
I’m tying to install the Go SDK by the command:

go get -u github.com/algorand/go-algorand-sdk/

I got the following error message:

package github.com/algorand: directory “… /go/src/github.com/algorand” is not using a known version control system

Git is installed, version 2.17.1

Any help?

Can you remove completely $GOPATH/go/src/github.com/algorand and try again?

I did it before posting my question here in the forum, and it didn’t solve the problem.
I installed algorand by these commands:

git clone https://github.com/algorand/go-algorand
cd go-algorand
make install

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:


while the “Go SDK” references a different directory:




Could this be the problem?
Any help?

Can you do the following:

  1. Create a new empty folder mkdir $HOME/go2
  2. Set the GOPATH to this folder: export GOPATH=$HOME/go2
  3. Ty again to install the Go SDK again: go get -u github.com/algorand/go-algorand-sdk/...

If this does not work, can you indicate your OS version and your Go version?

It works, thanks a lot !

But there are two problems:

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 :


while everything works fine importing from v1:


Here the source code, adapted from the examples of algod client:

package main

import (

const algodAddress = "http://localhost:8080"
const algodToken = "21c48628ab0698fc2a5ebd09b1b02b8ce6608329d181c39e95242a0a0d724a5a"

func main() {
algodClient, err := algod.MakeClient(algodAddress, algodToken)
if err != nil {
	fmt.Printf("failed to make algod client: %s\n", err)

nodeStatus, err := algodClient.Status()
if err != nil {
	fmt.Printf("error getting algod status: %s\n", err)

fmt.Printf("algod last round: %d\n", nodeStatus.LastRound)
fmt.Printf("algod time since last round: %d\n", nodeStatus.TimeSinceLastRound)
fmt.Printf("algod catchup: %d\n", nodeStatus.CatchupTime)
fmt.Printf("algod latest version: %s\n", nodeStatus.LastVersion)

Here the error message:

go build algogp.go
# command-line-arguments
./algogp.go:18:18: assignment mismatch: 2 variables but algodClient.Status returns 1 values
  1. 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

  2. You need to do algodClient.Status().Do(ctx) where ctx is a context that you may create as ctx := context.Background()

Hi Fabrice,
thanks for your suggestions.

  1. 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!


  1. I will try it. I hope to find soon many v2 examples in developer.algorand.org/docs.

Thanks again for your help.