从源安装时出错

i am trying to install go from source

i follow this steps

git clone https://go.googlesource.com/go
cd go
git checkout go1.6.1

cd src
./all.bash

now it gives me the error saying

##### Building Go bootstrap tool.
cmd/dist
ERROR: Cannot find /root/go1.4/bin/go.
Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.

any idea how can i fix this do i just need to set env variable or any other installation is needed ?

You need to have an installed Go version 1.4 or newer to build the recent Go releases. The build script defaults to some path but if it's not there you need to set GOROOT_BOOTSTRAP environment variable to point to a previous working Go installation.

Go is written in Go (starting from version 1.5) so you have to install Go1.4 first. Just get Go Version Manager and run:

$ gvm install go1.4 
$ gvm use go1.4 
$ export GOROOT_BOOTSTRAP=$GOROOT

Another approach is about to install gcc go frontend:

$ sudo apt-get install gccgo-5
$ sudo update-alternatives --set go /usr/bin/go-5
$ export GOROOT_BOOTSTRAP=/usr

If you are not using gvm and are on Linux, your go binary is mostly installed at /usr/local/go/bin/go. You need to set /usr/local/go as your GOROOT_BOOTSTRAP by:

$ export GOROOT_BOOTSTRAP=/usr/local/go