forked from TrueCloudLab/frostfs-node
[#1317] go.mod: Use range over int
Since Go 1.22 a "for" statement with a "range" clause is able to iterate through integer values from zero to an upper limit. gopatch script: @@ var i, e expression @@ -for i := 0; i <= e - 1; i++ { +for i := range e { ... } @@ var i, e expression @@ -for i := 0; i <= e; i++ { +for i := range e + 1 { ... } @@ var i, e expression @@ -for i := 0; i < e; i++ { +for i := range e { ... } Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
parent
2b3fc50681
commit
a685fcdc96
66 changed files with 135 additions and 135 deletions
|
@ -470,7 +470,7 @@ func testNodeMatrix(t testing.TB, dim []int) ([][]netmap.NodeInfo, [][]string) {
|
|||
ns := make([]netmap.NodeInfo, dim[i])
|
||||
as := make([]string, dim[i])
|
||||
|
||||
for j := 0; j < dim[i]; j++ {
|
||||
for j := range dim[i] {
|
||||
a := fmt.Sprintf("/ip4/192.168.0.%s/tcp/%s",
|
||||
strconv.Itoa(i),
|
||||
strconv.Itoa(60000+j),
|
||||
|
@ -508,7 +508,7 @@ func generateChain(ln int, cnr cid.ID) ([]*objectSDK.Object, []oid.ID, []byte) {
|
|||
ids := make([]oid.ID, 0, ln)
|
||||
payload := make([]byte, 0, ln*10)
|
||||
|
||||
for i := 0; i < ln; i++ {
|
||||
for i := range ln {
|
||||
ids = append(ids, curID)
|
||||
addr.SetObject(curID)
|
||||
|
||||
|
@ -1750,7 +1750,7 @@ func TestGetRange(t *testing.T) {
|
|||
},
|
||||
})
|
||||
|
||||
for from := 0; from < totalSize-1; from++ {
|
||||
for from := range totalSize - 1 {
|
||||
for to := from; to < totalSize; to++ {
|
||||
t.Run(fmt.Sprintf("from=%d,to=%d", from, to), func(t *testing.T) {
|
||||
testGetRange(t, svc, addr, uint64(from), uint64(to), payload)
|
||||
|
@ -1811,7 +1811,7 @@ func TestGetRange(t *testing.T) {
|
|||
},
|
||||
})
|
||||
|
||||
for from := 0; from < totalSize-1; from++ {
|
||||
for from := range totalSize - 1 {
|
||||
for to := from; to < totalSize; to++ {
|
||||
t.Run(fmt.Sprintf("from=%d,to=%d", from, to), func(t *testing.T) {
|
||||
testGetRange(t, svc, addr, uint64(from), uint64(to), payload)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue