mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd: remove some unnecessary gotos
Pick the low-hanging fruit, which are the gotos that don't go very far and labels that aren't used often. All of them have easy replacements with breaks and returns. One slightly tricky rewrite is defaultlitreuse. We cannot use a defer func to reset lineno, because one of its return paths does not reset lineno, and thus broke toolstash -cmp. Passes toolstash -cmp on std cmd. Change-Id: Id1c0967868d69bb073addc7c5c3017ca91ff966f Reviewed-on: https://go-review.googlesource.com/110063 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
030ac2c719
commit
9ecf899b29
7 changed files with 25 additions and 41 deletions
|
|
@ -878,21 +878,20 @@ func (c *ctxt0) sched(p0, pe *obj.Prog) {
|
|||
t = sch[j:]
|
||||
if t[0].comp {
|
||||
if s[0].p.Mark&BRANCH != 0 {
|
||||
goto no2
|
||||
continue
|
||||
}
|
||||
}
|
||||
if t[0].p.Mark&DELAY != 0 {
|
||||
if -cap(s) >= -cap(se) || conflict(&t[0], &s[1]) {
|
||||
goto no2
|
||||
continue
|
||||
}
|
||||
}
|
||||
for u := t[1:]; -cap(u) <= -cap(s); u = u[1:] {
|
||||
if c.depend(&u[0], &t[0]) {
|
||||
goto no2
|
||||
continue
|
||||
}
|
||||
}
|
||||
goto out2
|
||||
no2:
|
||||
}
|
||||
|
||||
if s[0].p.Mark&BRANCH != 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue