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:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user