ShuDudu's Home was started in 2011, but the web data is lost, so now begin again, I would like to make some friends, I hope you like ShuDudu's home.
Current position: ShuDudu > Net Web >

GO Study Notes (1)

Thursday on June 4th, 2020Net Web

What is GO?

GO is golang, we called GO language, google is produced, so it should be assured products. Here we do not introduce more details, see Wikipedia.

Go programming language is a programmer to make more efficient open source projects. Go is expressive, concise, clear and efficient. It makes it easy to write parallelism multicore and network applications, and the type of system allows the construction of novel flexible modular programming. Go compiled to machine code is very fast, but also has the convenience of garbage collection and a powerful runtime reflection. It is fast, statically typed compiled language, but the feeling is dynamically typed, interpreted language.

golang official website: http: // (out of the wall, right)

Download and install GO

Here only to windows, for example, the latest version is 1.03 (good small ah) is recommended to install version, but also on the msi suffix, in addition to distinguish between your computer is 64 or 32.

Download (this is recommended): http: //

Of course, you can download gomingw (development environment): http: //

After downloading, follow the prompts to install directly. Install version, do not need to set environment variables, but you want to set it GOPATH (Note: This is not Go installation directory, can be understood as a working directory, you can also set up multiple directories, win can be separated by semicolons)

Create an environment variable name is called GOPATH in the environment variable: Value fill in c: mygo (directory at random).

Finally, open cmd, enter go, when the screen appears a lot of usage, proved successful installation. For example, you can go to see the knock-go version version and so on.

development tools

1. Editor:

GO can use many common programming editor, such as vim, sublime text and Notepad ++, but here I am more recommended LiteIDE.

LiteIDE is a specially developed for the Go language integrated development environment (IDE), written by visualfc. Support for project management, integration build, GDB debugging, syntax highlighting, auto-completion, outline display.

Download: http: //

Code completion needs to be installed gocode: go get

2. Distributed

After a lot of time needed to download the GO repository through this command hg clone, in addition, go go get the usage must be installed Mercurial, can directly download the repository, otherwise it will error.

Mercurial download address: http: //

Hello World

Ide or editor in which to create a new hello.go file, enter the code in it:

package main import "fmt" func main () {fmt.Printf ( "hello, world \ n")}

If LiteIDE, it can be compiled directly, or go run hello.go typing in cmd, the correct output is: Hello, world.


OK ~~ enjoy it!

Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: