Skip to content

Commit e580ea1

Browse files
authored
fix(lint): direct assign at init instead of assigning to index (#1217)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent d48dce1 commit e580ea1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ledger/verify_block_body.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,25 +227,28 @@ func encodeHead(e *bytes.Buffer, t byte, n uint64) int {
227227

228228
if n <= math.MaxUint16 {
229229
const headSize = 3
230-
var scratch [headSize]byte
231-
scratch[0] = t | byte(additionalInformationWith2ByteArgument)
230+
scratch := [headSize]byte{
231+
t | byte(additionalInformationWith2ByteArgument),
232+
}
232233
binary.BigEndian.PutUint16(scratch[1:], uint16(n))
233234
e.Write(scratch[:])
234235
return headSize
235236
}
236237

237238
if n <= math.MaxUint32 {
238239
const headSize = 5
239-
var scratch [headSize]byte
240-
scratch[0] = t | byte(additionalInformationWith4ByteArgument)
240+
scratch := [headSize]byte{
241+
t | byte(additionalInformationWith4ByteArgument),
242+
}
241243
binary.BigEndian.PutUint32(scratch[1:], uint32(n))
242244
e.Write(scratch[:])
243245
return headSize
244246
}
245247

246248
const headSize = 9
247-
var scratch [headSize]byte
248-
scratch[0] = t | byte(additionalInformationWith8ByteArgument)
249+
scratch := [headSize]byte{
250+
t | byte(additionalInformationWith8ByteArgument),
251+
}
249252
binary.BigEndian.PutUint64(scratch[1:], n)
250253
e.Write(scratch[:])
251254
return headSize

0 commit comments

Comments
 (0)