Skip to content

Instantly share code, notes, and snippets.

@jandre
Last active August 29, 2015 14:09

Revisions

  1. jandre revised this gist Nov 19, 2014. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -32,6 +32,10 @@ build a go lib and binary
    7. references!
    1. http://www.golang-book.com/
    2. https://gist.github.com/jandre/8216047

    8. code examples
    1. web stuff - gogs.io https://github.com/gogits/gogs
    2. simple project to learn from: https://github.com/sourcegraph/go-papertrail/



  2. jandre revised this gist Nov 19, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,8 @@ build a go lib and binary
    1. Use full sentences (e.g. https://github.com/tools/godep/blob/master/main.go#L13-L33)
    2. godoc.org: e.g. http://godoc.org/github.com/jandre/procfs
    9. importing other libraries (use debug example) and go get
    10. pointers?
    10. structs, objects
    11. pointers?
    11. reflection?
    12. managing dependencies (https://github.com/tools/godep)
    1. how you want to organize things? e.g. using a makefile (to set GOPATH, setup deps, etc)
  3. jandre created this gist Nov 19, 2014.
    36 changes: 36 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@

    build a go lib and binary


    1. installing go
    1. OS X: brew install go
    2. Linux: https://github.com/dcoxall/vagrant-golang ?
    3. organizing your code
    1. GOPATH export GOPATH=/Users/jandre/godemo
    2. WORKSPACE https://golang.org/doc/code.html
    3. vim go (https://github.com/fatih/vim-go)
    4. :GoInstallBinaries
    5. code
    1. create a lib (exporting functions)
    1. package naming
    2. exporting functions
    3. how to build (go build)
    3. create a binary that consumes lib
    1. demo how goimports auto imports stuff from stdlib
    2. package = main
    5. create a tests (go test)
    6. goroutines (NOT COVERED)
    7. documentation
    1. Use full sentences (e.g. https://github.com/tools/godep/blob/master/main.go#L13-L33)
    2. godoc.org: e.g. http://godoc.org/github.com/jandre/procfs
    9. importing other libraries (use debug example) and go get
    10. pointers?
    11. reflection?
    12. managing dependencies (https://github.com/tools/godep)
    1. how you want to organize things? e.g. using a makefile (to set GOPATH, setup deps, etc)
    7. references!
    1. http://www.golang-book.com/
    2. https://gist.github.com/jandre/8216047