Grokking Concurrency in Go
0% completed
Returning Errors from Goroutines
A nightly job fetches three pages at the same time and stores them. One night, one of the three addresses stops working. The goroutine that fetched it prints the error to the log and returns. The job then reports that it processed all three URLs, and the process exits with status 0. Nothing that watches the exit status sees a problem, and the missing page is noticed days later.
The program below reproduces the job. Its fetch is the one used throughout the course, extended to return an error for any URL that ends in /missing.
Output:
error: fetch https://example
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%