Golang Installation Codex

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

First of all, please allow me to say dirty words: fuck you, GFW.

It's a hassle to install Golang now, because of Google's tragedy, we can't go from Golang's official website down to the source code. And my Ubuntu is installed through Apt-get to the 1.0.2 version, when compiling an open source project, it will be reported sync.pool undefined. Although it is possible to download the X86 version of the Open source project, my ultimate goal is to run it on arm, so I need to compile from the source code.

1. Find source code

Golang.org not to go, borrow colleagues of foreign agents get go1.3.1.src.tar.gz, decompression, compile, resolute continue tragedy! Looking at the problem, there is a Python script in the access code.google.com ... , they say Google does not go, but also visit a hair.

2. Find binary

Intermittent agent on golang.org, found that there is a binary to provide download, with the agent next X86, more than 40 MB, agent performance is too poor, down ... According to the file name Bing a bit, found that there is a website to download, yes! address: http://fossies.org/linux/misc/go1.3.1.linux-386.tar.gz. The source code is also available on the website, but the binary package also includes the source code, and the next is enough.

3. Compiling

Although there is a binary, but the arm environment is still not, need to compile a bit.

Set Goroot:export Goroot=/usr/local/go

Set Path:export path= $PATH: $GOROOT/bin

Compiling arm:cgo_enabled=0 goarch=arm goos=linux./make.bash

After success, run the Go tool and you can see 5g and 5l.

Get a hellow world,cgo_enabled=0 goarch=arm go build hello.go, you can compile an executable file that runs on arm.


Related Article

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.