Book #29 - Learning Go

Learning Go
by Jon Bodner (2021)

 

Meetup: https://www.meetup.com/the-south-padre-island-reading-group/events/286346715
Zoom: https://us02web.zoom.us/j/84281187589
Discord: https://bit.ly/35RhGXM
O’Reilly: https://learning.oreilly.com/library/view/learning-go/9781492077206/
Github: https://github.com/learning-go-book

 

Finished!

Congratulations everyone, we’ve finished the book!

Excellent book

 

Chapter 13
Writing Tests

June 17, 2020

Presenter

Chapter 13
Writing Tests

June 17, 2020

Presenter

The Basics of Testing

Amish

Table Tests

Amish

Checking Your Code Coverage

Sam

Benchmarks

Sam

Stubs in Go

Sam

httptest

Casey

Integration Tests and Build Tags

Casey

Finding Concurrency Problems with the Race Checker

Casey

We’re not interested in Chapter 14 (on Reflect, Unsafe, and Cgo), and we’d prefer to learn the final form of generics in Go elsewhere, so this is our final chapter of Learning Go!

 

Chapter 12
The Context

May 27, 2020

Presenter

Chapter 12
The Context

May 27, 2020

Presenter

What is the Context?

Amish

Cancellation

Sam

Timers

Sam

Handling Context Cancellation in Your Own Code

Casey

Values

Amish

 

Chapter 11
The Standard Library

May 20, 2022

Presenter

Chapter 11
The Standard Library

May 20, 2022

Presenter

io and Friends

Amish

time

Casey

encoding/json

Amish

net/http

Casey

 

Chapter 10
Concurrency in Go

May 6, 2022
May 13, 2022
May 20, 2022

Presenter

Chapter 10
Concurrency in Go

May 6, 2022
May 13, 2022
May 20, 2022

Presenter

When to Use Concurrency
Goroutines
Channels
select

Amish

Concurrency Practices and Patterns
- Keep Your APIs Concurrency-Free
- Goroutines, for Loops, and Varying Variables
- Always Clean Up Your Goroutines
- The Done Channel Pattern
- Using a Cancel Function to Terminate a Goroutine
- When to Use Buffered and Unbuffered Channels
- BackPressure

Casey

Concurrency Practices and Patterns
- Turning Off a case in a select
- How to Time Out Code
- Using WaitGroups
- Running Code Exactly Once
- Putting Our Concurrent Tools Together

Casey - May 13

When to Use Mutexes Instead of Channels
Atomics--You Probably Don’t Need These
Where to Learn More About Concurrency

Amish - May 19

 

Chapter 9
Modules, Packages, and Imports

April 22, 2022
April 29, 2022

Presenter

Chapter 9
Modules, Packages, and Imports

April 22, 2022
April 29, 2022

Presenter

Repositories, Modules, and Packages
go.mod
Building Packages
- Imports and Exports
- Creating and Accessing a Package
- Naming Packages

Casey

Building Packages
- How to Organize Your Module
- Overriding a Package’s Name
- Package Comments and godoc
- The internal Package

Rod

Building Packages
- The init Function: Avoid if Possible
- Circular Dependencies
- Gracefully Renaming and Reorganizing Your API

Amish

Working with Modules
- Importing Third-Party Code
- Working with Versions

Casey - April 29

Working with Modules
- Minimum Version Selection
- Updating to Compatible Versions
- Updating to Incompatible Versions
- Vendoring
- pkg.go.dev

Rod - April 29

Publishing Your Module
Versioning Your Module
Module Proxy Servers

Amish - April 29

 

Chapter 8
Errors

April 8, 2022

Presenter

Chapter 8
Errors

April 8, 2022

Presenter

How to Handle Errors: The Basics
Use Strings for Simple Errors
Sentinel Errors
Wrapping Errors

Amish

Is and As
Wrapping Errors with Defer
panic and recover
Getting a Stack Trace from an Error

Casey

 

Playground examples based on discussion from March 4

