Go locale installation


Release date:2023-09-08 Update date:2023-10-13 Editor:admin View counts:381

Label:

Go locale installation

Go language supports the following systems:

  • Linux

  • FreeBSD

  • Mac OS X (also known as Darwin)

  • Windows

The download address of the installation package is https://golang.org/dl/.

If you can’t open it, you can use this address: https://golang.google.cn/dl/.

The package name corresponding to 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

Image0

UNIX/Linux/Mac OS X, and FreeBSD installation

The following describes the installation method of using source code on UNIX/Linux/Mac OS X and FreeBSD systems:

1.Download binary package: go1.4.linux-amd64.tar.gz.

2.Extract the downloaded binary package to the/usr/local directory.

tar -C /usr/local -xzf go1.4.linux-amd64.tar.gz

3.Set /usr/local/go/bin directory added to PATH environment variables:

export PATH=$PATH:/usr/local/go/bin

The above can only be added temporarily PATH if you close the terminal and log in again, it will be gone.

We can edit it. ~/.bash_profile or /etc/profile and add the following command to the end of the file, which is permanent:

export PATH=$PATH:/usr/local/go/bin

After adding, you need to execute:

source ~/.bash_profile
or
source /etc/profile

Note: you can use the MAC system. .pkg double-click directly at the end of the installation package to complete the installation, and the installation directory is in /usr/local/go/.

Installation under Windows system

Can be used under Windows .msi install the package with the suffix (the file can be found in the download list, such as go1.4.2.windows-amd64.msi).

By default .msi files will be installed in the c:Go directory. You can add the c:Gobin directory to the Path in the environment variable. After adding, you need to restart the command window to take effect.

Installation test

Create a working directory C:\>Go_WorkSpace .

test.go file code:

package main
import "fmt"
func main() {
   fmt.Println("Hello, World!")
}

Use go output of the above code executed by the command is as follows:

C:\Go_WorkSpace>go run test.go

Hello, World!

Powered by TorCMS (https://github.com/bukun/TorCMS).