I like to do it this way
x := func() Type {
if val {
return foo()
}
return bar()
}() x := func() Type {
if val {
return foo()
}
return bar()
}()