> The problem is that I can't declare the variable and set it's value as part of the same operation.
Care to elaborate? Consider the following:
var foo = func() struct{ Bar int } {
if os.Getenv("BAR") == "1" {
return struct{ Bar int }{1}
}
return struct{ Bar int }{2}
}()
Is there a case where the foo variable can be assigned to something other than one of the two conditional-dependent values?