golang/xenlight: sort cases in switch statement
authorNick Rosbrook <rosbrookn@gmail.com>
Mon, 15 Jun 2020 15:39:42 +0000 (11:39 -0400)
committerGeorge Dunlap <george.dunlap@citrix.com>
Mon, 15 Jun 2020 15:47:59 +0000 (16:47 +0100)
commit1251402caf8685f45d9d580f01583370f7e2d272
tree4391da68063cacd1d803964e2507c61a99048716
parentfec6a7af5c5760b9bccd9e7c3eaf29f0401af264
golang/xenlight: sort cases in switch statement

The xenlight_golang_union_from_C function iterates over a dict to
construct a switch statement that marshals a C keyed union into a Go
type. Because python does not guarantee dict ordering across all
versions, this can result in the switch statement being generated in a
different order depending on the version of python used. For example,
running gengotypes.py with python2.7 and python3.6 will yield different
orderings.

Iterate over sorted(cases.items()) rather than cases.items() to fix
this.

This patch changes the ordering from what was previously checked-in, but
running gengotypes.py with different versions of python will now yield
the same result.

Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
Release-acked-by: Paul Durrant <paul@xen.org>
tools/golang/xenlight/gengotypes.py
tools/golang/xenlight/helpers.gen.go