Build the go language environment in ubuntu14.04 Kylin

Source: Internet
Author: User

 

Sudo apt-Get install golang

Gccgo Installation

View gcc-V
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin 

If your GCC supports golang, run the following command to install gcc-Go (I am not sure if you try this command ):

sudo apt-get install gccgo 

Set system environment variables

Sudo gedit/etc/profile

Export goroot =/usr/lib/go # Note: some articles on the Internet are stored in/usr/local/go.
Export Gobin = $ goroot/bin
Export gopkg = $ goroot/PKG/tool/linux_amd64
Export goarch = amd64
Export GOOS = Linux
Export Path =.: $ path: $ Gobin: $ gopkg

Compile and make it take effect

Source/etc/profile

Test

If you can see the version number, the configuration is successful!

Go version

Go version go1.2.1 Linux/amd64

 

Write the test code and save it as hello. Go.

package mainimport "fmt"func main() {fmt.Printf("hello, world\n")}

Go run Hello. Go

Run

 

Successful!

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.