From 82f8f6f20f0db0f207afe2913c595c4d06ec64fd Mon Sep 17 00:00:00 2001 From: "M. Mert Yildiran" Date: Thu, 28 Apr 2022 19:22:22 +0300 Subject: [PATCH] Fix linter errors --- tap/source/handle_af_packet.go | 2 +- tap/source/handle_pcap.go | 6 ++---- tap/source/tcp_packet_source.go | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tap/source/handle_af_packet.go b/tap/source/handle_af_packet.go index 11e29b9d4..2d8ee6847 100644 --- a/tap/source/handle_af_packet.go +++ b/tap/source/handle_af_packet.go @@ -52,7 +52,7 @@ func (h *afPacketHandle) SetBPF(expr string) (err error) { } bpfIns = append(bpfIns, bpfIns2) } - h.capture.SetBPF(bpfIns) + err = h.capture.SetBPF(bpfIns) return } diff --git a/tap/source/handle_pcap.go b/tap/source/handle_pcap.go index 607c61d60..f4f99eddd 100644 --- a/tap/source/handle_pcap.go +++ b/tap/source/handle_pcap.go @@ -9,10 +9,8 @@ import ( ) type pcapHandle struct { - source *gopacket.PacketSource - capture *pcap.Handle - decoder gopacket.Decoder - decodeOptions gopacket.DecodeOptions + source *gopacket.PacketSource + capture *pcap.Handle } func (h *pcapHandle) NextPacket() (packet gopacket.Packet, err error) { diff --git a/tap/source/tcp_packet_source.go b/tap/source/tcp_packet_source.go index c81b776ff..b27ec6175 100644 --- a/tap/source/tcp_packet_source.go +++ b/tap/source/tcp_packet_source.go @@ -76,7 +76,7 @@ func newTcpPacketSource(name, filename string, interfaceName string, logger.Log.Infof("Using AF_PACKET socket as the capture source") } - decoder := gopacket.DecodersByLayerName[fmt.Sprintf("%s", layers.LinkTypeEthernet)] + decoder := gopacket.DecodersByLayerName[string(layers.LinkTypeEthernet)] result.Handle.SetDecoder(decoder, behaviour.Lazy, true) if behaviour.BpfFilter != "" {