Source

talks / go-intro / notes.md

Full commit

Meta

Go

  • 1997 in Google. Ken Thompson (C), Rob Pike (plan 9), Robert Griesemer (v8)
  • Went for the C++, got Python + Ruby
  • Rob Pike story on C++ header includes thousands
  • Linux, Mac and Windows(?). x86, x86 and ARM
  • go and GCC front end

Why Go

  • stdlib compiles in 0.3 seconds on my machine

Hello World

  • package
  • import
  • func
  • unicode

Hello World 2

  • net/http -> http.ListenAndServe

Declaration

  • const
  • iota
  • new(Point) -> 0 initializtion

Syntax

  • anonymous functions
  • type at end

range

Defer and Errors

  • How would you do that with exceptions?
  • Defered are LIFO
  • Error and last return value
  • More verbose but more robust
  • In if

Goroutines

A TCP Proxy

  • Write this in your favorite language for scale

Channels

Example

  • Comment out close - show deadlock

Select

  • Play with timeouts

Method

  • Talk about pointers vs copy

Interfaces

  • Many in stdlib (io.Writer)
  • interface{} -> void *

Packages

The go Tool

  • Dependencies
  • Versioning

<!-- vim: ft=markdown spell -->