From 759fdb2efefffdbb3841966b9d8e14ef83bd58e1 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 12 Jul 2019 15:41:10 +0200 Subject: [PATCH] apps/gophers: simplify type switch Signed-off-by: Elias Naur --- apps/gophers/main.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/gophers/main.go b/apps/gophers/main.go index 244d525d..3ef3f779 100644 --- a/apps/gophers/main.go +++ b/apps/gophers/main.go @@ -198,16 +198,14 @@ func (a *App) run() error { a.w.Redraw() case e := <-a.w.Events(): switch e := e.(type) { - case input.Event: - if e, ok := e.(key.ChordEvent); ok { - switch e.Name { - case key.NameEscape: - os.Exit(0) - case 'P': - if e.Modifiers.Contain(key.ModCommand) { - a.profiling = !a.profiling - a.w.Redraw() - } + case key.ChordEvent: + switch e.Name { + case key.NameEscape: + os.Exit(0) + case 'P': + if e.Modifiers.Contain(key.ModCommand) { + a.profiling = !a.profiling + a.w.Redraw() } } case app.StageEvent: