Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: don't shadow 'handler' type #779

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions tea.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,19 @@ const (
withoutCatchPanics
)

// handlers manages series of channels returned by various processes. It allows
// us to wait for those processes to terminate before exiting the program.
type handlers []chan struct{}
// channelHandlers manages the series of channels returned by various processes.
// It allows us to wait for those processes to terminate before exiting the
// program.
type channelHandlers []chan struct{}

// Adds a channel to the list of handlers. We wait for all handlers to terminate
// gracefully on shutdown.
func (h *handlers) add(ch chan struct{}) {
func (h *channelHandlers) add(ch chan struct{}) {
*h = append(*h, ch)
}

// shutdown waits for all handlers to terminate.
func (h handlers) shutdown() {
func (h channelHandlers) shutdown() {
var wg sync.WaitGroup
for _, ch := range h {
wg.Add(1)
Expand Down Expand Up @@ -406,7 +407,7 @@ func (p *Program) eventLoop(model Model, cmds chan Cmd) (Model, error) {
// terminated by either [Program.Quit], [Program.Kill], or its signal handler.
// Returns the final model.
func (p *Program) Run() (Model, error) {
handlers := handlers{}
handlers := channelHandlers{}
cmds := make(chan Cmd)
p.errs = make(chan error)
p.finished = make(chan struct{}, 1)
Expand Down
Loading