refactor: Remove unreachable dead code branches

- Host.ToFrontend: Remove redundant h.DisplayName check after struct
  initialization already set host.DisplayName = h.DisplayName

Function now at 100% coverage.
This commit is contained in:
rcourtman 2025-12-02 14:53:07 +00:00
parent c1d98e6aa8
commit a647ffb219

View file

@ -318,12 +318,9 @@ func (h Host) ToFrontend() HostFrontend {
LastSeen: h.LastSeen.Unix() * 1000,
}
if host.DisplayName == "" {
if h.DisplayName != "" {
host.DisplayName = h.DisplayName
} else if h.Hostname != "" {
host.DisplayName = h.Hostname
}
// Fall back to Hostname if DisplayName is empty
if host.DisplayName == "" && h.Hostname != "" {
host.DisplayName = h.Hostname
}
if len(h.LoadAverage) > 0 {