To get the currently installed version of Go, just type :
\n$ go version
\nThis will output something like that :
\ngo version go1.11.1 darwin/amd64
\nThe version is printed with the reference of your system (in my case Apple MacOS)
\n\nTo upgrade your system to a new version of go, you have to locate where Go is on your system.
\n$ which go
\nWich will locate the program file in the user path (cf. man which)
\nUsually (Linux and Mac users), if you type this on your system, it will display :
\n/usr/local/go/bin/go
\nFor windows users, the path where the go binaries are stored is usually.
\nC:\\Go\\bin
\nTo be sure, you can run the command :
\nc:\\> where go
\nWe have successfully located the binaries; now we can upgrade it
\n\nNew versions of Go are hosted on the golang.org website here: https://golang.org/dl/. Always download your go version from this official URL.
\nTo update your current version, download on this website the targeted version.
\nTo be sure that you have downloaded a valid binary, you have to compute the SHA256 sum of the downloaded file. Then you have to ensure that it is strictly equal to the one that is listed on the website (see 1).
\nTo check a sha256 sum, open a terminal and type :
\n$ shasum -a 256 go1.11.2.linux-amd64.tar.gz
\nThe a flag is used to indicate which algorithm to use (here it’s SHA256)
\n\nThe command is shorter :
\n$ sha256sum go1.11.2.linux-amd64.tar.gz
\n\nYou can use certutil to do so on the command prompt
\n> certutil -hashfile go1.11.2.linux-amd64.tar.gz SHA256
\n\nYou downloaded an installer. It will automatically install the selected version. Just double-click on the file downloaded.
\n\nFirst, you have to extract the archive downloaded with the following command :
\n$ sudo tar -C /usr/local -xzf go1.11.2.linux-amd64.tar.gz
\nIt will extract the contents of the tar.gz file into /usr/local
:
The bin directory contains two executables files at the time of writing :
\ngo
gofmt
To be able to launch go and gofmt commands, you will need to add this directory to your PATH. To do so, add this line at the top of the file .bashrc
located in your home directory. (or .zshrc
if you use zsh) :
export PATH=$PATH:/usr/local/go/bin
\nAfter that, you will need to restart your terminal for the change to take effect.
\n\nYou downloaded an installer. it will automatically install the selected version. Just double-click on the file downloaded.
\n\n \n \nPrevious
\n\t\t\t\t\t\t\t\t\tAn object oriented programming language ?
\n\t\t\t\t\t\t\t\tNext
\n\t\t\t\t\t\t\t\t\tDesign Recommendations
\n\t\t\t\t\t\t\t\t