Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Contributing to Go

Contributing to Go

Motivation and How-to for contributing to Go.

Nathan Youngman

May 26, 2014
Tweet

More Decks by Nathan Youngman

Other Decks in Technology

Transcript

  1. Naming things func validateFlags() error “notice that the purpose of

    this is to set up state; the validation is secondary. it's misnamed.” - r
  2. Error messages "phrasing: say what's wrong, not how to fix

    it.” ! return fmt.Errorf("unexpected argument provided”) “this isn't quite right. "extra argument"? "too many arguments"?” - r
  3. Code style pathsToRemove := make([]string, 0) ! “Just write: !

    var pathsToRemove []string” - iant! https://code.google.com/p/go-wiki/wiki/CodeReviewComments
  4. Effective use of the standard library ! atomic.AddInt32(&c.val, 1) !

    “use ioutil.TempDir to create a unique root for this test run” - dfc!
  5. – rsc “The goal here should be to expose the

    minimal necessary functionality that lets people build useful things…” API design
  6. – rsc “The problem with callbacks is that you now

    have to worry about user code blocking (or panicking) a library goroutine. ! A channel is a much better separation.” I hadn’t considered…
  7. – rsc “There is no testing benefit here to the

    interface over a simple struct with only public fields.” Keep it simple
  8. –Chad Fowler “Pick an open source project that you admire

    and whose developers appear to be at that "next level" you’re looking to reach.” Motivation
  9. Go source # Mac
 xcode-select --install
 brew install hg
 


    hg clone https://code.google.com/p/go
 cd go/src
 ./all.bash golang.org/doc/install/source
  10. go.tools • godoc • vet • cover • oracle •

    goimports go get code.google.com/p/go.tools/cmd/godoc
  11. CDPATH # .bashrc
 export CDPATH=.:$HOME/go/src/pkg:$GOPATH/ src/code.google.com/p
 
 # .zshrc
 setopt

    auto_cd
 cdpath=($HOME/go/src/pkg $GOPATH/src/ code.google.com/p) cd net/http
  12. rietveld “not the same as using standard Mercurial” # .hg/hgrc


    [extensions]
 codereview = ~/go/lib/codereview/codereview.py
 
 [ui]
 username = Your Name <[email protected]> tip.golang.org/doc/contribute.html
  13. CL