Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

style: fix additional staticcheck warnings

rcourtman611740087cd0
diff --git a/internal/api/system_settings.go b/internal/api/system_settings.go
index 219826b258..be92cb1299 100644
--- a/internal/api/system_settings.go
+++ b/internal/api/system_settings.go
@@ -171,16 +171,16 @@ func validateSystemSettings(settings *config.SystemSettings, rawRequest map[stri
if val, ok := rawRequest["backupPollingInterval"]; ok {
if interval, ok := val.(float64); ok {
if interval < 0 {
- return fmt.Errorf("Backup polling interval cannot be negative")
+ return fmt.Errorf("backup polling interval cannot be negative")
}
if interval > 0 && interval < 10 {
- return fmt.Errorf("Backup polling interval must be at least 10 seconds")
+ return fmt.Errorf("backup polling interval must be at least 10 seconds")
}
if interval > 604800 {
- return fmt.Errorf("Backup polling interval cannot exceed 604800 seconds (7 days)")
+ return fmt.Errorf("backup polling interval cannot exceed 604800 seconds (7 days)")
}
} else {
- return fmt.Errorf("Backup polling interval must be a number")
+ return fmt.Errorf("backup polling interval must be a number")
}
}
diff --git a/internal/logging/logging_test.go b/internal/logging/logging_test.go
index 9d10094a9a..af1ae838a7 100644
--- a/internal/logging/logging_test.go
+++ b/internal/logging/logging_test.go
@@ -271,7 +271,7 @@ func TestWithLoggerNilContext(t *testing.T) {
Init(Config{})
- ctx := WithLogger(nil, New("svc", WithWriter(io.Discard)))
+ ctx := WithLogger(context.Background(), New("svc", WithWriter(io.Discard)))
if ctx == nil {
t.Fatal("expected non-nil context")
}
diff --git a/internal/mock/generator.go b/internal/mock/generator.go
index 4b5d037dca..5d50cdd9f0 100644
--- a/internal/mock/generator.go
+++ b/internal/mock/generator.go
@@ -2970,7 +2970,7 @@ func generatePMGInstances() []models.PMGInstance {
edgeQueue := &models.PMGQueueStatus{
Active: rand.Intn(2),
Deferred: rand.Intn(5),
- Hold: rand.Intn(1),
+ Hold: rand.Intn(2), // rand.Intn(1) always returns 0
Incoming: rand.Intn(3),
Total: 0,
OldestAge: int64(rand.Intn(600)),
diff --git a/internal/models/converters_test.go b/internal/models/converters_test.go
index f77e18723a..fbfdbcf6f6 100644
--- a/internal/models/converters_test.go
+++ b/internal/models/converters_test.go
@@ -78,7 +78,7 @@ func TestCopyStringFloatMap(t *testing.T) {
}
// Verify it's a copy, not the same reference
- if tc.input != nil && len(tc.input) > 0 {
+ if len(tc.input) > 0 {
for k := range result {
result[k] = 999.0
break
diff --git a/internal/notifications/notifications.go b/internal/notifications/notifications.go
index 87b8b5be1d..6f639c2ff0 100644
--- a/internal/notifications/notifications.go
+++ b/internal/notifications/notifications.go
@@ -2305,7 +2305,7 @@ func formatWebhookDuration(d time.Duration) string {
// extractTelegramChatID extracts and validates the chat_id from a Telegram webhook URL
func extractTelegramChatID(webhookURL string) (string, error) {
if !strings.Contains(webhookURL, "chat_id=") {
- return "", fmt.Errorf("Telegram webhook URL missing chat_id parameter")
+ return "", fmt.Errorf("telegram webhook URL missing chat_id parameter")
}
u, err := url.Parse(webhookURL)