July 2025 Go Meetup

Meetup #76 on July 16 in person at Edmonton Unlimited at 6:00 pm.

Please RSVP at Meetup

News

Agenda

Hello, World! Your first Go program

Peter Preeper walked through setting up a Go development environment and writing a first Go program. He pointed to go.dev/dl for downloads and briefly covered $GOPATH and modules with go mod init, then broke down the anatomy of main.go: package main, import "fmt", and func main() as the entry point. The talk covered variable declaration with var versus short :=, basic types like int, string, and bool, and printing with fmt.Println and fmt.Printf. It also demonstrated control flow — if/else, C-style and while-like for loops, and ranging over an int — plus basic maps and a live example that switched greetings by language flag. It finished with the build/run/test/benchmark commands.

Key points:

  • Install Go from go.dev/dl; start a module with go mod init.
  • Anatomy: package main, import "fmt", func main().
  • Variables use var or short :=; core types are int, string, bool.
  • Output via fmt.Println and fmt.Printf.
  • Control flow: if/else, C-style/while-like for, and range over an int.
  • Maps are iterated with for key, value := range.
  • Build/run/test/bench with go build, go run, and go test -bench.

presentation

Go Todo

Peter Preeper built a small web-based todo app in Go to show how you'd approach a real project. The app stores todos in an in-memory slice behind a sync.RWMutex, with methods to add, toggle, complete, and delete items, and an auto-incrementing ID. It renders a single HTML page with html/template, using range over the todos and conditional classes for completed items. Each action is handled by an http.HandleFunc route (/add, /toggle, /delete) that reads form values and redirects with http.StatusSeeOther, serving server-rendered HTML on :8080. The example is deliberately compact but demonstrates concurrency safety, the standard library's HTTP server, and template rendering.

Key points:

  • A single-file web app using only the standard library.
  • Todos live in an in-memory slice guarded by a sync.RWMutex.
  • CRUD methods add, toggle, and delete items with auto-incrementing IDs.
  • html/template renders the list, with conditional styling for completion.
  • Form POST handlers route to /add, /toggle, and /delete.
  • Handlers redirect back to / with http.StatusSeeOther.
  • Server runs with http.ListenAndServe(":8080", nil).

presentation

Future Topics Discussion

Open discussion on topic for future talks, workshops, activities.

Events

  • Edmonton Go Meetup August