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!!!");
}