New Go Features 1.18 - 1.26
I started writing Go at GS with version 1.17, so 1.18 is roughly where “modern Go” begins for me. Since then, Go has added quite a few features that make day-to-day engineering work more pleasant. I will focus on the parts that affect normal backend/service code: concurrency, error handling, testing, collections, routing and tools. sync.WaitGroup.Go (1.25) Before Go 1.25, the common WaitGroup pattern looks like this: var wg sync.WaitGroup for _, job := range jobs { job := job wg.Add(1) go func() { defer wg.Done() process(job) }() } wg.Wait() This is not terrible, but it is easy to put Add in the wrong place or forget Done. The same boilerplate also appears in many places once a codebase has many goroutines. ...