To better promote the go language, Google builds a browser-based interactive go programming guide-gotour on its official website and appspot. Related Websites:
- Gotour -- English version
- Gotour-Chinese Version
This tutorial is easy to learn and consists of three parts:
The first part describes the basic concepts of the Go language, including packages, imports, functions, variables, conditions, loops, pointers, struct, slice, map, and range.
The second part describes methods, interfaces, errors, Web servers, and image processing.
The third part describes concurrency, goroutine, channel, buffer channel, range, close, select, and so on.
Each part provides a large number of examples.CodeCan be directly run on the web. Exercises are also provided at the end of each part. You can write code directly in the browser editing box provided by the tutorial, click the button in the upper left corner to "run" to view your own encoding results. For beginners, this online tutorial is indeed the best practise for learning go programming:
However, I would not letProgramThe domain names of the above two websites are seriously polluted by the pleasant use of Google services, and are often inaccessible or unstable. Fortunately, this tutorial provides the construction of a local offline version. Without access to the Internet, this tutorial can run as an independent web program. When running locally, the tutorial uses the local environment to build and compile the code, which runs faster and includes some enhancements that are not available in the sandbox version.
So I suggest all programmers who want to learn go build this go language tutorial based on the local environment. The building process is very simple:
- Install the go language environment. For details, refer to the Go official website guide. A brief introduction is as follows:
- For OS X, you can directly use
Brew install go
To install/Usr/local/cellar/go
Directory.
- For Linux (UBUNTU ),
Wget http://go.googlecode.com/files/go1.0.3.linux-amd64.tar.gz
Download the compiled installation package, and thenTar-C/usr/local-xzf go1.0.3.linux-amd64.tar.gz
.
- Set environment variables to ensure that the go command can be executed on the command line.
- Install another distributed management tool, Hg (mercurial). For more information about HG, see http://mercurial.selenic.com.
- For OS X, you can use
Brew install Hg
Install.
- For Linux (UBUNTU), you can use
Sudo apt-Get install mercurial
Install.
- After the installation is complete, confirm that you can find the Hg command on the command line.
Go language installation Tutorial:Sudo go get code.google.com/p/go-tour/gotour
Go language installation Tutorial:Sudo go get bitbucket.org/mikespook/go-tour-zh/gotour
Run gotour on the command line and enter the following in the browser address:Http: // 127.0.0.1: 3999
To go to the learning interface of the tutorial.
Happy learning!