Go locale installed
Go supports the following language:
- Linux
- FreeBSD
- Mac OS X (also known as Darwin)
- Window
Download the installation package: https://golang.org/dl/ .
Each system corresponding to the package name:
operating system | Package names |
---|---|
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 in UNIX / Linux / Mac OS X, and FreeBSD system source code using the installation method:
1. Download Source Package: go1.4.linux-amd64.tar.gz.
2, unzip the downloaded source package to / 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: You can use the MAC system ending .pkg installation package by double-clicking to complete the installation, the installation directory / usr / local / go / under.
Installation under Windows
Under Windows can be installed using .msi suffix (in the download list can be found in the file, such as go1.4.2.windows-amd64.msi) installation package.
By default, the .msi files will be installed in the c: \ directory Go. You can c: \ Go \ bin directory to the PATH environment variable. After adding the command window you need to restart to take effect.
Installation and testing
Create a working directory C: \> Go_WorkSpace.
File name: test.go, code is as follows:
package main import "fmt" func main() { fmt.Println("Hello, World!") }
Use the go command to perform the above code output results are as follows:
C:\Go_WorkSpace>go run test.go Hello, World!