I'm trying to install drive, which requires Go.
I did:
sudo apt-get install golang git mercurialwhich successfully installed version 1.2.1. Unfortunately, when I tried to install drive with:
go get -u I encountered this error, and now I see I need at least version 1.4 of Go to make things work. The golang doc says you must first remove the existing version.
So I came across this question that says to simply use:
sudo apt-get purge golangwhich gave me this output:
The following packages will be REMOVED:
golang*
0 upgraded, 0 newly installed, 1 to remove and 16 not upgraded.
After this operation, 92.2 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 263287 files and directories currently installed.)
Removing golang (2:1.2.1-2ubuntu1) ...(no more output after the three dots—just back to the prompt).
But I still see the go directory in /usr/lib/, and there's also still a gopath directory in my home directory.
which I think was created when I did:
$ cat << ! >> ~/.bashrc
> export GOPATH=\$HOME/gopath
> export PATH=\$GOPATH:\$GOPATH/bin:\$PATH
> !
$ source ~/.bashrc # To reload the settings and get the newly set ones # Or open a fresh terminalduring the installation (to create the GOPATH).
So I'm not sure if the uninstall was successful and if it's safe to install a newer version of Go.
Ubuntu 14.04 LTS
24 Answers
I spent a whole morning fixing this, tried all different solutions, when I type go version, it's still there, really annoying...
This worked for me.
sudo apt-get remove golang-go
sudo apt-get remove --auto-remove golang-go 1 I realize that this is a little old, but the answers at may help you.
Essentially just removing the directories /usr/local/go or /usr/lib/go and modifying your path at /etc/profile or $HOME/.profile should be enough.
best way to uninstall is to open terminal and type
sudo apt-get uninstall purge golang*this removes every package associated with go. Then you can run
sudo apt-get updateBut if you did that and nothing worked, you can do this
sudo rm -rf /usr/local/gothen try running the purge again. But You should update to Go 1.8, which sets the GOPATH for you. But hey! before updating first remove existing golang.
First you have to remove all the go-packages in your system by type this code from terminal
sudo apt-get purge golang*Then follow the instructions to download and install golang