From 613ced5710d145b91dae6bc7b2496cc6d2248aea Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Mon, 9 Sep 2024 11:10:38 -0700 Subject: [PATCH] change else to else if, replace one case switch to if statement --- cmd/generate/config/config.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cmd/generate/config/config.go b/cmd/generate/config/config.go index 8fbab34..17d2431 100644 --- a/cmd/generate/config/config.go +++ b/cmd/generate/config/config.go @@ -104,10 +104,8 @@ func run(opts *Options) error { // AUTOMATIC: set every name and associated emails attributionMap[name] = append(attributionMap[name], email) } - } else { - if !slices.Contains(uniqueEmails, email) { - uniqueEmails = append(uniqueEmails, email) - } + } else if !slices.Contains(uniqueEmails, email) { + uniqueEmails = append(uniqueEmails, email) } return nil }) @@ -205,9 +203,10 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.textInput.SetSuggestions(existingUsers) - switch msg := msg.(type) { - case tea.KeyMsg: - switch msg.Type { + keyMsg, ok := msg.(tea.KeyMsg) + + if ok { + switch keyMsg.Type { case tea.KeyCtrlC, tea.KeyEsc: return m, tea.Quit