Go

Go

Made by DeepSource

Simplify if statement for single bool judgment GO-R1004

Anti-pattern
Minor
Autofix

if statement can be simplified where only a single bool judgment is happening. It is more idiomatic not to store the result of a function returning a bool and compare that in if statement's conditional. It is better to skip the initialization expression.

Bad practice

if ok := fn(); ok {
    // body
}

Recommended

if fn() {
    // body
}