Go language Environment building, forever HelloWorld

Source: Internet
Author: User

First, the go language, as a programming language, was developed by Bell Labs in the United States. But in 2008, Google discovered the great potential of the go language, thus fully supporting the development of the Go language, based on Google's consistent embrace of open source, so the go language chose Open source mode, which is a simple introduction to the Go language.

Second, to learn the go language must install the Go Language development package, this is the address: http://pan.baidu.com/s/1skZfRy9

Installation step, always click Next.

The environment variable is configured as follows:

(1) Add Goroot variable name in the system variable box, variable value: is the installation path of the go development package, as follows:

(2) Append the bin directory of the Go development package to the path behind the system variable box, as follows:

(3) In the terminal test GO environment variable is configured, in DOS input go help, the following instructions are configured:


Next talk about the Go language development environment (IDE), in fact, a programming language IDE can have a lot, here I give you ide,liteide, if needed, this is the link address:/http Pan.baidu.com/s/1ji86aie


After installation, click on the exe file, then entered the IDE, the interface is as follows:

The people who learn programming always take a helloworld as the beginning of learning a programming language, which heralds the smooth sailing of learning the language, then we will say to write HelloWorld in go language,

Let's start with a notepad and run it in the terminal, then run it in the IDE and compare it to the rest. (Note: The Go language file has a. go extension)

First run in Notepad, as follows:


The command running in DOS is go run hello.go, as follows:


In the IDE to write, it is more convenient, as follows:


Note: After you finish writing in the IDE, press Ctri+r to run, and after running, an. exe file will be generated below the directory.


Write it down and I'll simply say, these lines of code:

Package Main//go language code belongs to

Import "FMT"//equivalent to the C language inside the library function

Func Main () {//main function cannot have parameters and cannot define return value

Fmt. Println ("Hello world!!!");

}

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.