kata-containers/govmm

Make parameter building consistent

Jakob-Naucke opened this issue · 2 comments

Looking over this file (qemu/qemu.go, editorial note), there are a lot of functions (88, 18 of which are QemuConfig() ones ;) and each seems to handle building up these params differently (either appending with a comma, then joining with a null string; or appending without a separator, then joining with a comma).

Originally posted by @jodh-intel in #179 (review)

@Jakob-Naucke could you clarify what needs to be done here?

e.g.

govmm/qemu/qemu.go

Lines 1027 to 1031 in 263136e

deviceParams = append(deviceParams, fmt.Sprintf(",devno=%s", dev.DevNo))
}
qemuParams = append(qemuParams, "-device")
qemuParams = append(qemuParams, strings.Join(deviceParams, ""))
vs.

govmm/qemu/qemu.go

Lines 1239 to 1242 in 263136e

devParams = append(devParams, fmt.Sprintf("id=%s", dev.ID))
qemuParams = append(qemuParams, "-device")
qemuParams = append(qemuParams, strings.Join(devParams, ","))
is inconsistent -- one joins by commas, the other always puts the comma for each slice element and just concatenates them (btw, the variable naming is also inconsistent in this example).