diff options
| author | Shulhan <m.shulhan@gmail.com> | 2023-05-02 01:06:11 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2024-01-25 04:01:14 +0700 |
| commit | 8096b47dd09fcda8712f7a3c07dced5244123a4d (patch) | |
| tree | 26339e20861f0d89cff1cf3dc763d7b99b4aaee8 /src/runtime | |
| parent | 54386c4a7e68ab281545116220600f670e8f9e14 (diff) | |
| download | go-8096b47dd09fcda8712f7a3c07dced5244123a4d.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 49a1d5a6f7..399be37a16 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 304f1a7554..8a7b3236ed 100644 --- a/src/runtime/crash_cgo_test.go +++ b/src/runtime/crash_cgo_test.go @@ -598,7 +598,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:] |
