diff options
| author | Shulhan <m.shulhan@gmail.com> | 2024-10-26 00:48:33 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2026-02-03 18:04:30 +0700 |
| commit | 011e40da85bddf83fee0ded83cb9115b7a88b3d4 (patch) | |
| tree | 355cc352e66fc64ce94f17658c31e699aa798bb1 /src/runtime | |
| parent | 85232e51b20971e0d211b25fa3aa412bc7987404 (diff) | |
| download | go-011e40da85bddf83fee0ded83cb9115b7a88b3d4.tar.xz | |
all: prealloc slice with possible minimum capabilities
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/callers_test.go | 2 | ||||
| -rw-r--r-- | src/runtime/crash_cgo_test.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/callers_test.go b/src/runtime/callers_test.go index 9429442fc0..c4cea7ef87 100644 --- a/src/runtime/callers_test.go +++ b/src/runtime/callers_test.go @@ -40,7 +40,7 @@ func testCallers(t *testing.T, pcs []uintptr, pan bool) { } } - var seen []string + seen := make([]string, 0, len(m)) for k := range m { seen = append(seen, k) } diff --git a/src/runtime/crash_cgo_test.go b/src/runtime/crash_cgo_test.go index baf4523a7a..cfc45e91ac 100644 --- a/src/runtime/crash_cgo_test.go +++ b/src/runtime/crash_cgo_test.go @@ -711,7 +711,7 @@ func TestBigStackCallbackCgo(t *testing.T) { } func nextTrace(lines []string) ([]string, []string) { - var trace []string + trace := make([]string, 0, len(lines)) for n, line := range lines { if strings.HasPrefix(line, "---") { return trace, lines[n+1:] |
