Was wondering if execution order for struct initialization is guaranteed in GoLang.
Does the following code always produce
obj.a == 1 and obj.b == 2 or is it unspecified behavior?
num := 0
nextNumber := func() int {
num += 1
return num
}
type TwoNumbers struct {
a int
b int
}
obj := TwoNumbers{
a: nextNumber(),
b: nextNumber(),
}