From 6947657f64c6ca49f1fd3c1925d01326b04725fb Mon Sep 17 00:00:00 2001 From: Chris Roy Date: Sat, 7 Mar 2026 19:04:48 -0500 Subject: [PATCH 1/2] fixed lint warnings from the updated golangci-lint. removed nil check with len in gcal, and moved to Fprintf inplace of Sprintf --- modules/gcal/display.go | 2 +- modules/uptimekuma/widget.go | 14 +++++++------- view/bargraph.go | 19 +++++++++---------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/modules/gcal/display.go b/modules/gcal/display.go index 684fa94c2..6de13c1d8 100644 --- a/modules/gcal/display.go +++ b/modules/gcal/display.go @@ -21,7 +21,7 @@ func (widget *Widget) content() (string, string, bool) { return title, widget.err.Error(), true } - if (calEvents == nil) || (len(calEvents) == 0) { + if len(calEvents) == 0 { return title, "No calendar events", false } diff --git a/modules/uptimekuma/widget.go b/modules/uptimekuma/widget.go index 668468c1c..f8c2a215c 100644 --- a/modules/uptimekuma/widget.go +++ b/modules/uptimekuma/widget.go @@ -141,14 +141,14 @@ func (widget *Widget) content() string { if statusCounts[DOWN] == 0 { downColor = "green" } - builder.WriteString(fmt.Sprintf("[%s] Up: [green]%d", textColor, statusCounts[UP])) - builder.WriteString(fmt.Sprintf("[%s] (%.1f%%)", textColor, avgUptime)) - builder.WriteString(fmt.Sprintf("[%s], Down: [%s]%d", textColor, downColor, statusCounts[DOWN])) + fmt.Fprintf(&builder, "[%s] Up: [green]%d", textColor, statusCounts[UP]) + fmt.Fprintf(&builder, "[%s] (%.1f%%)", textColor, avgUptime) + fmt.Fprintf(&builder, "[%s], Down: [%s]%d", textColor, downColor, statusCounts[DOWN]) if statusCounts[MAINTENANCE] > 0 { - builder.WriteString(fmt.Sprintf("[%s], Maint: [%s]%d", textColor, "blue", statusCounts[MAINTENANCE])) + fmt.Fprintf(&builder, "[%s], Maint: [%s]%d", textColor, "blue", statusCounts[MAINTENANCE]) } if statusCounts[PENDING] > 0 { - builder.WriteString(fmt.Sprintf("[%s], Pend: [%s]%d", textColor, "orange", statusCounts[PENDING])) + fmt.Fprintf(&builder, "[%s], Pend: [%s]%d", textColor, "orange", statusCounts[PENDING]) } if widget.statusData.Incident != nil { @@ -157,9 +157,9 @@ func (widget *Widget) content() string { created, err := time.Parse(layout, widget.statusData.Incident.CreatedDate) if err == nil { hoursAgo := time.Since(created).Hours() - builder.WriteString(fmt.Sprintf("[%s]\n Incident: %.0fh ago", textColor, hoursAgo)) + fmt.Fprintf(&builder, "[%s]\n Incident: %.0fh ago", textColor, hoursAgo) } else { - builder.WriteString(fmt.Sprintf("[%s]\n Incident [unparsable date]", textColor)) + fmt.Fprintf(&builder, "[%s]\n Incident [unparsable date]", textColor) } } diff --git a/view/bargraph.go b/view/bargraph.go index c821f74c1..90571fc61 100644 --- a/view/bargraph.go +++ b/view/bargraph.go @@ -86,16 +86,15 @@ func BuildStars(data []Bar, maxStars int, starChar string) string { } //write the line - _, err := buffer.WriteString( - fmt.Sprintf( - "%s%s[[%s]%s[default]%s] %s\n", - bar.Label, - strings.Repeat(" ", longestLabel-len(bar.Label)), - labelColor, - strings.Repeat(starChar, starCount), - strings.Repeat(" ", maxStars-starCount), - label, - ), + _, err := fmt.Fprintf( + &buffer, + "%s%s[[%s]%s[default]%s] %s\n", + bar.Label, + strings.Repeat(" ", longestLabel-len(bar.Label)), + labelColor, + strings.Repeat(starChar, starCount), + strings.Repeat(" ", maxStars-starCount), + label, ) if err != nil { return "" From c6a090fd2e7053b1b68582003291a255e86cf068 Mon Sep 17 00:00:00 2001 From: Chris Roy Date: Fri, 13 Mar 2026 22:53:41 -0400 Subject: [PATCH 2/2] Fixes for todo module highlighting. Space at the beginning of item was placed before the row color formatting which caused the leading space on the next line to be highlighted. Added background color for checked item to prevent hightlighting from leaking. --- modules/todo/display.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/todo/display.go b/modules/todo/display.go index ae2ce84ad..85deaff0f 100644 --- a/modules/todo/display.go +++ b/modules/todo/display.go @@ -122,7 +122,11 @@ func (widget *Widget) RowColor(idx int, hidden int, checked bool) string { } if checked { - return widget.settings.Colors.Checked + return fmt.Sprintf( + "%s:%s", + widget.settings.Colors.Checked, + widget.CommonSettings().Colors.Background, + ) } else { return widget.CommonSettings().RowColor(idx - hidden) } @@ -133,7 +137,7 @@ func (widget *Widget) formattedItemLine(idx int, hidden int, currItem *checklist todoDate := currItem.Date row := fmt.Sprintf( - ` [%s]|%s| `, + `[%s] |%s| `, rowColor, currItem.CheckMark(), )