mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
pkg/kubectl: preallocate slice
To avoid slice growth with append operations.
This commit is contained in:
@@ -827,7 +827,7 @@ func (BasicPod) Generate(genericParams map[string]interface{}) (runtime.Object,
|
||||
}
|
||||
|
||||
func parseEnvs(envArray []string) ([]api.EnvVar, error) {
|
||||
envs := []api.EnvVar{}
|
||||
envs := make([]api.EnvVar, 0, len(envArray))
|
||||
for _, env := range envArray {
|
||||
pos := strings.Index(env, "=")
|
||||
if pos == -1 {
|
||||
|
||||
Reference in New Issue
Block a user