Skip to content

Commit

Permalink
Merge pull request #60 from marten-seemann/fix-linter-errors
Browse files Browse the repository at this point in the history
fix go vet and staticcheck errors
  • Loading branch information
marten-seemann committed Mar 30, 2021
2 parents cdb6431 + 9c16c32 commit 7c6e444
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func simOpen(protos []string, rwc io.ReadWriteCloser) (string, bool, error) {
var iamserver bool

if peerNonce == myNonce {
return "", false, errors.New("failed client selection; identical nonces!")
return "", false, errors.New("failed client selection; identical nonces")
}
iamserver = peerNonce > myNonce

Expand Down
36 changes: 18 additions & 18 deletions multistream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,24 +163,24 @@ func TestNegLazyStressRead(t *testing.T) {
for rwc := range listener {
m, selected, _, err := mux.NegotiateLazy(rwc)
if err != nil {
t.Fatal(err)
t.Error(err)
return
}

if selected != "/a" {
t.Fatal("incorrect protocol selected")
t.Error("incorrect protocol selected")
return
}

buf := make([]byte, len(message))
_, err = io.ReadFull(m, buf)
if err != nil {
t.Fatal(err)
t.Error(err)
return
}

if !bytes.Equal(message, buf) {
t.Fatal("incorrect output: ", buf)
t.Error("incorrect output: ", buf)
}
rwc.Close()
}
Expand Down Expand Up @@ -216,24 +216,24 @@ func TestNegLazyStressWrite(t *testing.T) {
for rwc := range listener {
m, selected, _, err := mux.NegotiateLazy(rwc)
if err != nil {
t.Fatal(err)
t.Error(err)
return
}

if selected != "/a" {
t.Fatal("incorrect protocol selected")
t.Error("incorrect protocol selected")
return
}

_, err = m.Read(nil)
if err != nil {
t.Fatal(err)
t.Error(err)
return
}

_, err = m.Write(message)
if err != nil {
t.Fatal(err)
t.Error(err)
return
}

Expand Down Expand Up @@ -270,19 +270,19 @@ func TestInvalidProtocol(t *testing.T) {
defer close(done)
_, _, err := mux.Negotiate(a)
if err != ErrIncorrectVersion {
t.Fatal("expected incorrect version error here")
t.Error("expected incorrect version error here")
}
}()

ms := NewMultistream(b, "/THIS_IS_WRONG")
_, err := ms.Read([]byte{0})
if err == nil {
t.Fatal("this read should not succeed")
t.Error("this read should not succeed")
}

select {
case <-time.After(time.Second):
t.Fatal("protocol negotiation didnt complete")
t.Error("protocol negotiation didnt complete")
case <-done:
}
}
Expand Down Expand Up @@ -754,10 +754,10 @@ func TestSimopenClientServer(t *testing.T) {
go func() {
selected, _, err := mux.Negotiate(a)
if err != nil {
t.Fatal(err)
t.Error(err)
}
if selected != "/a" {
t.Fatal("incorrect protocol selected")
t.Error("incorrect protocol selected")
}
close(done)
}()
Expand Down Expand Up @@ -794,7 +794,7 @@ func TestSimopenClientServerFail(t *testing.T) {
go func() {
_, _, err := mux.Negotiate(a)
if err != io.EOF {
t.Fatal(err)
t.Error(err)
}
close(done)
}()
Expand All @@ -819,10 +819,10 @@ func TestSimopenClientClient(t *testing.T) {
go func() {
proto, server, err := SelectWithSimopenOrFail([]string{"/a"}, b)
if err != nil {
t.Fatal(err)
t.Error(err)
}
if proto != "/a" {
t.Fatal("wrong protocol selected")
t.Error("wrong protocol selected")
}
done <- server
}()
Expand Down Expand Up @@ -857,10 +857,10 @@ func TestSimopenClientClient2(t *testing.T) {
go func() {
proto, server, err := SelectWithSimopenOrFail([]string{"/a", "/b"}, b)
if err != nil {
t.Fatal(err)
t.Error(err)
}
if proto != "/b" {
t.Fatal("wrong protocol selected")
t.Error("wrong protocol selected")
}
done <- server
}()
Expand Down

0 comments on commit 7c6e444

Please sign in to comment.