chore: add golangci-lint config and fix all lint issues
Add .golangci.yml enabling errcheck, staticcheck, govet, gosec, ineffassign, and unused linters. Fix 66 issues across 16 files: - Check all unchecked errors (errcheck) - Use HTTP status constants instead of numeric literals (staticcheck) - Replace deprecated LineUp/LineDown with ScrollUp/ScrollDown (staticcheck) - Convert sprintf+write patterns to fmt.Fprintf (staticcheck) - Add ReadHeaderTimeout to http.Server (gosec) - Remove unused types and functions (unused) - Add nolint comments for intentional patterns (InsecureSkipVerify, math/rand for jitter, dialect-only SQL formatting)
This commit is contained in:
@@ -2,8 +2,6 @@ package tui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go-upkeep/internal/models"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -71,26 +69,3 @@ func fmtNodeLastSeen(t time.Time) string {
|
||||
}
|
||||
return fmt.Sprintf("%dh ago", int(ago.Hours()))
|
||||
}
|
||||
|
||||
func fmtProbeRegions(site models.Site, probeResults map[string]probeStatus) string {
|
||||
if len(probeResults) == 0 {
|
||||
return subtleStyle.Render("—")
|
||||
}
|
||||
var parts []string
|
||||
for region, status := range probeResults {
|
||||
short := region
|
||||
if len(short) > 6 {
|
||||
short = short[:6]
|
||||
}
|
||||
if status.isUp {
|
||||
parts = append(parts, specialStyle.Render(short+":UP"))
|
||||
} else {
|
||||
parts = append(parts, dangerStyle.Render(short+":DN"))
|
||||
}
|
||||
}
|
||||
return strings.Join(parts, " ")
|
||||
}
|
||||
|
||||
type probeStatus struct {
|
||||
isUp bool
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user