Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
fix staticcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Apr 23, 2021
1 parent cfe523c commit 6c9c42f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
8 changes: 2 additions & 6 deletions benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package noise

import (
"context"
"golang.org/x/crypto/poly1305"
"io"
"io/ioutil"
"math/rand"
"net"
"testing"
"time"

"golang.org/x/crypto/poly1305"

"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/sec"
)
Expand Down Expand Up @@ -201,11 +202,6 @@ func benchDataTransfer(b *benchenv, dataSize int64, m testMode) {
b.ReportMetric(bytesPerSec, "bytes/sec")
}

type bc struct {
plainTextChunkLen int64
readBufferLen int64
}

func BenchmarkTransfer1MB(b *testing.B) {
for n, bc := range bcs {
b.Run(n, func(b *testing.B) {
Expand Down
10 changes: 5 additions & 5 deletions handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
"crypto/rand"
"encoding/binary"
"fmt"
pool "github.com/libp2p/go-buffer-pool"
"golang.org/x/crypto/poly1305"
"time"

"golang.org/x/crypto/poly1305"

"github.com/flynn/noise"
"github.com/gogo/protobuf/proto"

pool "github.com/libp2p/go-buffer-pool"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer"

Expand Down Expand Up @@ -94,8 +95,7 @@ func (s *secureSession) runHandshake(ctx context.Context) error {
}
} else {
// stage 0 //
plaintext, err := s.readHandshakeMessage(hs)
if err != nil {
if _, err := s.readHandshakeMessage(hs); err != nil {
return fmt.Errorf("error reading handshake message: %w", err)
}

Expand All @@ -108,7 +108,7 @@ func (s *secureSession) runHandshake(ctx context.Context) error {
}

// stage 2 //
plaintext, err = s.readHandshakeMessage(hs)
plaintext, err := s.readHandshakeMessage(hs)
if err != nil {
return fmt.Errorf("error reading handshake message: %w", err)
}
Expand Down

0 comments on commit 6c9c42f

Please sign in to comment.