From 2febbb24d9838747fb167c932b7de1a3918e2166 Mon Sep 17 00:00:00 2001 From: Thane Thomson Date: Wed, 4 May 2022 12:37:59 -0400 Subject: [PATCH] types: Improve legibility of switch statements Signed-off-by: Thane Thomson --- types/block.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/types/block.go b/types/block.go index 859b72958..7f5deb737 100644 --- a/types/block.go +++ b/types/block.go @@ -797,9 +797,7 @@ func (ecs ExtendedCommitSig) BlockID(commitBlockID BlockID) BlockID { // ValidateBasic checks whether the structure is well-formed. func (ecs ExtendedCommitSig) ValidateBasic() error { switch ecs.BlockIDFlag { - case BlockIDFlagAbsent: - case BlockIDFlagCommit: - case BlockIDFlagNil: + case BlockIDFlagAbsent, BlockIDFlagCommit, BlockIDFlagNil: default: return fmt.Errorf("unknown BlockIDFlag: %v", ecs.BlockIDFlag) } @@ -821,7 +819,7 @@ func (ecs ExtendedCommitSig) ValidateBasic() error { if len(ecs.ExtensionSignature) != 0 { return errors.New("extension signature is present") } - default: + case BlockIDFlagCommit, BlockIDFlagNil: if len(ecs.ValidatorAddress) != crypto.AddressSize { return fmt.Errorf("expected ValidatorAddress size to be %d bytes, got %d bytes", crypto.AddressSize,