pkg/kubectl: preallocate slice

To avoid slice growth with append operations.
This commit is contained in:
Gyu-Ho Lee
2016-05-29 02:09:39 -07:00
parent 825cd920ff
commit a14a288c3f
5 changed files with 21 additions and 20 deletions

View File

@@ -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 {