aboutsummaryrefslogtreecommitdiffstats
path: root/example/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'example/main.go')
-rw-r--r--example/main.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/example/main.go b/example/main.go
index 46604d5..e2193be 100644
--- a/example/main.go
+++ b/example/main.go
@@ -10,6 +10,16 @@ import (
)
func main() {
+ file, err := os.Create("out.txt")
+ if err != nil {
+ fmt.Println("Couldn't create out.txt")
+ return
+ }
+ defer file.Close()
+ onExit := func() {
+ file.Write([]byte("On Exit..."))
+ file.Sync()
+ }
// Should be called at the very beginning of main().
systray.Run(onReady, onExit)
}
@@ -61,9 +71,3 @@ func onReady() {
}
}()
}
-
-func onExit() {
- file, _ := os.Create("out.txt")
- defer file.Close()
- file.Write([]byte("On Exit..."))
-}