Skip to content

Commit fe7561b

Browse files
committed
fix(lint): Address linter warnings after upgrade
1 parent ff00252 commit fe7561b

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ linters:
3434
- errcheck
3535
- nolintlint
3636
- staticcheck
37+
- noctx
3738
path: _test\.go
3839
paths:
3940
- third_party$

pkg/api/listener.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ package api
2424
import (
2525
"context"
2626
"fmt"
27-
"github.com/Microsoft/go-winio"
2827
"net"
2928
"strings"
29+
30+
"github.com/Microsoft/go-winio"
3031
)
3132

3233
// MakePipeListener produces a new listener for receiving requests over a named pipe.
@@ -41,6 +42,7 @@ func MakePipeListener(pipePath, descriptor string) (net.Listener, error) {
4142

4243
// makeTCPListener produces a new listener for receiving requests over TCP.
4344
func makeTCPListener(addr string) (net.Listener, error) {
45+
//nolint:noctx
4446
return net.Listen("tcp", addr)
4547
}
4648

pkg/network/dns.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package network
2020

2121
import (
22+
"context"
2223
"errors"
2324
"expvar"
2425
"net"
@@ -119,7 +120,9 @@ func (r *ReverseDNS) Add(addr Address) ([]string, error) {
119120

120121
now := time.Now()
121122
exp := now.Add(r.ttl).UnixNano()
122-
names, err := net.LookupAddr(addr.ToIPString())
123+
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
124+
defer cancel()
125+
names, err := net.DefaultResolver.LookupAddr(ctx, addr.ToIPString())
123126
if err != nil {
124127
r.blacklist[addr]++
125128
failedDNSLookups.Add(addr.ToIPString(), 1)

pkg/outputs/amqp/client.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ package amqp
2121
import (
2222
"expvar"
2323
"fmt"
24-
"github.com/rabbitstack/fibratus/pkg/util/tls"
25-
log "github.com/sirupsen/logrus"
26-
"github.com/streadway/amqp"
2724
"net"
2825
"sync"
2926
"time"
27+
28+
"github.com/rabbitstack/fibratus/pkg/util/tls"
29+
log "github.com/sirupsen/logrus"
30+
"github.com/streadway/amqp"
3031
)
3132

3233
var (
@@ -55,6 +56,7 @@ func (c *client) connect(healthcheck bool) error {
5556
amqpConfig := amqp.Config{
5657
Vhost: c.config.Vhost,
5758
Dial: func(network, addr string) (net.Conn, error) {
59+
//nolint:noctx
5860
return net.DialTimeout(network, addr, c.config.Timeout)
5961
},
6062
SASL: c.config.auth(),

0 commit comments

Comments
 (0)