Skip to content

Commit d7be5c6

Browse files
GagziWkaralabe
authored andcommitted
common: changed if-else blocks to conform with golint (#16656)
1 parent d2fe83d commit d7be5c6

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

common/bytes.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,13 @@ func Hex2BytesFixed(str string, flen int) []byte {
8787
h, _ := hex.DecodeString(str)
8888
if len(h) == flen {
8989
return h
90-
} else {
91-
if len(h) > flen {
92-
return h[len(h)-flen:]
93-
} else {
94-
hh := make([]byte, flen)
95-
copy(hh[flen-len(h):flen], h[:])
96-
return hh
97-
}
9890
}
91+
if len(h) > flen {
92+
return h[len(h)-flen:]
93+
}
94+
hh := make([]byte, flen)
95+
copy(hh[flen-len(h):flen], h[:])
96+
return hh
9997
}
10098

10199
func RightPadBytes(slice []byte, l int) []byte {

0 commit comments

Comments
 (0)