From a585c75115b45eb150ef7e8aea7a77048570aaf5 Mon Sep 17 00:00:00 2001 From: cuishuang Date: Fri, 27 Sep 2024 20:07:45 +0800 Subject: [PATCH] fix: fix slice init length Signed-off-by: cuishuang --- xml.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml.go b/xml.go index 98ad7924..da467037 100644 --- a/xml.go +++ b/xml.go @@ -164,7 +164,7 @@ func xmlFunc(f *Faker, xo *XMLOptions) ([]byte, error) { } // Get key order by order of fields array - keyOrder := make([]string, len(xo.Fields)) + keyOrder := make([]string, 0, len(xo.Fields)) for _, f := range xo.Fields { keyOrder = append(keyOrder, f.Name) }