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/cmd/dist | |
| parent | 54386c4a7e68ab281545116220600f670e8f9e14 (diff) | |
| download | go-8096b47dd09fcda8712f7a3c07dced5244123a4d.tar.xz | |
all: prealloc slice with possible minimum capabilities
Diffstat (limited to 'src/cmd/dist')
| -rw-r--r-- | src/cmd/dist/build.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 96199bcbfa..f778c85475 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -707,7 +707,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 ) @@ -1914,7 +1914,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 @@ -1937,7 +1937,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{ |
