February 2016: Go 1.6 release party

Please RSVP at Meetup or Google+.

We get things started at 6:30 pm.

Sponsors

Food provided by Bellstone Engineering.

Venue provided by Startup Edmonton.

eBook Giveaway from Manning Publications:

Talks

Go 1.6 was released on February 17th. We will be discussing the changes during our February meetup.

What's new in html/template?

Brett McKay will cover blocks and other new features in text/template and html/template. (code)

What's new in managing third-party dependencies?

Gerrit Renker explained how Go 1.6 made the vendor/ directory an official part of the build tool, and what that means for managing third-party dependencies. Because go get is mono-revision with no notion of package version, the recommended approach has been to copy dependencies into your own repository so builds are reproducible — but your copy can drift from upstream, and forking to carry a local fix requires rewriting import paths and is awkward with pull requests. The vendor experiment solves this by letting a package keep its own copy of a dependency under a vendor/ folder, resolved with GO15VENDOREXPERIMENT=1 (on by default in Go 1.6, and ignored from Go 1.7). He walked through the $GOPATH layout before and after vendoring, and surveyed the tooling that supports it — Godep, gvt, govendor, and the gb project tool.

Key points:

  • go get is mono-revision; Go has no built-in package versioning.
  • Vendoring keeps a copy of a dependency inside your project for reproducible builds.
  • vendor/ takes precedence over $GOPATH; GO15VENDOREXPERIMENT=1 enabled it by default in Go 1.6.
  • Carrying local fixes in vendor/ avoids forking and import-path rewrites.
  • Tools: Godep, gvt, govendor, and gb all support the vendor experiment.
  • Go 1.7 later removed the need for the environment variable.

slides

What's new in cgo?

Matthias Stone covered the new cgo pointer-passing rules introduced in Go 1.6. cgo lets Go call into C (and, since Go 1.5, lets C call back into Go), but passing pointers between the two memory managers is dangerous because memory may be allocated or freed by either side. The Go 1.6 rules are simple: a Go pointer passed to C must not point to memory that itself contains Go pointers, and C must not retain the pointer after the call returns; conversely, C may return pointers it owns to Go, but Go will not free them — C must. The runtime now checks these rules at run time, printing a diagnosis and crashing on a violation, and although the checks can be disabled with GODEBUG=cgocheck=0, almost all flagged code is subtly incompatible with garbage collection, so disabling them only tends to produce more mysterious failures.

Key points:

  • cgo bridges Go and C; since Go 1.5 C code can call Go.
  • Memory may be owned by either Go or C — sharing pointers is dangerous.
  • Go→C: the pointed-to object must contain no pointers to Go memory, and C must not retain the pointer.
  • C→Go: C may hand back pointers it manages, but must free them itself.
  • Go 1.6's runtime checks print a diagnosis and crash on violations.
  • GODEBUG=cgocheck=0 disables checks but usually hides real GC bugs.

slides

What's new in net/http?

Nathan Youngman will share his experiences using HTTP/2, a new feature in Go 1.6. (slides)

News

Events

  • Monthly Hack Day - March 5 (Registration required)
  • Edmonton Go Meetup - March