I was getting started with Swarm. I am trying to install Swarm and am following the official tutorial for it. Being specific I ran the following commands:

sudo apt install golang git
curl -O https://storage.googleapis.com/golang/go1.7.3.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.7.3.linux-amd64.tar.gz
mkdir -p ~/go; echo "export GOPATH=$HOME/go" >> ~/.bashrc
echo "export PATH=$PATH:$HOME/go/bin:/usr/local/go/bin" >> ~/.bashrc
source ~/.bashrc
mkdir -p $GOPATH/src/github.com/ethereum
cd $GOPATH/src/github.com/ethereum
git clone https://github.com/ethereum/go-ethereum
cd go-ethereum
git checkout master
go get github.com/ethereum/go-ethereum

The last command is giving import error:

package context: unrecognized import path "context" (import path does not begin with hostname)

I am not sure what's causing the issue. Any help?


Problem :
The issue was with the version of go I installed. The go version I was using was 1.6.(You can the go version by go version command).

The solution is to simply upgrade go to the latest version (I am at go1.8.3). just replace the second and third line from commands in my problem statement with:

curl -O https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.8.3.linux-amd64.tar.gz
  • I am using 1.9 and having same issue Jul 21 '18 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.