You can download Golang from its official web: https://golang.org/dl/ and download tar.gz package.
Extract this tar.gz package and the apply this command to the folder:
sudo chown -R root:root ./go
Copy the "go" folder in this route /usr/local/ with:
sudo mv go /usr/local
**Note: ** /usr/local/go is the officially recommended location by golang official page.
Configure the go paths. In the terminal write this:
sudo nano ~/.profile
And end of the file add this line:
export GOPATH=$HOME/work export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
Caution: You have to create the "work" folder in /home before next step.
With the appropriate line pasted into your profile, save and close the file. Next, refresh your profile by running in terminal:
source ~/.profile
In /home/work create this folders... mkdir -p work/src/github.com/user/hello
In "hello" folder you nedd to create a .go file, in this case "helloworld.go"
nano ~/work/src/github.com/user/hello/helloworld.go
Inside the helloworld.go write this lines:
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
This program will print "Hello world" if it successfully runs.