golang installation steps
The installation package download address is: https://golang.org/dl/.
If you cannot open it, you can use this address: https://golang.google.cn/dl/.
UNIX/Linux/Mac OS X, and FreeBSD installation
#1. Download the binary package: go1.4.linux- amd64.tar.gz.
2. Unzip the downloaded binary package to the /usr/local directory.
tar -C /usr/local -xzf go1.4.linux-amd64.tar.gz
3. Add the /usr/local/go/bin directory to the PATH environment variable:
export PATH=$PATH:/usr/local/go/bin
Note: Under the MAC system, you can use the installation package ending with .pkg to double-click it directly. Installation, the installation directory is under /usr/local/go/.
Installation under Windows system
You can use the .msi suffix under Windows (the file can be found in the download list, such as go1.4.2.windows-amd64.msi) installation package to install.
By default, the .msi file will be installed in the c:\Go directory. You can add the c:\Go\bin directory to the Path environment variable. After adding it, you need to restart the command window for it to take effect.
Installation Test
Create the working directory C:\>Go_WorkSpace.
test.go file code:
package main import "fmt" func main() { fmt.Println("Hello, World!") }
Use the go command to execute the above code and the output result is as follows:
C:\Go_WorkSpace>go run test.goHello, World!
Related recommendations: golang tutorial
The above is the detailed content of golang installation steps. For more information, please follow other related articles on the PHP Chinese website!