Added capacity to slice creation

This commit is contained in:
Vivek V 2019-10-09 19:06:40 +05:30 committed by Márk Sági-Kazár
parent 40e41dd224
commit 72b022eb35

View file

@ -1723,7 +1723,7 @@ func (v *Viper) AllKeys() []string {
m = v.flattenAndMergeMap(m, v.defaults, "") m = v.flattenAndMergeMap(m, v.defaults, "")
// convert set of paths to list // convert set of paths to list
a := []string{} a := make([]string, 0, len(m))
for x := range m { for x := range m {
a = append(a, x) a = append(a, x)
} }