How to return a error from a goroutine (through channels)

It’s common to bundle multiple outputs into a struct, and return them together over a single channel.

type Result struct {
    Message string
    Error error
}

ch := make(chan Result)

Leave a Comment