Skip to content

Commit

Permalink
Direct check error
Browse files Browse the repository at this point in the history
The patchset follows go style to check the err directly.

Change-Id: I78ac78e58db5d247ea59f8f475d9424102e9194a
Signed-off-by: Baohua Yang <baohua.yang@oracle.com>
Signed-off-by: Baohua Yang <yangbaohua@gmail.com>
  • Loading branch information
yeasy authored and denyeart committed Nov 13, 2023
1 parent 4ffd96b commit ab55c25
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions core/common/ccpackage/ccpackage.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,19 @@ import (
// ExtractSignedCCDepSpec extracts the messages from the envelope
func ExtractSignedCCDepSpec(env *common.Envelope) (*common.ChannelHeader, *peer.SignedChaincodeDeploymentSpec, error) {
p := &common.Payload{}
err := proto.Unmarshal(env.Payload, p)
if err != nil {
if err := proto.Unmarshal(env.Payload, p); err != nil {
return nil, nil, err
}
if p.Header == nil {
return nil, nil, errors.New("channel header cannot be nil")
}
ch := &common.ChannelHeader{}
err = proto.Unmarshal(p.Header.ChannelHeader, ch)
if err != nil {
if err := proto.Unmarshal(p.Header.ChannelHeader, ch); err != nil {
return nil, nil, err
}

sp := &peer.SignedChaincodeDeploymentSpec{}
err = proto.Unmarshal(p.Data, sp)
if err != nil {
if err := proto.Unmarshal(p.Data, sp); err != nil {
return nil, nil, err
}

Expand Down

0 comments on commit ab55c25

Please sign in to comment.