From 9eb152cf6dd4a4b2270ad10728b62b9900ed5bf4 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 5 May 2021 10:23:05 +0700 Subject: [PATCH] fix staticcheck --- autonat.go | 2 +- autonat_test.go | 2 +- client.go | 2 +- dialpolicy_test.go | 4 +--- svc.go | 3 +-- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/autonat.go b/autonat.go index f94b6c8..59a146b 100644 --- a/autonat.go +++ b/autonat.go @@ -443,5 +443,5 @@ func (s *StaticAutoNAT) PublicAddr() (ma.Multiaddr, error) { if s.reachability != network.ReachabilityPublic { return nil, errors.New("NAT status is not public") } - return nil, errors.New("No available address") + return nil, errors.New("no available address") } diff --git a/autonat_test.go b/autonat_test.go index 5117cba..94ad4e5 100644 --- a/autonat_test.go +++ b/autonat_test.go @@ -234,7 +234,7 @@ func TestAutoNATObservationRecording(t *testing.T) { } select { - case _ = <-s.Out(): + case <-s.Out(): t.Fatal("not expecting a public reachability event") default: //expected diff --git a/client.go b/client.go index 0821d4e..b9ce1bf 100644 --- a/client.go +++ b/client.go @@ -61,7 +61,7 @@ func (c *client) DialBack(ctx context.Context, p peer.ID) (ma.Multiaddr, error) } if res.GetType() != pb.Message_DIAL_RESPONSE { - return nil, fmt.Errorf("Unexpected response: %s", res.GetType().String()) + return nil, fmt.Errorf("unexpected response: %s", res.GetType().String()) } status := res.GetDialResponse().GetStatus() diff --git a/dialpolicy_test.go b/dialpolicy_test.go index d18385c..df9061c 100644 --- a/dialpolicy_test.go +++ b/dialpolicy_test.go @@ -43,9 +43,7 @@ type mockL struct { } func (l *mockL) Accept() (transport.CapableConn, error) { - select { - case <-l.ctx.Done(): - } + <-l.ctx.Done() return nil, errors.New("expected in mocked test") } func (l *mockL) Close() error { return nil } diff --git a/svc.go b/svc.go index 78c86ce..c237aa4 100644 --- a/svc.go +++ b/svc.go @@ -28,7 +28,6 @@ type autoNATService struct { config *config // rate limiter - running uint32 mx sync.Mutex reqs map[peer.ID]int globalReqs int @@ -37,7 +36,7 @@ type autoNATService struct { // NewAutoNATService creates a new AutoNATService instance attached to a host func newAutoNATService(ctx context.Context, c *config) (*autoNATService, error) { if c.dialer == nil { - return nil, errors.New("Cannot create NAT service without a network") + return nil, errors.New("cannot create NAT service without a network") } as := &autoNATService{