Refer to this automated installation method instead of using this repository directly!
Follow the instructions exactly step by step to make sure the directories are created as intended. Failing to do so will make everything fail.
-
Install dependencies
sudo apt install wget git build-essential
-
Clone the repository and set
GOROOT_BOOTSTRAP
environment variablemkdir ~/src ; cd ~/src ; git clone https://github.com/Akito13/go1.11.2_arm_bootstrap.git export GOROOT_BOOTSTRAP=/home/pi/src/go1.11.2_arm_bootstrap/go-linux-arm-bootstrap
-
You are in the
~/src
folder now and retrieve the Go source code:i.
mkdir go1.11.2 ; cd go1.11.2 git clone https://go.googlesource.com/go . && cd src
ii. Switch to desired version:
git checkout go1.11.2
-
You compile the actual Go that Raspberry Pi will use now:
i.
./make.bash
ii. This will take some time, so be patient.
-
Test your Go installation:
i.
cd .. ; cd bin ; nano hello.go
ii. You paste in the following:
package main import "fmt" func main() { fmt.Printf("GO-reetings!\n") }
iii. Now do
./go run hello.go
and output should be
GO-reetings!
-
Set your environment ready to GO:
export PATH="$PATH:/home/pi/src/go1.11.2/bin" && export GOPATH=$HOME/go
-
Check if PATH is set correctly:
go version
and output should be
go version go1.11.2 linux/arm
which means everything is set up correctly!