Sunday 10 May 2015

Go, Docker, Joyent, and New Relic


Go, Docker, Joyent, and New Relic IN PROGRESS

  • Go Language Installation: 
    • Download and install GoLang installer here
    • Download and install Go Tools to /usr/local/go and include /usr/local/go/bin in PATH env and restart terminal
 $ mkdir $HOME/code/workspace_go
 $ export GOPATH=$HOME/code/workspace_go
 $ export PATH=$PATH:$GOPATH/bin
    • Create Base Path
$ mkdir -p $GOPATH/src/github.com/ltfschoen
    • Create First Program
$ mkdir $GOPATH/src/github.com/ltfschoen/go_test/hello
    • Create hello.go file (ready to use the reverse.go Package dependency)

package main 

import (
"fmt"
"github.com/ltfschoen/go_test/stringutil"

func main() {
fmt.Printf(stringutil.Reverse("!oG ,olleH\n"))
}
    • Build and Run binary to test Go Tool installation success

        $ go install github.com/ltfschoen/go_test/hello

        $ $GOPATH/bin/hello
    • Setup Git Repo

$ cd $GOPATH/src/github.com/ltfschoen/go_test/hello
$ git init
$ git remote add origin git@github.com:ltfschoen/GoTest.git
$ git add --all .
$ git commit -m "Initial commit"
$ git pull origin master
$ git push origin master
    • Write Go library (with Package directory)
$ mkdir $GOPATH/src/github.com/ltfschoen/go_test/stringutil
    • Create Package dependency stringutil reverse.go and test compilation success 
      • Note: 'go install' produces an output file, placing the package object inside the pkg directory of the workspace)
$ go build github.com/ltfschoen/go_test/stringutil
    • Install hello.go program using the Go Tool to install the reverse.go Package and other dependencies
$ go install github.com/ltfschoen/go_test/hello
    • Create reverse_test.go file with functions to be run by the Go Testing Framework and Package and Run Go Test
$ touch $GOPATH/src/github.com/ltfschoen/go_test/stringutil/reverse_test.go$ go test github.com/ltfschoen/go_test/stringutil 

References:
Books
  • 50% READ Docker New Relic Preview Edition
  • 50% READ Programming in Go
  • TODO Orchestrating Docker
  • TODO The Go Programming Language
Events

No comments:

Post a Comment