1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Clean up a bunch of if statements based on govet results

This commit is contained in:
Chris Cummer
2018-08-03 05:40:39 -07:00
parent 1f27cf5b00
commit 72c192cabf
12 changed files with 38 additions and 37 deletions

View File

@@ -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)
}

View File

@@ -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 {

View File

@@ -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