Running sudo apt-get install golang-stable
, I get Go version go1.0.3
. Is there any way to install go1.1.1
?
Remove the existing Go version:
sudo apt-get purge golang*
Install the latest version of Go:
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt-get update
sudo apt-get install golang-go
Create the .profile
file in the home path with this content:
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
Set Go workspace to the environment variable:
GOPATH=~/.go
Apply the .profile
configuration:
source ~/.profile
Test:
$ go version
go version go1.11.1 linux/amd64
Ref: Go-GitHub-Installation