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, LastSeen: h.LastSeen.Unix() * 1000,
} }
if host.DisplayName == "" { // Fall back to Hostname if DisplayName is empty
if h.DisplayName != "" { if host.DisplayName == "" && h.Hostname != "" {
host.DisplayName = h.DisplayName host.DisplayName = h.Hostname
} else if h.Hostname != "" {
host.DisplayName = h.Hostname
}
} }
if len(h.LoadAverage) > 0 { if len(h.LoadAverage) > 0 {