aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/debug
diff options
context:
space:
mode:
authorMarcel Meyer <mm.marcelmeyer@gmail.com>2025-04-11 22:19:49 +0000
committerGopher Robot <gobot@golang.org>2025-04-11 16:00:30 -0700
commit03640f688b6ae069c72373d7aaa8d23784e456fc (patch)
treecf1e88173ae94fd309b3902f066313388c137031 /src/runtime/debug
parent56fad21c22ece03a3f1f059fa67d7593278eb5f4 (diff)
downloadgo-03640f688b6ae069c72373d7aaa8d23784e456fc.tar.xz
all: use built-in min, max functions
Change-Id: Ie76ebb556d635068342747f3f91dd7dc423df531 GitHub-Last-Rev: aea61fb3a054e6bd24f4684f90fb353d5682cd0b GitHub-Pull-Request: golang/go#73340 Reviewed-on: https://go-review.googlesource.com/c/go/+/664677 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/runtime/debug')
-rw-r--r--src/runtime/debug/garbage_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/runtime/debug/garbage_test.go b/src/runtime/debug/garbage_test.go
index cd91782d27..506f698ad7 100644
--- a/src/runtime/debug/garbage_test.go
+++ b/src/runtime/debug/garbage_test.go
@@ -18,7 +18,7 @@ func TestReadGCStats(t *testing.T) {
var stats GCStats
var mstats runtime.MemStats
- var min, max time.Duration
+ var minimum, maximum time.Duration
// First ReadGCStats will allocate, second should not,
// especially if we follow up with an explicit garbage collection.
@@ -52,11 +52,11 @@ func TestReadGCStats(t *testing.T) {
if dt != time.Duration(mstats.PauseNs[off]) {
t.Errorf("stats.Pause[%d] = %d, want %d", i, dt, mstats.PauseNs[off])
}
- if max < dt {
- max = dt
- }
- if min > dt || i == 0 {
- min = dt
+ maximum = max(maximum, dt)
+ if i == 0 {
+ minimum = dt
+ } else {
+ minimum = min(minimum, dt)
}
off = (off + len(mstats.PauseNs) - 1) % len(mstats.PauseNs)
}
@@ -64,8 +64,8 @@ func TestReadGCStats(t *testing.T) {
q := stats.PauseQuantiles
nq := len(q)
- if q[0] != min || q[nq-1] != max {
- t.Errorf("stats.PauseQuantiles = [%d, ..., %d], want [%d, ..., %d]", q[0], q[nq-1], min, max)
+ if q[0] != minimum || q[nq-1] != maximum {
+ t.Errorf("stats.PauseQuantiles = [%d, ..., %d], want [%d, ..., %d]", q[0], q[nq-1], minimum, maximum)
}
for i := 0; i < nq-1; i++ {