Skip to Content
Concurrency in Go
book

Concurrency in Go

by Katherine Cox-Buday
July 2017
Intermediate to advanced
238 pages
5h 35m
English
O'Reilly Media, Inc.
Content preview from Concurrency in Go

Appendix A. Appendix

As you set forth on your journey of writing concurrent code, you’ll need the tools to write your program and analyze it for correctness, and a few helpful pointers to help you understand what’s happening within your programs. Lucky for you, the Go ecosystem has a rich set of tooling both from the Go team and from the community! This appendix will discuss some of these tools and how they can aid you before, during, and after development. Since this book is focused on concurrency, I’m going to constrain the conversation to only topics that help you write or analyze concurrent code. We’ll also briefly look at what happens when goroutines panic. It doesn’t happen often, but the output can be a bit confusing the first time you see it.

Anatomy of a Goroutine Error

It happens to the best of us: sooner or later, your program will panic. If you’re lucky, no humans or computers will be harmed in the process, and the worst that will happen is you’ll be staring down the bad end of a stack trace.

Prior to Go 1.6, when a goroutine panicked, the runtime would print stack traces of all the currently executing goroutines. Sometimes this made it difficult (or at least time-consuming) to determine what had happened. At the time of this writing, Go 1.6 and greater greatly simplify things by printing only the stack trace of the panicking goroutine.

For example, when this simple program is executed:

1 package main
2 
3 func main() {
4     waitForever := make(chan interface{})
5  ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Up and Running with Concurrency in Go (Golang)

Up and Running with Concurrency in Go (Golang)

Stan Vangilder
gRPC: Up and Running

gRPC: Up and Running

Kasun Indrasiri, Danesh Kuruppu

Publisher Resources

ISBN: 9781491941294Errata Page