This is a creation in Article, where the information may have evolved or changed.
Haha, the name up like those textbooks, the introduction to proficient, seemingly simple words, in fact, I can not master Golang or a little pressure, learning this language is also a personal interest, good, nonsense not much to say, into our subject.
A brief introduction to the Golang bar,go is a compiler developed by Google, can be parallel, and has a garbage collection function of the programming language, if you have a C language Foundation, then learning Go will be more easy, The go language is typically used for server programming. These concepts ha, read it again nothing is normal, roughly understand this is a language, and is Google Pro son, and can write server OK.
My personal habit is to learn a language, first set up a good environment, choose the IDE, write a HelloWorld say, the following start.
The next go from the Internet, generally is the type of EXE executable file or a compressed package, if the former, directly fool installation can, if the latter, decompression can be, we recommend that everyone in the installation and decompression in the root directory, my environment configuration is this:
Remember our path is D:\go, the path to the bin file is D:\go\bin (which will be used later)
After the installation of Go, but also to build environment variables, desktop right-click on the computer properties
Click Change settings and you'll see
In the environment variable we have to do three things, first of all in the user variable path to add the Go installation path, and then add in the system variables:
Gopath field: This path is used to store the code you write later
Goroot field: Get the go language up and running
Once added, open cmd, enter go version, and display the following information indicating that you have successfully installed go:
The beginning of many languages is HelloWorld, this great tradition can not put me here broken, nonsense said, on the code:
Package Main
Import "FMT"
Func Main () {
Fmt. Printf ("Hello, world\n")
}
The code is simple, just create a new TXT document and copy it in, and then change the suffix to go (don't tell me you won't change the suffix name)
Then execute in cmd:
It's done, great HelloWorld!