Saturday, April 2, 2016

Go quick start

# wget https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz

# tar -C /usr/local -xzf go1.6.linux-amd64.tar.gz

# vim ~/.bash_profile

export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/work

# source ~/.bash_profile

# go version

go version go1.6 linux/amd64

# mkdir ~/work/src/github.com/username/hello

# vim test.go

package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}

# go run test.go

hello, world

Reference:

https://golang.org/doc/install

No comments: