Go language development environment 1.6

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

Http://www.golangtc.com/download

Download 1.4.2 and 1.6.2

TAR-ZXVF go1.6.2.linux-amd64.tar.gz-c/usr/local/src/
Ln-s/usr/local/src/go1.6.2/usr/local/go

Set environment variables for Go

Vi/etc/profile

Source/etc/profile

Write a simple Go example

Sayhello.go and the. Go source code files in the SayHello directory produce a code package (. A) file that is similar to the C language static library, each source code can have an init function

Hello.go Import SayHello Code package call code package SAYHELLO.GO source code in the Hello method output string

Import format

"Package name (can alias)" "Hello SayHello"

Hello/sayhello/sayhello.go

Hello/hello.go

Scripting Mode execution

Go Run hello.go

Compiled into Elf executable execution

CD ~/goproject/hello

Go Install

CD ~/gobin

./hello

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.