Print error (and exit) if there's trouble when starting the example program

This commit is contained in:
Christian Rocha 2020-01-11 10:45:15 -05:00
parent 293c2f6696
commit d9cf7d1477
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018
1 changed files with 3 additions and 1 deletions

View File

@ -9,7 +9,9 @@ type Model int
func main() { func main() {
p := tea.NewProgram(0, update, view) p := tea.NewProgram(0, update, view)
p.Start() if err := p.Start(); err != nil {
fmt.Println("could not start program:", err)
}
} }
func update(msg tea.Msg, model tea.Model) (tea.Model, tea.Cmd) { func update(msg tea.Msg, model tea.Model) (tea.Model, tea.Cmd) {