• Daniel Martí's avatar
    all: simplify multiple for loops · 49662bc6
    Daniel Martí authored
    If a for loop has a simple condition and begins with a simple
    "if x { break; }"; we can simply add "!x" to the loop's condition.
    
    While at it, simplify a few assignments to use the common pattern
    "x := staticDefault; if cond { x = otherValue(); }".
    
    Finally, simplify a couple of var declarations.
    
    Change-Id: I413982c6abd32905adc85a9a666cb3819139c19f
    Reviewed-on: https://go-review.googlesource.com/c/go/+/165342
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
    49662bc6
walk.go 97.6 KB