Skip to main content

golang installation


Go is a static force type, compiled, co-generated, and programming language with garbage recovery features developed by Google, with Robert Glaismo, Rob Peark and Ken Thompson started designing Go in September 2007, followed by Ian Lance Taylor and Russ Cox joining the project.Go is based on the Inferno operating system.Go was officially launched in November 2009 as an open source project to support Linux, macOS, Windows and other operating systems.

The Go syntax is close to C language, but the statement of variables is different.Go supports garbage recovery features.The parallel computing model for Go is based on the communication sequencing process (CSP) of Easy Hor, and other languages using similar models include Occam and Limbo, which also features in the model such as the transmission of the channel.A parallel construct, such as goroutine and channel, can build a thread, pipe and so on.Open plugin plugin support in version 1.8, which means that some functions can now be loaded dynamically from Go.

In comparison with C++, Go does not include functions such as enumeration, unusual handling, inheritance, generic (added to go.18), assertions, false functions, etc. but adds language level support for slice (Slice) types, co-flowing, piping, garbage recovery, interfaces etc.There is a negative attitude towards the existence of assertions and a defence to the fact that they do not provide a type of inheritance.

Go Website below:

  • Google Supported Open Source Language
  • Easy to learn, very well suited to team
  • Built-in and powerful standard libraries
  • Large ecosystems of partners, communities and tools



Here we take the 1.19 version as an example, and it is not recommended to install a specific version. Developers can choose according to their needs. For more versions, go to Go to Golang to choose by yourself.

Other versions and operating systems can to go to the official network to choose.

2. Installation

1 Delete the /usr/local/go folder (if available) to remove any previous Go installation and then compress the just downloaded archive to /usr/local, Create a new Go directory in /usr/local/go

$ rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.4.linux-amd64.tar.gz

::NOTE You may need to be root or run command via sudo Do not extract the archive to the existing /usr/local/go directory.It is well known that this will cause damage to the Go installation. :::

2 Add /usr/local/go/bin to the PATH environment.You can perform this action by adding the following lines to $HOME/.profile or /etc/profile (for the installation of the system scale):

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

changes to the configuration file may not be applied until you log in the next computer.To apply changes immediately, simply run shell commands directly or execute them from configuration files using commands such as source $HOME/.profile.

3 Open the terminal and type the following command to verify that you are installed:

$ go version

4 . Make sure that the directive has printed the installed version of Go.

3. Configuration


After go 1.11, it is recommended that the GO111MODULE value be set to onin order to avoid unnecessary errors in the follow-up pull dependency.

$ go env -w GO111MODULE=on

3.2 Configure Proxy

$ go env -w GOPROXY=,direct

3.3 View configuration

$ go env GO111MODULE
$ go env GOPROXY,direct