From 3fded1792bcc4bbd2b519222dbebc84cdd15f730 Mon Sep 17 00:00:00 2001 From: BoppreH Date: Fri, 6 Jun 2014 13:23:58 -0300 Subject: [PATCH] Replace label and break with defer and return --- main.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index a859b3f..339f814 100644 --- a/main.go +++ b/main.go @@ -95,12 +95,13 @@ func myMain() { grid.SetFilling(1, 1) w.Open(grid) + + defer stop() -mainloop: for { select { case <-w.Closing: - break mainloop + return case <-bStart.Clicked: stop() // only one alarm at a time alarmTime, err := time.Parse(timeFmt, timebox.Text()) @@ -135,9 +136,6 @@ mainloop: stop() } } - - // clean up - stop() } func main() {