8000 simple: enforce early return in loops · Issue #1334 · dominikh/go-tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
simple: enforce early return in loops #1334
Open
@nfx

Description

@nfx

Early returns help to reduce nesting levels. I wonder how much effort is it to implement with staticcheck.io. Examples are:

unwanted:

for _, v := range x {
    if condition {
        // do stuff
    }
}

wanted:

for _, v := range x {
    if negatedCondition {
        continue
    }
    // do stuff
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0