This is a creation in Article, where the information may have evolved or changed.
Go language is Google's own design of a language
The go language is optimized for programming multi-processor system applications, with go-compiled programs that are comparable to C or C + + code, and are more secure and support parallel processes.
Born in the famous Google 20% time, the main designer is Rob Pike
To put it simply, the go language is as easy to develop as Java, as efficiently as C/s (which is their goal, of course).
Go Language homepage: http://golang.org/
Go Language Editor: Many, I use the idea, but of course need to add plug-ins, add the method can be seen here: http://www.php100.com/html/itnews/it/2012/0831/10973.html
If you can't download plugins in the IDE, you can download http://plugins.jetbrains.com/plugin/5047?pr=idea_ce here and install them on your hard drive.
The Grammar of Go
Go keyword and C almost completely, so people who understand C can read the code of Go without any learning.
But there's a big difference between the patterns of expression.
The definition of a variable in C is like this
int A; int>0;
Also in the go language, the code is like this, with the addition of semicolons can be
var int = 1 var int 0
The definition of a function is this way
int int int { return A + B}
Func Key parameter return value
You can see that the biggest difference between C and go is that go puts the type declaration at the end.
So you can define an anonymous function.
int int int { return A + b } (13)
I don't know if go will support lambda expressions, otherwise it would be too complicated to write.
The Package keyword
Go and Java have the concept of a package, meaning and Java almost no more here to say
Import keyword
Go and Java, C # use the same import instead of include, because go has no concept of header file
Finally give you a sample file
1 /**2 * Created with IntelliJ idea.3 * User:dothegod4 * date:13-12-75 * Time: Morning 11:466 * To change this template use File | Settings | File Templates.7 */8 Package Main9 Ten> "FMT" One AFunc Add (AintBint)int { - returnA +b - } the - Func Main () { - varX, yint -x =1 +y =2 - + varSumint Asum =Add (x, y) atFmt. Printf ("%d\n", sum) - -sum = func (AintBint)int { - returnA +b -}(1,3) - inFmt. Printf ("%d\n", sum) - to varP *int +p = &x -Fmt. Printf ("%d\n", *p) the * $Fmt. Printf ("Hello world!")Panax Notoginseng}
Click Make in idea to compile this file, the generated file in the project directory out of the directory, is an EXE file, can be directly executed.