Go

Go

Made by DeepSource

Redundant boolean condition GO-W1028

Bug risk
Major
Autofix

Redundant boolean expressions are boolean expressions that are either always true, or always false. Such boolean expressions can be simplified, which may improve a readability of the code. In some cases, this also indicates a presence of other issues.

Bad practice

func foo(a bool) {
    _ = a || true
    _ = a && false
}

Recommended

func foo(_ bool) {
    _ = true
    _ = false
}