mailgun / godebug

DEPRECATED! https://github.com/derekparker/delve
Apache License 2.0
2.5k stars 107 forks source link

Don't show loop header after break statement #39

Open jeremyschlatter opened 9 years ago

jeremyschlatter commented 9 years ago

After a loop reaches a break statement, godebug unnecessarily prints the loop statement again.

$ cat min.go
package main

func main() {
    _ = "breakpoint"
    for i := 1; i < 5; i++ {
        break
    }
}
$ godebug run min.go
-> _ = "breakpoint"
(godebug) n
-> for i := 1; i < 5; i++ {
(godebug) n
-> break
(godebug) n
-> for i := 1; i < 5; i++ {
(godebug) n
$

Though note this doesn't happen if no variables are declared in the loop statement:

$ cat min.go
package main

func main() {
    _ = "breakpoint"
    for {
        break
    }
}
$ godebug run min.go
-> _ = "breakpoint"
(godebug) n
-> for {
(godebug) n
-> break
(godebug) n
$