From 342764a21606ba6f964400cc747ee6c9a88fc959 Mon Sep 17 00:00:00 2001 From: Iskander Sharipov Date: Mon, 26 Nov 2018 11:40:32 +0300 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Bryan C. Mills --- src/runtime/pprof/internal/profile/profile.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/runtime/pprof/internal/profile/profile.go b/src/runtime/pprof/internal/profile/profile.go index a6f8354b1e8..443accdd6d3 100644 --- a/src/runtime/pprof/internal/profile/profile.go +++ b/src/runtime/pprof/internal/profile/profile.go @@ -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 } }