Skip to content

Commit

Permalink
[FAB-12083] Appease go vet with cancel in cluster
Browse files Browse the repository at this point in the history
FAB-12083 #done

This change set adds a call to the context cancel function
when the stream cannot be established.

Change-Id: Ie38d5e59e6f6a4635dcf427ea4c2a4cf4d9ff44c
Signed-off-by: yacovm <yacovm@il.ibm.com>
  • Loading branch information
yacovm authored and sykesm committed Sep 28, 2018
1 parent c362c85 commit 56914c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
1 change: 1 addition & 0 deletions orderer/common/cluster/comm.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ func (rc *RemoteContext) SubmitStream() (orderer.Cluster_SubmitClient, error) {
ctx, cancel := context.WithCancel(context.TODO())
submitStream, err := rc.Client.Submit(ctx)
if err != nil {
cancel()
return nil, errors.WithStack(err)
}
rc.submitStream = submitStream
Expand Down
15 changes: 2 additions & 13 deletions scripts/golinter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,9 @@ fi

echo "Checking with go vet"
PRINTFUNCS="Print,Printf,Info,Infof,Warning,Warningf,Error,Errorf,Critical,Criticalf,Sprint,Sprintf,Log,Logf,Panic,Panicf,Fatal,Fatalf,Notice,Noticef,Wrap,Wrapf,WithMessage"
OUTPUT="$(go vet -all -lostcancel=false -printfuncs $PRINTFUNCS ./...)"
OUTPUT="$(go vet -all -printfuncs $PRINTFUNCS ./...)"
if [ -n "$OUTPUT" ]; then
echo "The following files contain go vet errors"
echo $OUTPUT
exit 1
fi

# This block should removed once the lostcancel issues have been corrected and
# the previous invocation of vet should remove the -lostcancel=false option.
# FAB-12082 - gossip
# FAB-12083 - orderer
OUTPUT="$(go vet -lostcancel=true ./... 2>&1 | grep -Ev '^#|(fabric/)?gossip/comm/comm_impl.go|(fabric)?orderer/common/cluster/comm.go' || true)"
if [ -n "$OUTPUT" ]; then
echo "The following files contain go vet errors"
echo $OUTPUT
exit 1
fi
fi

0 comments on commit 56914c8

Please sign in to comment.