Skip to content

Commit

Permalink
Merge pull request #103 from libp2p/fix-staticcheck
Browse files Browse the repository at this point in the history
fix staticcheck
  • Loading branch information
marten-seemann committed May 5, 2021
2 parents 9aafa35 + 3d1b86d commit bf03b19
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion p2p/host/autonat/autonat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
2 changes: 1 addition & 1 deletion p2p/host/autonat/autonat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion p2p/host/autonat/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 1 addition & 3 deletions p2p/host/autonat/dialpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
3 changes: 1 addition & 2 deletions p2p/host/autonat/svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type autoNATService struct {
config *config

// rate limiter
running uint32
mx sync.Mutex
reqs map[peer.ID]int
globalReqs int
Expand All @@ -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{
Expand Down

0 comments on commit bf03b19

Please sign in to comment.