refactor: Remove unreachable dead code branches

- firstForwardedValue: strings.Split always returns at least one element
- shouldRunBackupPoll: remaining is always >= 1 by math
- convertContainerDiskInfo: lowerLabel is never empty for non-rootfs

All three functions now at 100% coverage.
This commit is contained in:
rcourtman
2025-12-02 14:36:52 +00:00
parent 629645a2a0
commit 158669296e
5 changed files with 1 additions and 18 deletions

View File

@@ -1645,9 +1645,6 @@ func firstForwardedValue(header string) string {
return ""
}
parts := strings.Split(header, ",")
if len(parts) == 0 {
return ""
}
return strings.TrimSpace(parts[0])
}

View File

@@ -76,10 +76,6 @@ func normalizeRequestedScopes(raw *[]string) ([]string, error) {
return []string{config.ScopeWildcard}, nil
}
if len(normalized) == 0 {
return nil, fmt.Errorf("select at least one scope")
}
sort.Strings(normalized)
return normalized, nil
}

View File

@@ -111,11 +111,7 @@ func convertContainerDiskInfo(status *proxmox.Container, metadata map[string]con
if mountpoint == "" {
mountpoint = label
}
if lowerLabel != "" {
disk.Type = lowerLabel
} else {
disk.Type = "disk"
}
disk.Type = lowerLabel
}
disk.Mountpoint = mountpoint

View File

@@ -862,9 +862,6 @@ func (m *Monitor) shouldRunBackupPoll(last time.Time, now time.Time) (bool, stri
}
remaining := int64(backupCycles) - (m.pollCounter % int64(backupCycles))
if remaining <= 0 {
remaining = int64(backupCycles)
}
return false, fmt.Sprintf("next run in %d polling cycles", remaining), last
}

View File

@@ -142,9 +142,6 @@ func (t *StalenessTracker) StalenessScore(instanceType InstanceType, instance st
if score > 1 {
score = 1
}
if score < 0 {
score = 0
}
return score, true
}