Skip to content

G602 false positive skip iteration #1444

@bgadrian

Description

@bgadrian

Having a for loop that skips the last value leads to a false positive

inside a method in which list []any is a param

for i:= 0; i < len(list)-1; i += 2 {
fmt.Sprintf(list[i])
fmt.Sprintf(list[i+1])
}

Leads to a severity high of G602: slice index out of range

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions