Closed jshawl closed 1 month ago
Thanks for the PR. So in this particular example, we're illustrating how to inject messages from outside a program with Program.Send()
. You’re correct that Goroutines shouldn't be used within a program, however in this case the Goroutine is actually outside the program in main
.
So all said, your changes are good ones in terms of how we generally recommend writing Bubble Tea programs, but in this case I'd prefer if we left this example as-is to illustrate how Program.Send
works.
Thank you @meowgorithm! Hopefully I’ll be back with another contribution in the future :)
This pull request replaces the goroutine with
tea.Tick()
in the send-msg example.From the blog post Commands in Bubble Tea:
I used this example to implement sending messages at an interval, but later discovered the tip in the blog post. Hopefully this example will communicate the best practice in addition to the blog post.
Thanks!