From 1f568c96ddb26a35a793cde11ab73a9ac345f942 Mon Sep 17 00:00:00 2001 From: Siyuan Date: Fri, 10 Oct 2025 14:12:09 +0000 Subject: [PATCH] fix lint errors --- internal/network/types/ip.go | 2 +- pkg/nmlite/hostname.go | 2 +- pkg/nmlite/jetdhcpc/dhcp4.go | 2 +- pkg/nmlite/jetdhcpc/dhcp6.go | 2 +- pkg/nmlite/link/manager.go | 6 ++++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/network/types/ip.go b/internal/network/types/ip.go index 293e7e3f..b0a07bb3 100644 --- a/internal/network/types/ip.go +++ b/internal/network/types/ip.go @@ -26,7 +26,7 @@ func (a *IPAddress) Compare(n netlink.Addr) bool { if !a.Address.IP.Equal(n.IP) { return false } - if slices.Compare(a.Address.Mask, n.IPNet.Mask) != 0 { + if slices.Compare(a.Address.Mask, n.Mask) != 0 { return false } return true diff --git a/pkg/nmlite/hostname.go b/pkg/nmlite/hostname.go index 9083e088..a75aaf4f 100644 --- a/pkg/nmlite/hostname.go +++ b/pkg/nmlite/hostname.go @@ -258,4 +258,4 @@ func ToValidHostname(hostname string) string { func ValidateHostname(hostname string) error { _, err := idna.Lookup.ToASCII(hostname) return err -} \ No newline at end of file +} diff --git a/pkg/nmlite/jetdhcpc/dhcp4.go b/pkg/nmlite/jetdhcpc/dhcp4.go index afa10a4a..5de74245 100644 --- a/pkg/nmlite/jetdhcpc/dhcp4.go +++ b/pkg/nmlite/jetdhcpc/dhcp4.go @@ -31,7 +31,7 @@ func (c *Client) requestLease4(ifname string) (*Lease, error) { } 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( []dhcpv4.Modifier{ dhcpv4.WithOption(dhcpv4.OptClassIdentifier(VendorIdentifier)), diff --git a/pkg/nmlite/jetdhcpc/dhcp6.go b/pkg/nmlite/jetdhcpc/dhcp6.go index 6eddde25..49faf6f0 100644 --- a/pkg/nmlite/jetdhcpc/dhcp6.go +++ b/pkg/nmlite/jetdhcpc/dhcp6.go @@ -117,7 +117,7 @@ func (c *Client) requestLease6(ifname string) (*Lease, error) { } 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( []dhcpv6.Modifier{ dhcpv6.WithNetboot, diff --git a/pkg/nmlite/link/manager.go b/pkg/nmlite/link/manager.go index 5996bc66..4cf79046 100644 --- a/pkg/nmlite/link/manager.go +++ b/pkg/nmlite/link/manager.go @@ -74,7 +74,9 @@ func (nm *NetlinkManager) monitorStateChange() { updateCh := make(chan netlink.LinkUpdate) // we don't need to stop the subscription, as it will be closed when the program exits 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") @@ -153,7 +155,7 @@ func (nm *NetlinkManager) EnsureInterfaceUpWithTimeout(ctx context.Context, ifac linkUpTimeout := time.After(timeout) - attempt := 0 + var attempt int start := time.Now() for {