From b003a3a064b7ded286eb0e1fb4d9cb7064b7bb10 Mon Sep 17 00:00:00 2001 From: Easton Li Date: Wed, 14 Apr 2021 01:23:15 +0800 Subject: [PATCH] lint --- rpc/rpc.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/rpc/rpc.go b/rpc/rpc.go index 677b4596b..dd4394f4c 100644 --- a/rpc/rpc.go +++ b/rpc/rpc.go @@ -848,23 +848,22 @@ func (v *Vibranium) RunAndWait(stream pb.CoreRPC_RunAndWaitServer) error { if err != nil { return err } - + // must send the first message to client before return, otherwise the Stream will be closed // client will get workloadID from the first message - m := <- ch + m := <-ch if err = stream.Send(toRPCAttachWorkloadMessage(m)); err != nil { v.logUnsentMessages("RunAndWait: first message send failed", err, m) } - - runAndWait := func(f func(<-chan *types.AttachWorkloadMessage)) error { + + runAndWait := func(f func(<-chan *types.AttachWorkloadMessage)) { defer v.taskDone("RunAndWait", true) defer cancel() f(ch) - return nil } if !RunAndWaitOptions.Async { - return runAndWait(func(ch <-chan *types.AttachWorkloadMessage) { + runAndWait(func(ch <-chan *types.AttachWorkloadMessage) { for m := range ch { if err = stream.Send(toRPCAttachWorkloadMessage(m)); err != nil { v.logUnsentMessages("RunAndWait", err, m) @@ -873,7 +872,7 @@ func (v *Vibranium) RunAndWait(stream pb.CoreRPC_RunAndWaitServer) error { }) } go func() { - _ = runAndWait(func(ch <-chan *types.AttachWorkloadMessage) { + runAndWait(func(ch <-chan *types.AttachWorkloadMessage) { r, w := io.Pipe() go func() { defer w.Close()