1: If the installed version is the >=1.5 version, you need to install the go.1.4 version first.
1.1 Why do I need to install go version 1.4? (Referenced below: https://www.kejianet.cn/go-5/)
The Go Project team released the Go 1.5 plan, and go 1.5 will be built using go 1.4, and the go source tree will completely eliminate all C's code. Removing the C compiler
(5c,6c,8c,9c). The remaining C programs will be translated into the go language, including go compilers (Golang.org/s/go13compiler), assembler and connector (Golang.org/s/go13linker), and cmd/dist. If these programs use Go Write, which will trigger a startup problem in the full build source-you need an available go tool chain to build the go toolchain.
To build Go 1.x (x≥5), you need to first install go 1.4 to goroot_bootstrap. The default goroot_bootstrap is the $HOME/go1.4. We use Go 1.4 as the base version of the boot to compile the toolchain.
Let's take a look at what it's like to build go 1.4:
- Build cmd/dist using GCC or clang.
- Using the dist, build compiler tool chain (GCC or clang)
- NOP
- Build Cmd/go with Dist (as Go_bootstrap)
- Use Go_bootstrap to build additional standard libraries and commands
The build of Go 1.x (x≥5) will become:
- Build cmd/dist with Go 1.4
- Building the compiler toolchain using dist
- Rebuilding the compiler toolchain using dist
- Build Cmd/go with Dist (go_bootstrap)
- Building other standard libraries and commands using Go_bootstrap
2: Install version go1.4 (download website: https://studygolang.com/dl)
2.1 wget https://studygolang.com/dl/golang/go1.4.src.tar.gz download go 1.4 source code
2.2 Unzip TAR-ZXVF Go1.**.tar and move to/usr/local/go1.4
2.3: Compile: 1, cd/usr/local/go1.4 2,./make.bash
2.4: Set the location of the compilation environment: Export goroot_bootstrap=/usr/local/go1.4
3: Install version go1.10
3.1 wget https://studygolang.com/dl/golang/go1.10.3.src.tar.gz download go.1.10 source code
3.2 Unzip TAR-ZXVF Go1.**.tar and move to/usr/local/go
3.3 Compilation: 1, cd/usr/local/go1.4 2,./all.bash
4: Environment variable setting
At the end of the file/etc/profile file, add
Export Goroot=/usr/local/go
Export gobin=goroot/bin export path=PATH: $GOBIN
5 check: Go version has release information output