aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/dist
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2024-10-26 00:48:33 +0700
committerShulhan <m.shulhan@gmail.com>2026-02-03 18:04:30 +0700
commit011e40da85bddf83fee0ded83cb9115b7a88b3d4 (patch)
tree355cc352e66fc64ce94f17658c31e699aa798bb1 /src/cmd/dist
parent85232e51b20971e0d211b25fa3aa412bc7987404 (diff)
downloadgo-011e40da85bddf83fee0ded83cb9115b7a88b3d4.tar.xz
all: prealloc slice with possible minimum capabilities
Diffstat (limited to 'src/cmd/dist')
-rw-r--r--src/cmd/dist/build.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index e4250e12de..91ea7eb498 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -737,7 +737,7 @@ func runInstall(pkg string, ch chan struct{}) {
// Start final link command line.
// Note: code below knows that link.p[targ] is the target.
var (
- link []string
+ link = make([]string, 0, 1)
targ int
ispackcmd bool
)
@@ -1967,7 +1967,7 @@ func cmdlist() {
brokenFlag := flag.Bool("broken", false, "include broken ports")
xflagparse(0)
- var plats []string
+ plats := make([]string, 0, len(cgoEnabled))
for p := range cgoEnabled {
if broken[p] && !*brokenFlag {
continue
@@ -1990,7 +1990,7 @@ func cmdlist() {
FirstClass bool
Broken bool `json:",omitempty"`
}
- var results []jsonResult
+ results := make([]jsonResult, 0, len(plats))
for _, p := range plats {
fields := strings.Split(p, "/")
results = append(results, jsonResult{