File tree Expand file tree Collapse file tree 6 files changed +9
-8
lines changed
Expand file tree Collapse file tree 6 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ func WithInteractive(interactive bool) Option {
124124// a selection is displayed and the user must choose one
125125func DefaultSelectCluster (discoverOutput * discovery.DiscoverOutput ) (* discovery.Cluster , error ) {
126126 clusterNameToID := make (map [string ]string )
127- options := []string {}
127+ options := make ( []string , 0 , len ( discoverOutput . Clusters ))
128128
129129 for _ , cluster := range discoverOutput .Clusters {
130130 clusterNameToID [cluster .Name ] = cluster .ID
Original file line number Diff line number Diff line change @@ -68,8 +68,9 @@ func ResolveRegion(cfg config.ConfigurationSet) error {
6868 regionFilter = regionFilterCfg .Value .(string )
6969 }
7070
71- options := []string {}
72- options = append (options , ResolvePartitionRegions (partitionID )... )
71+ partitionList := ResolvePartitionRegions (partitionID )
72+ options := make ([]string , 0 , len (partitionList ))
73+ options = append (options , partitionList ... )
7374
7475 options , err := utils .RegexFilter (options , regionFilter )
7576 if err != nil {
Original file line number Diff line number Diff line change @@ -342,7 +342,7 @@ func formatXMLText(s string) (string, error) {
342342func (c * AzureADClient ) encodeQueryParams (params map [string ]string ) string {
343343 var buffer bytes.Buffer
344344
345- keys := []string {}
345+ keys := make ( []string , 0 , len ( params ))
346346
347347 for k := range params {
348348 keys = append (keys , k )
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ func (s *configSet) Get(name string) *Item {
160160}
161161
162162func (s * configSet ) GetAll () []* Item {
163- items := []* Item {}
163+ items := make ( []* Item , 0 , len ( s . config ))
164164 for _ , item := range s .config {
165165 items = append (items , item )
166166 }
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ func ListDiscoveryPluginRegistrations() []*DiscoveryPluginRegistration {
131131 pluginsLock .Lock ()
132132 defer pluginsLock .Unlock ()
133133
134- plugins := []* DiscoveryPluginRegistration {}
134+ plugins := make ( []* DiscoveryPluginRegistration , 0 , len ( discoveryPlugins ))
135135 for _ , registration := range discoveryPlugins {
136136 plugins = append (plugins , registration )
137137 }
@@ -143,7 +143,7 @@ func ListIdentityPluginRegistrations() []*IdentityPluginRegistration {
143143 pluginsLock .Lock ()
144144 defer pluginsLock .Unlock ()
145145
146- plugins := []* IdentityPluginRegistration {}
146+ plugins := make ( []* IdentityPluginRegistration , 0 , len ( identityPlugins ))
147147 for _ , registration := range identityPlugins {
148148 plugins = append (plugins , registration )
149149 }
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ import (
2929type SelectItemFunc func (prompt string , items map [string ]string ) (string , error )
3030
3131func DefaultItemSelection (promptMessage string , items map [string ]string ) (string , error ) {
32- options := []string {}
32+ options := make ( []string , 0 , len ( items ))
3333
3434 for key := range items {
3535 options = append (options , key )
You can’t perform that action at this time.
0 commit comments