Apply go fix modernizations
This commit is contained in:
68
types.go
68
types.go
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
"net"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -57,7 +58,7 @@ func (s ArtNetUniverseSet) Universes() []ArtNetUniverse {
|
||||
for u := range s {
|
||||
result = append(result, u)
|
||||
}
|
||||
sort.Slice(result, func(i, j int) bool { return result[i] < result[j] })
|
||||
slices.Sort(result)
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -91,7 +92,7 @@ func (s SACNUniverseSet) Universes() []SACNUniverse {
|
||||
for u := range s {
|
||||
result = append(result, u)
|
||||
}
|
||||
sort.Slice(result, func(i, j int) bool { return result[i] < result[j] })
|
||||
slices.Sort(result)
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -137,11 +138,11 @@ const (
|
||||
)
|
||||
|
||||
type MulticastGroup struct {
|
||||
ID MulticastGroupID
|
||||
SACNUniverse SACNUniverse
|
||||
DanteFlow int
|
||||
DanteAV int
|
||||
RawIP string
|
||||
ID MulticastGroupID
|
||||
SACNUniverse SACNUniverse
|
||||
DanteFlow int
|
||||
DanteAV int
|
||||
RawIP string
|
||||
}
|
||||
|
||||
func (g MulticastGroup) String() string {
|
||||
@@ -268,7 +269,7 @@ func (s MulticastMembershipSet) SACNInputs() []SACNUniverse {
|
||||
result = append(result, g.SACNUniverse)
|
||||
}
|
||||
}
|
||||
sort.Slice(result, func(i, j int) bool { return result[i] < result[j] })
|
||||
slices.Sort(result)
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -476,28 +477,28 @@ func (f *DanteFlows) Expire(maxAge time.Duration) bool {
|
||||
}
|
||||
|
||||
type Node struct {
|
||||
ID string `json:"id"`
|
||||
Names NameSet `json:"names"`
|
||||
Interfaces InterfaceMap `json:"interfaces"`
|
||||
MACTable map[string]string `json:"mac_table,omitempty"`
|
||||
Type NodeType `json:"type,omitempty"`
|
||||
PoEBudget *PoEBudget `json:"poe_budget,omitempty"`
|
||||
DanteTxChannels int `json:"dante_tx_channels,omitempty"`
|
||||
DanteClockMasterSeen time.Time `json:"-"`
|
||||
DanteFlows *DanteFlows `json:"dante_flows,omitempty"`
|
||||
MulticastGroups MulticastMembershipSet `json:"multicast_groups,omitempty"`
|
||||
ArtNetInputs ArtNetUniverseSet `json:"artnet_inputs,omitempty"`
|
||||
ArtNetOutputs ArtNetUniverseSet `json:"artnet_outputs,omitempty"`
|
||||
SACNUnicastInputs SACNUniverseSet `json:"sacn_unicast_inputs,omitempty"`
|
||||
SACNOutputs SACNUniverseSet `json:"sacn_outputs,omitempty"`
|
||||
ArtmapMappings []ArtmapMapping `json:"artmap_mappings,omitempty"`
|
||||
Unreachable bool `json:"unreachable,omitempty"`
|
||||
Avoid bool `json:"avoid,omitempty"`
|
||||
InConfig bool `json:"in_config,omitempty"`
|
||||
IsSelf bool `json:"is_self,omitempty"`
|
||||
errors *ErrorTracker
|
||||
pollTrigger chan struct{}
|
||||
cancelFunc context.CancelFunc
|
||||
ID string `json:"id"`
|
||||
Names NameSet `json:"names"`
|
||||
Interfaces InterfaceMap `json:"interfaces"`
|
||||
MACTable map[string]string `json:"mac_table,omitempty"`
|
||||
Type NodeType `json:"type,omitempty"`
|
||||
PoEBudget *PoEBudget `json:"poe_budget,omitempty"`
|
||||
DanteTxChannels int `json:"dante_tx_channels,omitempty"`
|
||||
DanteClockMasterSeen time.Time `json:"-"`
|
||||
DanteFlows *DanteFlows `json:"dante_flows,omitempty"`
|
||||
MulticastGroups MulticastMembershipSet `json:"multicast_groups,omitempty"`
|
||||
ArtNetInputs ArtNetUniverseSet `json:"artnet_inputs,omitempty"`
|
||||
ArtNetOutputs ArtNetUniverseSet `json:"artnet_outputs,omitempty"`
|
||||
SACNUnicastInputs SACNUniverseSet `json:"sacn_unicast_inputs,omitempty"`
|
||||
SACNOutputs SACNUniverseSet `json:"sacn_outputs,omitempty"`
|
||||
ArtmapMappings []ArtmapMapping `json:"artmap_mappings,omitempty"`
|
||||
Unreachable bool `json:"unreachable,omitempty"`
|
||||
Avoid bool `json:"avoid,omitempty"`
|
||||
InConfig bool `json:"in_config,omitempty"`
|
||||
IsSelf bool `json:"is_self,omitempty"`
|
||||
errors *ErrorTracker
|
||||
pollTrigger chan struct{}
|
||||
cancelFunc context.CancelFunc
|
||||
}
|
||||
|
||||
func (n *Node) IsDanteClockMaster() bool {
|
||||
@@ -703,11 +704,12 @@ func (i *Interface) String() string {
|
||||
parts = append(parts, i.Stats.String())
|
||||
}
|
||||
|
||||
result := parts[0]
|
||||
var result strings.Builder
|
||||
result.WriteString(parts[0])
|
||||
for _, p := range parts[1:] {
|
||||
result += " " + p
|
||||
result.WriteString(" " + p)
|
||||
}
|
||||
return result
|
||||
return result.String()
|
||||
}
|
||||
|
||||
func (s *InterfaceStats) String() string {
|
||||
|
||||
Reference in New Issue
Block a user