1
0
mirror of https://github.com/golang/go synced 2024-09-29 07:14:29 -06:00

runtime/pprof/internal/profile: use idiomatic swapping

gogrep found only one such case with the pattern below:

	$tmp := $x; $x = $y; $y = $tmp

R=1.13

Change-Id: I6e46fb5ef2887f24fa9fc451323a8cef272e2886
Reviewed-on: https://go-review.googlesource.com/c/151200
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
Iskander Sharipov 2018-11-26 11:40:32 +03:00 committed by Bryan C. Mills
parent d346a9b772
commit 342764a216

View File

@ -211,9 +211,7 @@ func (p *Profile) setMain() {
continue
}
// Swap what we guess is main to position 0.
tmp := p.Mapping[i]
p.Mapping[i] = p.Mapping[0]
p.Mapping[0] = tmp
p.Mapping[i], p.Mapping[0] = p.Mapping[0], p.Mapping[i]
break
}
}