September 2014: Docker, Templates, Packages.

Please RSVP at Meetup and/or Google+.

We get started at 6:30 pm, pizza is provided.

Talks

Docker

@fnichol

Docker has been taking the cloud by storm. Come learn about containers and distributed applications. (slides)

Related:

HTML Templates

@MatthiasStone followed up his earlier text/template introduction with html/template from the standard library. He first covered the basics — pipelines, the . cursor, field access on structs, range over slices and maps, fuzzy-false if conditions, and chaining method results in a pipeline — then moved to HTML-specific concerns: contextual auto-escaping and the typed string types (template.HTML, template.JS, template.CSS, template.URL, template.HTMLAttr) used to mark content safe in a particular context. The final example composed a small website from multiple {{define}}/{{template}} blocks loaded with ParseGlob and rendered per route with ExecuteTemplate.

Key points:

  • html/template behaves like text/template but escapes output for HTML context.
  • {{.}} is the cursor; pipelines pass values through functions.
  • range iterates slices/maps; if uses Go's fuzzy-false rules ("", 0, nil, false).
  • Methods can be chained in a pipeline (e.g. {{ .Times . | .Times}}).
  • Escaping is context-aware (HTML, attribute, JS, CSS, URL).
  • template.HTML/JS/CSS/URL/HTMLAttr opt a value out of escaping.
  • {{define}}/{{template}} compose reusable partials; ParseGlob loads them and ExecuteTemplate renders by name.

@MatthiasStone (code)

Packages and Dependencies

@nathany

Packages in the Go language and the surrounding tools. (slides)

Related:

News

Articles

Resources

Events