Blog > detail

Just my tiny mind

Install Go Programming Language in Ubuntu

26-2-2012 Admin General 2 Comments

I know that Go Lang is not a new programming language. However, The reason I write down this is for me to easily remember the How To that I find in the internet. And to make me easier to do it again in the future.

  • Run apt-get to install Go Lang

sudo apt-get install golang


  • Set Go path:

mkdir -p ~/go;

echo "export GOPATH=$HOME/go" >> ~/.bashrc;

echo "export PATH=$PATH:$HOME/go/bin:/usr/local/go/bin" >> ~/.bashrc;


  • Create directory src/github.com/user/hello inside your $home/go directory.

exp: /home/user/go/src/github.com/user/hello


  • Create a file hello.go inside /home/user/go/src/github.com/user/hello
  • Edit the file and put your code

exp:

package main

import "fmt"


func main() {

    fmt.Println("hello world")

}

  • Compile

$ go install github.com/user/hello


  • Run

$ $GOPATH/bin/hello

I hope this tips can help anyone who want to install Go programming Language in Ubuntu.


 


Source:


https://github.com/ethereum/go-ethereum/wiki/Installing-Go


https://golang.org/doc/install