Chapter 7
Types, Methods, and Interfaces

March 4, 2022
March 11, 2022
March 18, 2022
March 25, 2022

Presenter

Chapter 7
Types, Methods, and Interfaces

March 4, 2022
March 11, 2022
March 18, 2022
March 25, 2022

Presenter

Types in Go
Methods - part 1
- Pointer Receivers and Value Receivers
- Code Your Methods for nil Instances
- Methods Are Functions Too
- Functions Versus Methods

Raja - March 4, 2022

Blog post by Connor
https://golangdistilled.ghost.io/p/9ad01ae0-c786-4ee8-be54-2d54f5833667/

Connor - March 11, 2022

Playground example by Casey
https://play.golang.com/p/mSKYgO2TqZz

Casey - March 11, 2022

Methods - part 2
- Type Declarations Aren’t Inheritance
- Types Are Executable Documentation
- iota Is for Enumerations--Sometimes

Birender - March 18, 2022

Use Embedding for Composition
Embedding Is Not Inheritance
A Quick Lesson on Interfaces
Interfaces Are Type-Safe Duck Typing

Amish - March 18, 2022

Embedding and Interfaces
Accept Interfaces, Return Structs
Interfaces and nil
The Empty Interface Says Nothing

Rod - March 18, 2022

Type Assertions and Type Switches
Use Type Assertions and Type Switches Sparingly
Function Types Are a Bridge to Interfaces

Casey - March 25, 2022

Implicit Interfaces Make Dependency Injection Easier
Wire
Go Isn’t Particularly Object-Oriented (and That’s Great)

Connor - April 8, 2022

Chapter 6
Pointers

February 25, 2022

Presenter

Chapter 6
Pointers

February 25, 2022

Presenter

A Quick Pointer Primer

Amish

Don’t Fear the Pointers
Pointers Indicate Mutable Parameters

Casey

Pointers Are a Last Resort
Pointer Passing Performance
The Zero Value Versus No Value

Amish

The Difference Between Maps and Slices

Raja

Slices as Buffers

Raja

Reducing the Garbage Collector’s Workload

Rush

Extra Reading(In this case watching!):
https://www.youtube.com/watch?v=ZMZpH4yT7M0

Chapter 5
Functions

February 18, 2022

Presenter

Chapter 5
Functions

February 18, 2022

Presenter

Declaring and Calling Functions - part 1

Casey

Declaring and Calling Functions - part 2
(starting with Multiple Return Values)

Amish

Functions are Values

Casey

Closures

Raja

defer

Connor

Go is Call By Value

Rod

 

Chapter 4
Blocks, Shadows, and Control Structures
February 11, 2022

Presenter

Chapter 4
Blocks, Shadows, and Control Structures
February 11, 2022

Presenter

Blocks

Birender

if

Birender

for, Four Ways - part 1

Birender

for, Four Ways - part 2
(starting with iterating over maps)

Amish

switch

Rod

Blank Switches
Choosing Between if and switch

Connor

goto--Yes, goto

Casey

 

Chapter 3
Composite Types

January 28, 2022

Presenter

Chapter 3
Composite Types

January 28, 2022

Presenter

Arrays--Too Rigid to Use Directly

Jens

Slices

Rod/Connor

Strings and Runes and Bytes

Amish

Maps

Casey

Structs

Connor

 

Chapter 2
Primitive Types and Declaration

January 21, 2022

Presenter

Chapter 2
Primitive Types and Declaration

January 21, 2022

Presenter

Built-in Types

Casey

var Versus :=

Casey

Using const
Typed and Untyped Constants

Amish

Unused Variables
Naming Variables and Constants

Amish

Chapter 1
Setting Up Your Go Environment

January 21, 2022

Presenter

Chapter 1
Setting Up Your Go Environment

January 21, 2022

Presenter

Installing the Go Tools
The Go Workspace
The go command

Casey

Linting and Vetting
Choose Your Tools
Makefiles
Staying Up to Date

Jens