Use range over int after 1.22 upgrade #1317

Closed
opened 2024-08-19 07:51:05 +00:00 by fyrchik · 1 comment
Owner

There are many range b.N cases, maybe something else.
https://go.dev/ref/spec#For_range

I would like to do this with gopatch, attach patch here.

There are many `range b.N` cases, maybe something else. https://go.dev/ref/spec#For_range I would like to do this with gopatch, attach patch here.
fyrchik added the
go
label 2024-08-19 07:51:05 +00:00
fyrchik added the
internal
good first issue
labels 2024-08-19 07:52:34 +00:00
elebedeva was assigned by fyrchik 2024-08-19 07:52:40 +00:00
fyrchik added this to the v0.43.0 milestone 2024-08-19 08:17:03 +00:00
Member

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 {
    ...
}

`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 { ... } ```
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#1317
No description provided.