On the forum of Ubuntu, I saw a post of grabbing the image data in the web page, so I wanted to try it with go language. Then install a running environment first. The following installation methods are successfully installed on 32-bit and 64 bit Ubuntu 12.04, and I have actually run all commands and programs. If you have any problems, please leave me a message.
1. Install mercurial
Mercurial is a version control system, we will use this tool to download the go language source code later. Under Ubuntu, it’s OK to install it with apt get, which is very convenient.
2. Download go language source code
This step will create a new go folder in the current directory of the command line, and download the code file to the go folder, so make sure there is no go folder in the current directory. For example, I operate directly in the / home directory.
3. Start installation
./all.bash
This process takes a little time, one click installation, very powerful. After installation, a message similar to the following will be displayed,
Installed commands in /home/go/bin
*** You need to add /home/go/bin to your PATH.
In other words, you need to set the bin directory of go to $path. This variable is to run the command search path. It doesn’t matter if you don’t set it temporarily. You can use the full path to handle it. Because I chose the / home directory before, the bin directory of go after the installation is / home / go / bin
4. International practice, the first program Hello world!
import “fmt”
func main() {
fmt.Printf(“Hello, world\n”)
}
Save as a hello.go file and execute
When you see the output Hello world, the environment is installed successfully.
The above is the whole content of this article, I hope you can like it.