diff --git a/cbor/decode.go b/cbor/decode.go index 09d21e61..58c60d9b 100644 --- a/cbor/decode.go +++ b/cbor/decode.go @@ -139,7 +139,7 @@ func DecodeGeneric(cborData []byte, dest interface{}) error { return errors.New("destination must be a pointer to a struct") } destTypeFields := []reflect.StructField{} - for i := 0; i < typeDest.NumField(); i++ { + for i := range typeDest.NumField() { tmpField := typeDest.Field(i) if tmpField.IsExported() && tmpField.Name != "DecodeStoreCbor" { destTypeFields = append(destTypeFields, tmpField) diff --git a/cbor/encode.go b/cbor/encode.go index 1913b73c..79fcfcc3 100644 --- a/cbor/encode.go +++ b/cbor/encode.go @@ -63,7 +63,7 @@ func EncodeGeneric(src interface{}) ([]byte, error) { return nil, errors.New("source must be a pointer to a struct") } srcTypeFields := []reflect.StructField{} - for i := 0; i < typeSrc.NumField(); i++ { + for i := range typeSrc.NumField() { tmpField := typeSrc.Field(i) if tmpField.IsExported() && tmpField.Name != "DecodeStoreCbor" { srcTypeFields = append(srcTypeFields, tmpField) diff --git a/cmd/gouroboros/mem_usage.go b/cmd/gouroboros/mem_usage.go index 238c41f4..85ebff27 100644 --- a/cmd/gouroboros/mem_usage.go +++ b/cmd/gouroboros/mem_usage.go @@ -79,7 +79,7 @@ func testMemUsage(f *globalFlags) { ) }() - for i := 0; i < 10; i++ { + for range 10 { showMemoryStats("open") conn := createClientConnection(f) diff --git a/ledger/babbage/babbage_test.go b/ledger/babbage/babbage_test.go index 29d992a4..abb9b5de 100644 --- a/ledger/babbage/babbage_test.go +++ b/ledger/babbage/babbage_test.go @@ -38,7 +38,7 @@ func TestBabbageBlockTransactions(t *testing.T) { b.TransactionBodies = make([]BabbageTransactionBody, txsCount) b.TransactionWitnessSets = make([]BabbageTransactionWitnessSet, txsCount) - for i := 0; i < txsCount; i++ { + for i := range txsCount { b.TransactionBodies[i] = BabbageTransactionBody{ TxTotalCollateral: 1 << i, } diff --git a/protocol/chainsync/client.go b/protocol/chainsync/client.go index f0a328ca..8bcfe072 100644 --- a/protocol/chainsync/client.go +++ b/protocol/chainsync/client.go @@ -453,7 +453,7 @@ func (c *Client) syncLoop() { } // Request the next block(s) msgCount := max(c.config.PipelineLimit, 1) - for i := 0; i < msgCount; i++ { + for range msgCount { msg := NewMsgRequestNext() if err := c.SendMessage(msg); err != nil { c.SendError(err)