]> Cypherpunks repositories - gostls13.git/commit
internal/fmtsort: don't out-of-bounds panic if there's a race condition
authorKeith Randall <keithr@alum.mit.edu>
Sat, 27 Jul 2019 17:13:51 +0000 (10:13 -0700)
committerKeith Randall <khr@golang.org>
Fri, 30 Aug 2019 05:41:23 +0000 (05:41 +0000)
commit579c69ac1ca63d56a1861998f13fb87aeda6d72e
treea57552858e88d0b69358423eb62f70afc9c65ea7
parentf484e9699d9d18e578493dc0f9924ce2b56a42d9
internal/fmtsort: don't out-of-bounds panic if there's a race condition

Raising an out-of-bounds panic is confusing. There's no indication
that the underlying problem is a race.

The runtime already does a pretty good job of detecting this kind of
race (modification while iterating). We might as well just reorganize
a bit to avoid the out-of-bounds panic.

Fixes #33275

Change-Id: Icdd337ad2eb3c84f999db0850ec1d2ff2c146b6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/191197
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
src/internal/fmtsort/sort.go
test/fixedbugs/issue33275.go [new file with mode: 0644]
test/fixedbugs/issue33275_run.go [new file with mode: 0644]