goinstallationgo-build

Golang installation


I just followed the installation guide for golang (ubuntu 16). I extracted the archive at /etc/usr I added env variable in /home/user/.profile I just tested a basic go build on the hello world code.

I get the following error:

The program 'go' is currently not installed. You can install it by typing: sudo apt install golang-go

Why does it ask me to install it (again?)?


Solution

  • The location of the binary go is not in your path. Ubuntu does not find it and suggests to install it. Add this line to your file /etc/profile, or better $HOME/.profile:

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

    This is documented in the docs: https://golang.org/doc/install#install

    If you want to try this solution before editing any files, you can just execute the above command and try to execute the go command in the shell.