qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [1/6] qpid-proton git commit: NO-JIRA: Fixed missing error checks reported by go-errcheck
Date Tue, 20 Sep 2016 21:49:27 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master 4bb26814c -> 6134e216c


NO-JIRA: Fixed missing error checks reported by go-errcheck


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/77b907b8
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/77b907b8
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/77b907b8

Branch: refs/heads/master
Commit: 77b907b8d8e26701866d4567981fc5e3f6e099c3
Parents: 0e37353
Author: Alan Conway <aconway@redhat.com>
Authored: Mon Sep 12 16:13:09 2016 -0400
Committer: Alan Conway <aconway@redhat.com>
Committed: Tue Sep 20 17:39:15 2016 -0400

----------------------------------------------------------------------
 .../bindings/go/src/qpid.apache.org/amqp/marshal.go |  2 +-
 .../go/src/qpid.apache.org/electron/connection.go   |  4 ++--
 .../src/qpid.apache.org/electron/electron_test.go   | 16 ++++++++++++----
 .../go/src/qpid.apache.org/electron/handler.go      |  6 +++---
 .../go/src/qpid.apache.org/electron/link.go         |  2 +-
 .../go/src/qpid.apache.org/electron/receiver.go     |  4 ++--
 .../go/src/qpid.apache.org/electron/session.go      |  2 +-
 .../go/src/qpid.apache.org/proton/engine.go         | 16 +++++++++-------
 .../go/src/qpid.apache.org/proton/handlers.go       |  8 ++++----
 9 files changed, 35 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/77b907b8/proton-c/bindings/go/src/qpid.apache.org/amqp/marshal.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/amqp/marshal.go b/proton-c/bindings/go/src/qpid.apache.org/amqp/marshal.go
