centos6.5 Go Source Installation

Source: Internet
Author: User

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:

    1. Build cmd/dist using GCC or clang.
    2. Using the dist, build compiler tool chain (GCC or clang)
    3. NOP
    4. Build Cmd/go with Dist (as Go_bootstrap)
    5. Use Go_bootstrap to build additional standard libraries and commands

The build of Go 1.x (x≥5) will become:

    1. Build cmd/dist with Go 1.4
    2. Building the compiler toolchain using dist
    3. Rebuilding the compiler toolchain using dist
    4. Build Cmd/go with Dist (go_bootstrap)
    5. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.