Skip to content

Commit 0fff238

Browse files
committed
Solve Lint Error
1 parent a505466 commit 0fff238

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

e2e/integration-tests/pcap_helper.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package integrationtests
44

55
import (
6+
"errors"
67
"fmt"
78
"io"
89
"os"
@@ -65,17 +66,17 @@ func ReadPcapngFileWithFilter(filepath string, filter *PacketFilter) ([]PacketIn
6566
for {
6667
data, ci, opts, err := ngReader.ReadPacketDataWithOptions()
6768
if err != nil {
68-
if err == io.EOF {
69+
if errors.Is(err, io.EOF) {
6970
break
7071
}
7172
return nil, fmt.Errorf("error reading packet data: %w", err)
7273
}
7374

7475
packet := gopacket.NewPacket(data, layers.LayerTypeEthernet, gopacket.Default)
75-
packetInfo := extractPacketInfo(packet, ci, opts)
76+
packetInfo := extractPacketInfo(packet, ci, &opts)
7677

7778
// Apply filter if provided
78-
if filter != nil && !matchesFilter(packetInfo, filter) {
79+
if filter != nil && !matchesFilter(&packetInfo, filter) {
7980
continue
8081
}
8182

@@ -86,7 +87,7 @@ func ReadPcapngFileWithFilter(filepath string, filter *PacketFilter) ([]PacketIn
8687
}
8788

8889
// extractPacketInfo extracts information from a packet
89-
func extractPacketInfo(packet gopacket.Packet, ci gopacket.CaptureInfo, opts pcapgo.NgPacketOptions) PacketInfo {
90+
func extractPacketInfo(packet gopacket.Packet, ci gopacket.CaptureInfo, opts *pcapgo.NgPacketOptions) PacketInfo {
9091
info := PacketInfo{
9192
Timestamp: ci.Timestamp.Unix(),
9293
Length: ci.Length,
@@ -168,7 +169,7 @@ func extractK8sMetadata(info *PacketInfo) {
168169
}
169170

170171
// matchesFilter checks if a packet matches the filter criteria
171-
func matchesFilter(info PacketInfo, filter *PacketFilter) bool {
172+
func matchesFilter(info *PacketInfo, filter *PacketFilter) bool {
172173
// Filter by port (either source or destination)
173174
if filter.Port != nil {
174175
if info.SrcPort != *filter.Port && info.DstPort != *filter.Port {

0 commit comments

Comments
 (0)