mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
golangci-lint can run all the currently enabled linters, and as far as I can tell, does it in under 5 seconds as opposed to over 180 seconds (compare `time make cilint` and `time make lint`). Some of the linters that are listed in the "enabled" section but commented out looked like a good idea to me, and fairly low hanging fruit to fix, but they are not passing at the moment. All the linters covered in the current Makefile are run. TODO: - replace lint target in Makefile with golangci-lint - remove .github/workflow/errcheck.yml
33 lines
820 B
Go
33 lines
820 B
Go
package digitalclock
|
|
|
|
import "strings"
|
|
|
|
func mergeLines(outString []string) string {
|
|
return strings.Join(outString, "\n")
|
|
}
|
|
|
|
func renderWidget(widgetSettings Settings) string {
|
|
outputStrings := []string{}
|
|
|
|
clockString, needBorder := renderClock(widgetSettings)
|
|
if needBorder {
|
|
outputStrings = append(outputStrings, mergeLines([]string{"", clockString, ""}))
|
|
} else {
|
|
outputStrings = append(outputStrings, clockString)
|
|
}
|
|
|
|
if widgetSettings.withDate {
|
|
outputStrings = append(outputStrings, getDate())
|
|
outputStrings = append(outputStrings, getUTC())
|
|
outputStrings = append(outputStrings, getEpoch())
|
|
}
|
|
|
|
return mergeLines(outputStrings)
|
|
}
|
|
|
|
func (widget *Widget) display() {
|
|
widget.Redraw(func() (string, string, bool) {
|
|
return widget.CommonSettings().Title, renderWidget(*widget.settings), false
|
|
})
|
|
}
|