Skip to Main Content
Effective Concurrency in Go
book

Effective Concurrency in Go

by Burak Serdar
April 2023
Intermediate to advanced content levelIntermediate to advanced
212 pages
4h 47m
English
Packt Publishing
Content preview from Effective Concurrency in Go

6

Error Handling

This chapter is about dealing with errors and panics in a concurrent program. First, we will look at how error handling can be incorporated into concurrent programs, including how to pass errors between goroutines so that you can handle or report them. Then we will talk about panics.

There are no hard and fast rules about dealing with errors and panics, but I hope some of the guidelines described in this chapter will help you write more robust code. The first guideline is this: never ignore errors. The second guideline tells you when to return an error and when to panic: the audience for errors is the users of the program; the audience for panics is the developers of the program.

This chapter contains the following sections: ...

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.
Start your free trial

You might also like

Concurrency in Go

Concurrency in Go

Katherine Cox-Buday

Publisher Resources

ISBN: 9781804619070Supplemental Content