Golang Installation

[!TIP] This document is machine-translated by Google. If you find grammatical and semantic errors, and the document description is not clear, please PR

Forward

To develop a golang program, the installation of its environment must be indispensable. Here we choose to take 1.15.1 as an example.

Official document

https://golang.google.cn/doc/install

Install Go on macOS

  • Download and install Go for Mac
  • Verify the installation result
    1. $ go version
    1. go version go1.15.1 darwin/amd64

    Install Go on linux

  • Download Go for Linux
  • Unzip the compressed package to /usr/local
    1. $ tar -C /usr/local -xzf go1.15.8.linux-amd64.tar.gz
  • Add /usr/local/go/bin to environment variables
    1. $ $HOME/.profile
    1. export PATH=$PATH:/usr/local/go/bin
    1. $ source $HOME/.profile
  • Verify the installation result
    1. $ go version
    1. go version go1.15.1 linux/amd64

    Install Go on windows

  • Download and install Go for Windows
  • Verify the installation result
    1. $ go version
    1. go version go1.15.1 windows/amd64

More

For more operating system installation, see https://golang.org/dl/