Skip to content

Bump golangci/golangci-lint-action from 6 to 8 #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
go-version: ${{vars.GO_VERSION}}
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v8
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.63.4
Expand Down
27 changes: 22 additions & 5 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
version: "2"
linters:
enable:
- asciicheck
- ineffassign
- gocyclo
- dupl
# - funlen
- gofmt
- gocyclo
- gosec
- misspell
- whitespace
# - unparam
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
12 changes: 6 additions & 6 deletions cmd/udp-proxy-2020/listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func newListener(netif *net.Interface, promisc, sendOnly bool, ports []int32, to
if err != nil {
log.Fatalf("Unable to obtain addresses for %s", netif.Name)
}
var bcastaddr string = ""
var bcastaddr string
// only calc the broadcast address on promiscuous interfaces
// for non-promisc, we use our clients
if !promisc {
Expand Down Expand Up @@ -139,7 +139,7 @@ func (l *Listen) OpenWriter(path string, dir Direction) (string, error) {
l.writer = pcapgo.NewWriter(f)
return fName, l.writer.WriteFileHeader(65536, l.handle.LinkType())
}
return fName, fmt.Errorf("Invalid direction: %s", dir)
return fName, fmt.Errorf("invalid direction: %s", dir)
}

// Our goroutine for processing packets
Expand Down Expand Up @@ -273,7 +273,7 @@ func (l *Listen) sendPackets(sndpkt Send) {
if !l.promisc {
// send one packet to broadcast IP
dstip := net.ParseIP(l.ipaddr).To4()
if err, bytes := l.sendPacket(sndpkt, dstip, eth, loop, ip4, udp, payload); err != nil {
if bytes, err := l.sendPacket(sndpkt, dstip, eth, loop, ip4, udp, payload); err != nil {
log.Warnf("Unable to send %d bytes from %s out %s: %s",
bytes, sndpkt.srcif, l.iname, err)
}
Expand All @@ -284,7 +284,7 @@ func (l *Listen) sendPackets(sndpkt Send) {
}
for ip := range l.clients {
dstip := net.ParseIP(ip).To4()
if err, bytes := l.sendPacket(sndpkt, dstip, eth, loop, ip4, udp, payload); err != nil {
if bytes, err := l.sendPacket(sndpkt, dstip, eth, loop, ip4, udp, payload); err != nil {
log.Warnf("Unable to send %d bytes from %s out %s: %s",
bytes, sndpkt.srcif, l.iname, err)
}
Expand Down Expand Up @@ -347,7 +347,7 @@ func (l *Listen) buildPacket(sndpkt Send, dstip net.IP, eth layers.Ethernet, loo
}

func (l *Listen) sendPacket(sndpkt Send, dstip net.IP, eth layers.Ethernet, loop layers.Loopback,
ip4 layers.IPv4, udp layers.UDP, payload gopacket.Payload) (error, int) {
ip4 layers.IPv4, udp layers.UDP, payload gopacket.Payload) (int, error) {
opts := gopacket.SerializeOptions{
FixLengths: false,
ComputeChecksums: false,
Expand Down Expand Up @@ -401,7 +401,7 @@ func (l *Listen) sendPacket(sndpkt Send, dstip net.IP, eth layers.Ethernet, loop
}
}

return l.handle.WritePacketData(outgoingPacket), len(outgoingPacket)
return len(outgoingPacket), l.handle.WritePacketData(outgoingPacket)
}

func (l *Listen) learnClientIP(packet gopacket.Packet) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/udp-proxy-2020/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func main() {
log.WithError(err).Fatalf("Unable to find interface: %s", iface)
}

var promisc bool = (netif.Flags & net.FlagBroadcast) == 0
var promisc = (netif.Flags & net.FlagBroadcast) == 0
l := newListener(netif, promisc, false, cli.Port, timeout, fixed_ip[iface])
listeners = append(listeners, l)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/udp-proxy-2020/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func parseTimeout(timeout int64) time.Duration {
func getNetwork(addr pcap.InterfaceAddress) (string, error) {
var ip4 net.IP
if ip4 = addr.IP.To4(); ip4 == nil {
return "", fmt.Errorf("Unable to getNetwork for IPv6 address: %s", addr.IP.String())
return "", fmt.Errorf("unable to getNetwork for IPv6 address: %s", addr.IP.String())
}

len, _ := addr.Netmask.Size()
Expand Down
Loading