Skip to content

Commit

Permalink
linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mfreeman451 committed Feb 22, 2025
1 parent 6985283 commit c6714b9
Showing 1 changed file with 0 additions and 45 deletions.
45 changes: 0 additions & 45 deletions pkg/scan/icmp_scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package scan

import (
"context"
"errors"
"net"
"sync"
"testing"
"time"
Expand Down Expand Up @@ -200,46 +198,3 @@ func TestAtomicOperations(t *testing.T) {
assert.Equal(t, int32(0), entry.inUse.Load())
})
}

// mockConn is a minimal interface for the socket pool's connection needs in tests.
type mockConn interface {
Close() error
WriteTo([]byte, net.Addr) (int, error)
ReadFrom([]byte) (int, net.Addr, error)
SetReadDeadline(t time.Time) error
}

// mockPacketConn implements mockConn for testing.
type mockPacketConn struct {
closed bool
mu sync.Mutex
}

func (m *mockPacketConn) Close() error {
m.mu.Lock()
defer m.mu.Unlock()
m.closed = true
return nil
}

func (m *mockPacketConn) WriteTo([]byte, net.Addr) (int, error) {
m.mu.Lock()
defer m.mu.Unlock()
if m.closed {
return 0, errors.New("connection closed")
}
return 0, nil
}

func (m *mockPacketConn) ReadFrom([]byte) (int, net.Addr, error) {
m.mu.Lock()
defer m.mu.Unlock()
if m.closed {
return 0, nil, errors.New("connection closed")
}
return 0, nil, nil
}

func (m *mockPacketConn) SetReadDeadline(t time.Time) error {
return nil
}

0 comments on commit c6714b9

Please sign in to comment.