diff options
| author | joesis | 2017-06-20 14:25:29 +0800 |
|---|---|---|
| committer | joesis | 2017-06-20 14:25:29 +0800 |
| commit | ef254071ef3abfdf0a220f76fcdd468d24bff519 (patch) | |
| tree | c827f0dfea906b6ed8a40675016f6009d5d5afb7 /example | |
| parent | 88b0d4795c7757790f4ea5fbc99e0f34b92bef0c (diff) | |
| download | systray-ef254071ef3abfdf0a220f76fcdd468d24bff519.tar.bz2 | |
update example
Diffstat (limited to 'example')
| -rw-r--r-- | example/main.go | 16 |
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...")) -} |
