Golang Install

on Ubuntu/Mint/Debian

  1. Update repos

  2. apt-get update

    1. get the tar ball

    2. sudo curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz

  3. untar pkg

  4. tar -xvf go1.6.linux-amd64.tar.gz

  5. Move to usr directory

  6. mv go /usr/local

    1. Set Env

    2. vi ~/.profile

    3. export GOROOT=/usr/local/go

    4. export GOPATH=/home/user/golang

    5. export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

  1. create new project

  2. mkdir $GOPATH/projectName/src/github.com/YourGitName/

  3. vi hello.go

  4. package main

  5. import "fmt"

  6. func main () {

  7. fmt.Println("hello world")

  8. }

  9. Run the test code

  10. go run $GOPATH/projectName/hello.go