Don't show loop header after break statement
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2.5k
- Forks
- 102
- PR merge metrics
- No merged PRs in 30d
Description
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
$
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with the two min.go examples using `godebug run min.go`, then trace the debugger's loop-stepping path. Done means a loop with a declared variable does not print its header again after `break`, while the existing behavior for `for {}` remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100