diff --git a/checklist/checklist_item.go b/checklist/checklist_item.go index f1bb1547..c7d6ab56 100644 --- a/checklist/checklist_item.go +++ b/checklist/checklist_item.go @@ -15,9 +15,9 @@ type ChecklistItem struct { func (item *ChecklistItem) CheckMark() string { if item.Checked { return wtf.Config.UString("wtf.mods.todo.checkedIcon", "x") - } else { - return " " } + + return " " } // Toggle changes the checked state of the ChecklistItem diff --git a/cmdrunner/widget.go b/cmdrunner/widget.go index 28c78877..47b22a14 100644 --- a/cmdrunner/widget.go +++ b/cmdrunner/widget.go @@ -45,9 +45,9 @@ func (widget *Widget) String() string { if args != "" { return fmt.Sprintf(" %s %s ", widget.cmd, args) - } else { - return fmt.Sprintf(" %s ", widget.cmd) } + + return fmt.Sprintf(" %s ", widget.cmd) } func (widget *Widget) execute() { diff --git a/gcal/cal_event.go b/gcal/cal_event.go index c119b9c7..da96f072 100644 --- a/gcal/cal_event.go +++ b/gcal/cal_event.go @@ -50,9 +50,9 @@ func (calEvent *CalEvent) Past() bool { if calEvent.AllDay() { // FIXME: This should calculate properly return false - } else { - return (calEvent.Now() == false) && calEvent.Start().Before(time.Now()) } + + return (calEvent.Now() == false) && calEvent.Start().Before(time.Now()) } func (calEvent *CalEvent) ResponseFor(email string) string { @@ -97,8 +97,8 @@ func (calEvent *CalEvent) Timestamp() string { if calEvent.AllDay() { startTime, _ := time.Parse("2006-01-02", calEvent.event.Start.Date) return startTime.Format(wtf.FriendlyDateFormat) - } else { - startTime, _ := time.Parse(time.RFC3339, calEvent.event.Start.DateTime) - return startTime.Format(wtf.MinimumTimeFormat) } + + startTime, _ := time.Parse(time.RFC3339, calEvent.event.Start.DateTime) + return startTime.Format(wtf.MinimumTimeFormat) } diff --git a/gcal/client.go b/gcal/client.go index 4523ebb7..79d9838b 100644 --- a/gcal/client.go +++ b/gcal/client.go @@ -73,9 +73,9 @@ func Fetch() ([]*CalEvent, error) { timeDateChooser := func(event *calendar.Event) (time.Time, error) { if len(event.Start.Date) > 0 { return time.Parse("2006-01-02", event.Start.Date) - } else { - return time.Parse(time.RFC3339, event.Start.DateTime) } + + return time.Parse(time.RFC3339, event.Start.DateTime) } sort.Slice(events.Items, func(i, j int) bool { diff --git a/gcal/display.go b/gcal/display.go index 76b1cc2c..2290a5d2 100644 --- a/gcal/display.go +++ b/gcal/display.go @@ -109,9 +109,9 @@ func (widget *Widget) dayDivider(event, prevEvent *CalEvent) string { func (widget *Widget) descriptionColor(calEvent *CalEvent) string { if calEvent.Past() { return wtf.Config.UString("wtf.mods.gcal.colors.past", "gray") - } else { - return wtf.Config.UString("wtf.mods.gcal.colors.description", "white") } + + return wtf.Config.UString("wtf.mods.gcal.colors.description", "white") } func (widget *Widget) eventSummary(calEvent *CalEvent, conflict bool) string { @@ -127,9 +127,9 @@ func (widget *Widget) eventSummary(calEvent *CalEvent, conflict bool) string { if conflict { return fmt.Sprintf("%s %s", wtf.Config.UString("wtf.mods.gcal.conflictIcon", "🚨"), summary) - } else { - return summary } + + return summary } // timeUntil returns the number of hours or days until the event diff --git a/security/dns.go b/security/dns.go index 2064ecf7..16cf630d 100644 --- a/security/dns.go +++ b/security/dns.go @@ -52,7 +52,7 @@ func dnsMacOS() []string { if len(lines) > 0 { return lines - } else { - return []string{} } + + return []string{} } diff --git a/security/wifi.go b/security/wifi.go index e1def558..b178e9b4 100644 --- a/security/wifi.go +++ b/security/wifi.go @@ -83,9 +83,9 @@ func wifiNameMacOS() string { func matchStr(data [][]string) string { if len(data) <= 1 { return "" - } else { - return data[1][1] } + + return data[1][1] } //Windows diff --git a/system/widget.go b/system/widget.go index 67d69cbd..069b0a18 100644 --- a/system/widget.go +++ b/system/widget.go @@ -48,9 +48,10 @@ func (widget *Widget) Refresh() { func (widget *Widget) prettyDate() string { str, err := time.Parse(wtf.TimestampFormat, widget.Date) + if err != nil { return err.Error() - } else { - return str.Format("Jan _2, 15:04") } + + return str.Format("Jan _2, 15:04") } diff --git a/wtf/colors.go b/wtf/colors.go index 938178f2..b46be59b 100644 --- a/wtf/colors.go +++ b/wtf/colors.go @@ -425,9 +425,9 @@ func ASCIItoTviewColors(text string) string { func colorFor(label string) tcell.Color { if _, ok := colors[label]; ok { return colors[label] - } else { - return tcell.ColorGreen } + + return tcell.ColorGreen } func replaceWithHexColorString(substring string) string { diff --git a/wtf/focus_tracker.go b/wtf/focus_tracker.go index f3a91c83..a5f95454 100644 --- a/wtf/focus_tracker.go +++ b/wtf/focus_tracker.go @@ -7,9 +7,9 @@ import ( type FocusState int const ( - Widget FocusState = iota - AppBoard - NeverFocused + widgetFocused FocusState = iota + appBoardFocused + neverFocused ) // FocusTracker is used by the app to track which onscreen widget currently has focus, @@ -42,7 +42,7 @@ func (tracker *FocusTracker) FocusOn(char string) bool { return false } - if tracker.focusState() == AppBoard { + if tracker.focusState() == appBoardFocused { return false } @@ -65,7 +65,7 @@ func (tracker *FocusTracker) FocusOn(char string) bool { // Next sets the focus on the next widget in the widget list. If the current widget is // the last widget, sets focus on the first widget. func (tracker *FocusTracker) Next() { - if tracker.focusState() == AppBoard { + if tracker.focusState() == appBoardFocused { return } @@ -76,7 +76,7 @@ func (tracker *FocusTracker) Next() { // None removes focus from the currently-focused widget. func (tracker *FocusTracker) None() { - if tracker.focusState() == AppBoard { + if tracker.focusState() == appBoardFocused { return } @@ -86,7 +86,7 @@ func (tracker *FocusTracker) None() { // Prev sets the focus on the previous widget in the widget list. If the current widget is // the last widget, sets focus on the last widget. func (tracker *FocusTracker) Prev() { - if tracker.focusState() == AppBoard { + if tracker.focusState() == appBoardFocused { return } @@ -156,16 +156,16 @@ func (tracker *FocusTracker) focusableAt(idx int) Wtfable { func (tracker *FocusTracker) focusState() FocusState { if tracker.Idx < 0 { - return NeverFocused + return neverFocused } for _, widget := range tracker.Widgets { if widget.TextView() == tracker.App.GetFocus() { - return Widget + return widgetFocused } } - return AppBoard + return appBoardFocused } func (tracker *FocusTracker) increment() { diff --git a/wtf/text_widget.go b/wtf/text_widget.go index be38f41c..aabc2ebd 100644 --- a/wtf/text_widget.go +++ b/wtf/text_widget.go @@ -57,9 +57,9 @@ func (widget *TextWidget) BorderColor() string { func (widget *TextWidget) ContextualTitle(defaultStr string) string { if widget.FocusChar() == "" { return fmt.Sprintf(" %s ", defaultStr) - } else { - return fmt.Sprintf(" %s [darkgray::u]%s[::-][green] ", defaultStr, widget.FocusChar()) } + + return fmt.Sprintf(" %s [darkgray::u]%s[::-][green] ", defaultStr, widget.FocusChar()) } func (widget *TextWidget) Disable() { diff --git a/wtf/utils.go b/wtf/utils.go index 4d859a6b..01f351f3 100644 --- a/wtf/utils.go +++ b/wtf/utils.go @@ -119,9 +119,9 @@ func RowColor(module string, idx int) string { if idx%2 == 0 { return Config.UString(evenKey, "white") - } else { - return Config.UString(oddKey, "lightblue") } + + return Config.UString(oddKey, "lightblue") } func SigilStr(len, pos int, view *tview.TextView) string {