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

Go Proverbs

Go Proverbs

As presented by Rob Pike at Gopherfest SV, November 2015
Video: https://www.youtube.com/watch?v=PAAkCSZUG1c

Anthony Starks

November 22, 2015
Tweet

More Decks by Anthony Starks

Other Decks in Programming

Transcript

  1. Go Proverbs
    Don’t communicate by sharing memory, share memory by communicating.
    Concurrency is not parallelism.
    Channels orchestrate; mutexes serialize.
    The bigger the interface, the weaker the abstraction.
    Make the zero value useful.
    interface{} says nothing.
    Gofmt’s style is no one’s favorite, yet gofmt is everyone’s favorite.
    A little copying is better than a little dependency.
    Syscall must always be guarded with build tags.
    Cgo must always be guarded with build tags.
    Cgo is not Go.
    With the unsafe package there are no guarantees.
    Clear is better than clever.
    Reflection is never clear.
    Errors are values.
    Don’t just check errors, handle them gracefully.
    Design the architecture, name the components, document the details.
    Documentation is for users.
    Don’t panic.

    View full-size slide

  2. Don’t communicate
    by sharing memory,
    share memory by
    communicating.

    View full-size slide

  3. Concurrency is not
    parallelism.

    View full-size slide

  4. Channels orchestrate;
    mutexes serialize.

    View full-size slide

  5. The bigger the interface,
    the weaker the abstraction.

    View full-size slide

  6. Make the zero value
    useful.

    View full-size slide

  7. interface{} says nothing.

    View full-size slide

  8. Gofmt’s style is
    no one’s favorite,
    yet gofmt is everyone’s
    favorite.

    View full-size slide

  9. A little copying is
    better than a little
    dependency.

    View full-size slide

  10. Syscall must always
    be guarded with
    build tags.

    View full-size slide

  11. Cgo must always
    be guarded with
    build tags.

    View full-size slide

  12. Cgo is not Go.

    View full-size slide

  13. With the unsafe
    package there are
    no guarantees.

    View full-size slide

  14. Clear is better than
    clever.

    View full-size slide

  15. Reflection is never
    clear.

    View full-size slide

  16. Errors are values.

    View full-size slide

  17. Don’t just check
    errors, handle them
    gracefully.

    View full-size slide

  18. Design the architecture,
    name the components,
    document the details.

    View full-size slide

  19. Documentation
    is for users.

    View full-size slide

  20. Don’t panic.

    View full-size slide