This is a creation in Article, where the information may have evolved or changed.
Content of this article
- Overview
- Go SDK
- Liteide
- Resources
Google launched its second open source language Go in 2009. The evaluation of Go is mixed, China's enthusiasm is higher than that of foreign countries. Go is born for concurrency and the network , in addition to this, in static compilation, GC, cross-platform, easy to learn, rich standard library, etc., in fact, not as C + +, Java, C #, Python. So you can imagine, why go? And why are there so many questions and arguments about Go? -maybe go is more like a "genius autistic patient", if you see this, on the network and know some go on the praise can be calm, it is like getting home from work, is to eat first, or take a shower, important? ~
Download Development Tools
Download the relevant documentation manual
Overview
Go is a compiled, developed, and garbage-collected programming language for Google.
Robert Greysmore (Robert Griesemer), Rob Parker (Rob Pike) and Ken Thompson began designing the Go language in September 2007, and later Ian Lance Taylor, Russ Cox, joined the project. The Go language was officially launched in November 2009 as an open source project and implemented on Linux and Mac OS X platforms, followed by the implementation under Windows.
The predecessor of Go comes from Inferno (based on Plan 9 transformation). The Inferno contains a language called Limbo. Here is a quote from the Limbo paper:
Limbo is a programming language for developing distributed applications that run on small computers. It supports modular programming, compile-time and runtime strong type checking, in-process based on the type of channel communication, atomic garbage collection and simple abstract data types. It is designed to work safely even on small devices that do not have hardware memory protection.
Another feature that Go inherits from Limbo is the channel. Another paragraph from the Limbo document describes:
A channel is a communication mechanism that is used to send and receive specific types of objects to other agents in the system. The channel can be used for local interprocess communication, and a library method for connecting to a named destination. Both cases are direct send and receive operations.
Channel is more useful in Go than in Limbo. If we delve into the history of Go, we will find a clue to "Newsqueak", a pioneer in the use of channel communication in Class C. The channel is not unique to these languages, and another non-Class C language: Erlang, which is also used.
Figure 1 Go Language Chronicle
Communicating with other processes using the channel is called the "communication serialization process (communicating sequential PROCESSES-CSP)", conceived by C. A. R. Hoare design, and he is the man who invented the fast-sorting algorithm.
Go is the first Class C language that implements a simple (or simpler) parallel development and a cross-platform. the grammar of the Go language is close to the C language, but the declaration of the variable is different, and the other syntax differs in that the for loop and if judgment are not surrounded by parentheses. The Go language supports the garbage collection feature. The parallel model of the Go language is based on Tony Hall's CSP, and other languages that take a similar model include Occam and Limbo, but it also features Pi operations, such as channel transmission.
In contrast to C + +, the Go language does not include features such as exception handling, inheritance, generics, assertions, virtual functions, but adds language-level support for slice, concurrency, pipelines, garbage collection, Interface (interface), and more. Of course, Google's attitude towards generics is still open, but in the list of frequently asked questions in that language, there is a negative attitude towards the existence of assertions, as well as defending themselves from providing type inheritance. An associative array (also known as a hash table (hashes) or dictionary (dictionaries)) is embedded in the Java,go language, just like a string type.
Development Go generally requires two programs:
- Go SDK, download address;
- Go ide--liteide, download address.
This article takes Windows 7 64-bit as an example for the environment, GO1.4.2.WINDOWS-AMD64 and LITEIDEX27.2.1.WINDOWS-QT5.
Go SDK
Figure 2 Go SDK
The default installation path is C:\go . Of course you can change the path, as long as the IDE is subsequently configured with the correct path.
When the installation is complete, the Go SDK will automatically add system environment variables for you.
Now, you can use any text editor to write Go code, such as Helloworld.go, stored under the C packing path:
Package Main
Import (
"FMT"
)
func Main () {
Fmt. Println ("Hello world!")
}
You can then execute the program by running go run helloworld.go .
C:\>Go run helloworld.go
Hello, world
C:\>
Liteide
If you do not want to use the command line, you can use the IDE environment--liteide, just configure the IDE appropriately.
In addition to Liteide, there are Sublime Text, Vim, Emacs, Eclipse, IntelliJ idea.
After downloading the Liteide compressed file and extracting it as "liteide", double-click "{Your path}\liteide\bin\liteide.exe" To see the 3 shown:
Figure 3 Liteide Main interface
To configure Liteide, click on the menu bar "view-and options" and you will see 4:
Figure 4 Configuring Liteide
Select "Liteide" on the left, choose your environment on the right, for example, my Windows 7 64-bit, select Win64-user.env, double-click, you will see the contents of the configuration file:,
# Native Compiler Windows AMD64
Goroot=c:\go
#GOBIN =
Goarch=amd64
Goos=windows
Cgo_enabled=1
Path=%goroot%\bin;%PATH%
Liteide_gdb=gdb64
Liteide_make=mingw32-make
liteide_term=%comspec%
liteide_termargs=
liteide_exec=%comspec%
Liteide_execopt=/c
In addition to win64-user.env, there are win64.env, the former is the user profile, the latter is the entire machine configuration file, because the Windows operating system is multi-user.
Make sure the goroot=c:\ line is the path to the actual Go SDK for your machine, for example, my path has its default path C:\Go.
The work path. You can configure the work path for liteide. Select the toolbar "Go icon" and you will see Figure 5:
Figure 5 Configuring the work path
You can see two paths, the first one is my custom, the second one is the system default.
Resources
Download Development Tools
Download the relevant documentation manual