Skip to content

Commit 9b03151

Browse files
committed
refactor: optimize vmx encoding buffer writes
Write VMX entries directly into the output buffer instead of formatting an intermediate string first. This avoids unnecessary allocations while preserving the same encoded output. Signed-off-by: Ryan Johnson <ryan@tenthirtyam.org>
1 parent b4dbafb commit 9b03151

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

builder/vmware/common/vmx.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func EncodeVMX(contents map[string]string) string {
7373
for _, c := range caseSensitive {
7474
key = strings.Replace(key, strings.ToLower(c), c, 1)
7575
}
76-
buf.WriteString(fmt.Sprintf(pat, key, contents[k]))
76+
fmt.Fprintf(&buf, pat, key, contents[k])
7777
}
7878

7979
return buf.String()

0 commit comments

Comments
 (0)