Skip to content

Commit 99845f4

Browse files
authored
fix: range over int instead of 3-clause condition (#1013)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent ce9e3d5 commit 99845f4

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

cbor/decode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func DecodeGeneric(cborData []byte, dest any) error {
139139
return errors.New("destination must be a pointer to a struct")
140140
}
141141
destTypeFields := []reflect.StructField{}
142-
for i := 0; i < typeDest.NumField(); i++ {
142+
for i := range typeDest.NumField() {
143143
tmpField := typeDest.Field(i)
144144
if tmpField.IsExported() && tmpField.Name != "DecodeStoreCbor" {
145145
destTypeFields = append(destTypeFields, tmpField)

cbor/encode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func EncodeGeneric(src any) ([]byte, error) {
6363
return nil, errors.New("source must be a pointer to a struct")
6464
}
6565
srcTypeFields := []reflect.StructField{}
66-
for i := 0; i < typeSrc.NumField(); i++ {
66+
for i := range typeSrc.NumField() {
6767
tmpField := typeSrc.Field(i)
6868
if tmpField.IsExported() && tmpField.Name != "DecodeStoreCbor" {
6969
srcTypeFields = append(srcTypeFields, tmpField)

cmd/gouroboros/mem_usage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func testMemUsage(f *globalFlags) {
7979
)
8080
}()
8181

82-
for i := 0; i < 10; i++ {
82+
for range 10 {
8383
showMemoryStats("open")
8484

8585
conn := createClientConnection(f)

ledger/babbage/babbage_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestBabbageBlockTransactions(t *testing.T) {
3838
b.TransactionBodies = make([]BabbageTransactionBody, txsCount)
3939
b.TransactionWitnessSets = make([]BabbageTransactionWitnessSet, txsCount)
4040

41-
for i := 0; i < txsCount; i++ {
41+
for i := range txsCount {
4242
b.TransactionBodies[i] = BabbageTransactionBody{
4343
TxTotalCollateral: 1 << i,
4444
}

protocol/chainsync/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ func (c *Client) syncLoop() {
453453
}
454454
// Request the next block(s)
455455
msgCount := max(c.config.PipelineLimit, 1)
456-
for i := 0; i < msgCount; i++ {
456+
for range msgCount {
457457
msg := NewMsgRequestNext()
458458
if err := c.SendMessage(msg); err != nil {
459459
c.SendError(err)

0 commit comments

Comments
 (0)