Dec 23, 2020 • 2 min read
Install Go
The Go programming language is an open source project to make programmers more productive. Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It’s a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language.
Version
-
Select a stable version of Go by visitng golang.org
-
Create an environment variable to store the version e.g.
GOLANG_VERSION="1.15"Install
-
Download the Linux (i.e. x86-64) Go package
NODE_TYPE // bashcurl -Lo /tmp/go${GOLANG_VERSION}.linux-amd64.tar.gz https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz -
Install the package into /usr/local
NODE_TYPE // bashsudo tar -C /usr/local -xzf /tmp/go${GOLANG_VERSION}.linux-amd64.tar.gz -
Edit
.bashrcsetting and add the installation directory to the pathNODE_TYPE // bashvi ~/.bashrc -
Insert the following configuration at the bottom of the .bashrc file
NODE_TYPE // bash# set PATH so it includes go installation if it exists if [ -d "/usr/local/go/bin" ] ; then # export GOPATH=$HOME/go PATH="/usr/local/go/bin:$PATH" fi -
Activate the updated settings
NODE_TYPE // bashsource ~/.bashrc -
Check the installation matches the installation version
NODE_TYPE // bashgo version
The above command will output the version of Go installed e.g.
go version go1.15 linux/amd64