ChainSafe / gossamer

🕸️ Go Implementation of the Polkadot Host
https://chainsafe.github.io/gossamer
GNU Lesser General Public License v3.0
427 stars 110 forks source link

refactor: rename channel done to errChan #3979

Open EmilGeorgiev opened 4 months ago

EmilGeorgiev commented 4 months ago

Issue summary

In the type Service we have a field 'done' of type 'chan error'

 type Service struct {
    settings Settings
    server   Runner
    cancel   context.CancelFunc
    done     chan error
}

Renaming the 'done' channel to errChan can improve code readability by making it more clear what type of information the channel is intended to convey. The purpose of the done channel in your original code is to communicate errors that occur during the server’s runtime. Therefore, renaming it to errChan can make the code more intuitive.

A done channel in Go is not used to convey error types. Instead, it is generally used for signaling the completion or termination of goroutines. In Go, channels are often used to communicate between goroutines, and while a done channel usually signals completion, an error channel can be specifically designated for communicating errors.

EmilGeorgiev commented 3 months ago

If you think this makes sense, can I take this issue?