diff --git a/apps/go.mod b/apps/go.mod index c14a67c9..70205166 100644 --- a/apps/go.mod +++ b/apps/go.mod @@ -3,7 +3,7 @@ module gioui.org/apps go 1.12 require ( - gioui.org/ui v0.0.0-20190721200230-1ee8c08f3bf9 + gioui.org/ui v0.0.0-20190722093309-c080a54038a6 github.com/google/go-github/v24 v24.0.1 golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9 diff --git a/apps/gophers/main.go b/apps/gophers/main.go index 99f19094..0968231e 100644 --- a/apps/gophers/main.go +++ b/apps/gophers/main.go @@ -126,25 +126,12 @@ var theme struct { } func main() { + flag.Parse() + initProfiling() if *token == "" { fmt.Println("The quota for anonymous GitHub API access is very low. Specify a token with -token to avoid quota errors.") fmt.Println("See https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line.") } - app.Main() -} - -func initProfiling() { - if !*profile { - return - } - go func() { - log.Println(http.ListenAndServe("localhost:6060", nil)) - }() -} - -func init() { - flag.Parse() - initProfiling() go func() { fonts.regular = mustLoadFont(goregular.TTF) fonts.bold = mustLoadFont(gobold.TTF) @@ -164,6 +151,16 @@ func init() { log.Fatal(err) } }() + app.Main() +} + +func initProfiling() { + if !*profile { + return + } + go func() { + log.Println(http.ListenAndServe("localhost:6060", nil)) + }() } func colorMaterial(ops *ui.Ops, color color.RGBA) ui.MacroOp { diff --git a/apps/hello/hello.go b/apps/hello/hello.go index b7bd39e5..503d9fff 100644 --- a/apps/hello/hello.go +++ b/apps/hello/hello.go @@ -20,18 +20,13 @@ import ( ) func main() { - app.Main() -} - -// On iOS and Android main will never be called, so -// setting up the window must run in an init function. -func init() { go func() { w := app.NewWindow(nil) if err := loop(w); err != nil { log.Fatal(err) } }() + app.Main() } func loop(w *app.Window) error {