index 66e14d8..3b4a59e 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/amqp/marshal.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/amqp/marshal.go
@@ -239,7 +239,7 @@ func NewEncoder(w io.Writer) *Encoder {
 func (e *Encoder) Encode(v interface{}) (err error) {
 	e.buffer, err = Marshal(v, e.buffer)
 	if err == nil {
-		e.writer.Write(e.buffer)
+		_, err = e.writer.Write(e.buffer)
 	}
 	return err
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/77b907b8/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go b/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go
index 3bc5dcf..d0733f2 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/connection.go
@@ -185,11 +185,11 @@ func (c *connection) run() {
 	if !c.server {
 		c.pConnection.Open()
 	}
-	c.engine.Run()
+	_ = c.engine.Run()
 	if c.incoming != nil {
 		close(c.incoming)
 	}
-	c.closed(Closed)
+	_ = c.closed(Closed)
 }
 
 func (c *connection) Close(err error) {

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/77b907b8/proton-c/bindings/go/src/qpid.apache.org/electron/electron_test.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/electron_test.go b/proton-c/bindings/go/src/qpid.apache.org/electron/electron_test.go
index 56b91bf..aa37d57 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/electron/electron_test.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/electron_test.go
@@ -286,7 +286,9 @@ func TestTimeouts(t *testing.T) {
 	if err != nil {
 		t.Fatal(err)
 	}
-	rm.Accept()
+	if err := rm.Accept(); err != nil {
+		t.Fatal(err)
+	}
 	// Sender get ack
 	if a := <-ack; a.Status != Accepted || a.Error != nil {
 		t.Errorf("want (accepted, nil) got %#v", a)
@@ -433,13 +435,17 @@ func TestConnectionCloseInterrupt1(t *testing.T) {
 	snd, rcv := pairs.senderReceiver()
 	go doSend(snd, results)
 
-	rcv.Receive()
+	if _, err := rcv.Receive(); err != nil {
+		t.Error("receive", err)
+	}
 	rcv, snd = pairs.receiverSender()
 	go doReceive(rcv, results)
 
 	snd, rcv = pairs.senderReceiver()
 	ack := snd.SendWaitable(amqp.NewMessage())
-	rcv.Receive()
+	if _, err := rcv.Receive(); err != nil {
+		t.Error("receive", err)
+	}
 	go doDisposition(ack, results)
 
 	pairs.server.Close(want)
@@ -459,7 +465,9 @@ func TestConnectionCloseInterrupt2(t *testing.T) {
 	// Connection.Close() interrupts Send, Receive, Disposition.
 	snd, rcv := pairs.senderReceiver()
 	go doSend(snd, results)
-	rcv.Receive()
+	if _, err := rcv.Receive(); err != nil {
+		t.Error("receive", err)
+	}
 
 	rcv, snd = pairs.receiverSender()
 	go doReceive(rcv, results)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/77b907b8/proton-c/bindings/go/src/qpid.apache.org/electron/handler.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/handler.go b/proton-c/bindings/go/src/qpid.apache.org/electron/handler.go
index ede7b6c..2a426aa 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/electron/handler.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/handler.go
@@ -155,7 +155,7 @@ func (h *handler) addLink(pl proton.Link, el Endpoint) {
 
 func (h *handler) linkClosed(l proton.Link, err error) {
 	if link, ok := h.links[l]; ok {
-		link.closed(err)
+		_ = link.closed(err)
 		delete(h.links, l)
 	}
 }
@@ -187,11 +187,11 @@ func (h *handler) shutdown(err error) {
 	}
 	h.sentMessages = nil
 	for _, l := range h.links {
-		l.closed(err)
+		_ = l.closed(err)
 	}
 	h.links = nil
 	for _, s := range h.sessions {
-		s.closed(err)
+		_ = s.closed(err)
 	}
 	h.sessions = nil
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/77b907b8/proton-c/bindings/go/src/qpid.apache.org/electron/link.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/link.go b/proton-c/bindings/go/src/qpid.apache.org/electron/link.go
index e0f6cb4..1d17894 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/electron/link.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/link.go
@@ -213,7 +213,7 @@ func (l *link) Credit() (credit int, err error) {
 func (l *link) Capacity() int { return l.capacity }
 
 func (l *link) Close(err error) {
-	l.engine().Inject(func() {
+	_ = l.engine().Inject(func() {
 		if l.Error() == nil {
 			localClose(l.pLink, err)
 		}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/77b907b8/proton-c/bindings/go/src/qpid.apache.org/electron/receiver.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/receiver.go b/proton-c/bindings/go/src/qpid.apache.org/electron/receiver.go
index fb234e2..781fd7c 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/electron/receiver.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/receiver.go
@@ -103,7 +103,7 @@ func (r *receiver) flow(credit int) {
 // Inject flow check per-caller call when prefetch is off.
 // Called with inc=1 at start of call, inc = -1 at end
 func (r *receiver) caller(inc int) {
-	r.engine().Inject(func() {
+	_ = r.engine().Inject(func() {
 		r.callers += inc
 		need := r.callers - (len(r.buffer) + r.pLink.Credit())
 		max := r.maxFlow()
@@ -117,7 +117,7 @@ func (r *receiver) caller(inc int) {
 // Inject flow top-up if prefetch is enabled
 func (r *receiver) flowTopUp() {
 	if r.prefetch {
-		r.engine().Inject(func() { r.flow(r.maxFlow()) })
+		_ = r.engine().Inject(func() { r.flow(r.maxFlow()) })
 	}
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/77b907b8/proton-c/bindings/go/src/qpid.apache.org/electron/session.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/electron/session.go b/proton-c/bindings/go/src/qpid.apache.org/electron/session.go
index 4b663aa..66a8995 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/electron/session.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/electron/session.go
@@ -69,7 +69,7 @@ func (s *session) pEndpoint() proton.Endpoint { return s.pSession }
 func (s *session) engine() *proton.Engine     { return s.connection.engine }
 
 func (s *session) Close(err error) {
-	s.engine().Inject(func() {
+	_ = s.engine().Inject(func() {
 		if s.Error() == nil {
 			localClose(s.pSession, err)
 		}

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/77b907b8/proton-c/bindings/go/src/qpid.apache.org/proton/engine.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/engine.go b/proton-c/bindings/go/src/qpid.apache.org/proton/engine.go
index d9dcefd..6439fc1 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/engine.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/proton/engine.go
@@ -205,8 +205,10 @@ func (eng *Engine) InjectWait(f func() error) error {
 //
 func (eng *Engine) Server() { eng.Transport().SetServer() }
 
-func (eng *Engine) disconnect() {
-	eng.conn.Close()
+func (eng *Engine) disconnect(err error) {
+	cond := eng.Transport().Condition()
+	cond.SetError(err)              // Set the provided error.
+	cond.SetError(eng.conn.Close()) // Use connection error if cond is not already set.
 	C.pn_connection_engine_disconnected(&eng.engine)
 }
 
@@ -214,13 +216,13 @@ func (eng *Engine) disconnect() {
 // If err != nil pass it to the remote end as the close condition.
 // Returns when the remote end closes or disconnects.
 func (eng *Engine) Close(err error) {
-	eng.Inject(func() { CloseError(eng.Connection(), err) })
+	_ = eng.Inject(func() { CloseError(eng.Connection(), err) })
 	<-eng.running
 }
 
 // CloseTimeout like Close but disconnect if the remote end doesn't close within timeout.
 func (eng *Engine) CloseTimeout(err error, timeout time.Duration) {
-	eng.Inject(func() { CloseError(eng.Connection(), err) })
+	_ = eng.Inject(func() { CloseError(eng.Connection(), err) })
 	select {
 	case <-eng.running:
 	case <-time.After(timeout):
@@ -231,7 +233,7 @@ func (eng *Engine) CloseTimeout(err error, timeout time.Duration) {
 // Disconnect the engine's connection immediately without an AMQP close.
 // Process any termination events before returning.
 func (eng *Engine) Disconnect(err error) {
-	eng.Inject(func() { eng.Transport().Condition().SetError(err); eng.disconnect() })
+	_ = eng.Inject(func() { eng.disconnect(err) })
 	<-eng.running
 }
 
@@ -358,8 +360,8 @@ func (eng *Engine) Run() error {
 	eng.err.Set(eng.Transport().Condition().Error())
 	close(readsIn)
 	close(writesIn)
-	eng.conn.Close() // Make sure connection is closed
-	wait.Wait()      // Wait for goroutines
+	_ = eng.conn.Close() // Make sure connection is closed
+	wait.Wait()          // Wait for goroutines
 
 	close(eng.running) // Signal goroutines have exited and Error is set.
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/77b907b8/proton-c/bindings/go/src/qpid.apache.org/proton/handlers.go
----------------------------------------------------------------------
diff --git a/proton-c/bindings/go/src/qpid.apache.org/proton/handlers.go b/proton-c/bindings/go/src/qpid.apache.org/proton/handlers.go
index 0fd652c..24e5eb3 100644
--- a/proton-c/bindings/go/src/qpid.apache.org/proton/handlers.go
+++ b/proton-c/bindings/go/src/qpid.apache.org/proton/handlers.go
@@ -351,7 +351,7 @@ func (d *MessagingAdapter) HandleEvent(e Event) {
 	}
 }
 
-func (d *MessagingAdapter) incoming(e Event) (err error) {
+func (d *MessagingAdapter) incoming(e Event) {
 	delivery := e.Delivery()
 	if delivery.HasMessage() {
 		d.mhandler.HandleMessagingEvent(MMessage, e)
@@ -367,7 +367,7 @@ func (d *MessagingAdapter) incoming(e Event) (err error) {
 	return
 }
 
-func (d *MessagingAdapter) outgoing(e Event) (err error) {
+func (d *MessagingAdapter) outgoing(e Event) {
 	delivery := e.Delivery()
 	if delivery.Updated() {
 		switch delivery.Remote().Type() {
@@ -378,11 +378,11 @@ func (d *MessagingAdapter) outgoing(e Event) (err error) {
 		case Released, Modified:
 			d.mhandler.HandleMessagingEvent(MReleased, e)
 		}
-		if err == nil && delivery.Settled() {
+		if delivery.Settled() {
 			// The delivery was settled remotely, inform the local end.
 			d.mhandler.HandleMessagingEvent(MSettled, e)
 		}
-		if err == nil && d.AutoSettle {
+		if d.AutoSettle {
 			delivery.Settle() // Local settle, don't mhandler MSettled till the remote end settles.
 		}
 	}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message