fix lint errors

This commit is contained in:
Siyuan 2025-10-10 14:12:09 +00:00
parent ed90e42324
commit 1f568c96dd
5 changed files with 8 additions and 6 deletions

View File

@ -26,7 +26,7 @@ func (a *IPAddress) Compare(n netlink.Addr) bool {
if !a.Address.IP.Equal(n.IP) { if !a.Address.IP.Equal(n.IP) {
return false return false
} }
if slices.Compare(a.Address.Mask, n.IPNet.Mask) != 0 { if slices.Compare(a.Address.Mask, n.Mask) != 0 {
return false return false
} }
return true return true

View File

@ -31,7 +31,7 @@ func (c *Client) requestLease4(ifname string) (*Lease, error) {
} }
defer client.Close() defer client.Close()
// Prepend modifiers with default options, so they can be overriden. // Prepend modifiers with default options, so they can be overridden.
reqmods := append( reqmods := append(
[]dhcpv4.Modifier{ []dhcpv4.Modifier{
dhcpv4.WithOption(dhcpv4.OptClassIdentifier(VendorIdentifier)), dhcpv4.WithOption(dhcpv4.OptClassIdentifier(VendorIdentifier)),

View File

@ -117,7 +117,7 @@ func (c *Client) requestLease6(ifname string) (*Lease, error) {
} }
defer client.Close() defer client.Close()
// Prepend modifiers with default options, so they can be overriden. // Prepend modifiers with default options, so they can be overridden.
reqmods := append( reqmods := append(
[]dhcpv6.Modifier{ []dhcpv6.Modifier{
dhcpv6.WithNetboot, dhcpv6.WithNetboot,

View File

@ -74,7 +74,9 @@ func (nm *NetlinkManager) monitorStateChange() {
updateCh := make(chan netlink.LinkUpdate) updateCh := make(chan netlink.LinkUpdate)
// we don't need to stop the subscription, as it will be closed when the program exits // we don't need to stop the subscription, as it will be closed when the program exits
stopCh := make(chan struct{}) //nolint:unused stopCh := make(chan struct{}) //nolint:unused
netlink.LinkSubscribe(updateCh, stopCh) if err := netlink.LinkSubscribe(updateCh, stopCh); err != nil {
nm.logger.Error().Err(err).Msg("failed to subscribe to link state changes")
}
nm.logger.Info().Msg("state change monitoring started") nm.logger.Info().Msg("state change monitoring started")
@ -153,7 +155,7 @@ func (nm *NetlinkManager) EnsureInterfaceUpWithTimeout(ctx context.Context, ifac
linkUpTimeout := time.After(timeout) linkUpTimeout := time.After(timeout)
attempt := 0 var attempt int
start := time.Now() start := time.Now()
for { for {