Skip to content

Commit 56914c8

Browse files
yacovmsykesm
authored andcommitted
[FAB-12083] Appease go vet with cancel in cluster
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>
1 parent c362c85 commit 56914c8

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

orderer/common/cluster/comm.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ func (rc *RemoteContext) SubmitStream() (orderer.Cluster_SubmitClient, error) {
404404
ctx, cancel := context.WithCancel(context.TODO())
405405
submitStream, err := rc.Client.Submit(ctx)
406406
if err != nil {
407+
cancel()
407408
return nil, errors.WithStack(err)
408409
}
409410
rc.submitStream = submitStream

scripts/golinter.sh

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,9 @@ fi
4646

4747
echo "Checking with go vet"
4848
PRINTFUNCS="Print,Printf,Info,Infof,Warning,Warningf,Error,Errorf,Critical,Criticalf,Sprint,Sprintf,Log,Logf,Panic,Panicf,Fatal,Fatalf,Notice,Noticef,Wrap,Wrapf,WithMessage"
49-
OUTPUT="$(go vet -all -lostcancel=false -printfuncs $PRINTFUNCS ./...)"
49+
OUTPUT="$(go vet -all -printfuncs $PRINTFUNCS ./...)"
5050
if [ -n "$OUTPUT" ]; then
5151
echo "The following files contain go vet errors"
5252
echo $OUTPUT
5353
exit 1
54-
fi
55-
56-
# This block should removed once the lostcancel issues have been corrected and
57-
# the previous invocation of vet should remove the -lostcancel=false option.
58-
# FAB-12082 - gossip
59-
# FAB-12083 - orderer
60-
OUTPUT="$(go vet -lostcancel=true ./... 2>&1 | grep -Ev '^#|(fabric/)?gossip/comm/comm_impl.go|(fabric)?orderer/common/cluster/comm.go' || true)"
61-
if [ -n "$OUTPUT" ]; then
62-
echo "The following files contain go vet errors"
63-
echo $OUTPUT
64-
exit 1
65-
fi
54+
fi

0 commit comments

Comments
 (0)