This is a creation in Article, where the information may have evolved or changed.
Go Language Environment Installation
The Go language supports the following systems:
- Linux
- Freebsd
- Mac OS X (also known as Darwin)
- Window
The download address for the installation package is: https://golang.org/dl/.
Package name for each system:
Operating System |
Package Name |
Windows |
Go1.4.windows-amd64.msi |
Linux |
Go1.4.linux-amd64.tar.gz |
Mac |
Go1.4.darwin-amd64-osx10.8.pkg |
Freebsd |
Go1.4.freebsd-amd64.tar.gz |
Unix/linux/mac OS X, and FreeBSD installation
The following describes the use of the source installation method under Unix/linux/mac OS X, and FreeBSD systems:
1, download the source package: go1.4.linux-amd64.tar.gz.
2. Extract the downloaded source 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:
ExportPATH=$PATH:/usr/Local/Go/bin
Note: Under MAC system you can use the. Pkg end of the installation package directly double-click to complete the installation, the installation directory under/usr/local/go/.
Installation under Windows system
Windows can be installed under an installation package that uses the. msi suffix (which can be found in the download list for the file, such as Go1.4.2.windows-amd64.msi).
By default, the. msi file is installed in the C:\Go directory. You can add the C:\Go\bin directory to the PATH environment variable. You will need to restart the Command window to take effect after adding.
Installation test
Create the working directory C:\>go_workspace.
File name: Test.go, the code is as follows:
PackageMainImport "FMT"Func main() {FMT.Println("Hello, world!.")}
Use the GO command to execute the above code output as follows:
C:\go_workspace>Go Run test.GoHello, World!