Bit of an odd use of an anonymous function IMO. Normally I'd write that as:
foo := "that"
if bar {
foo = "that"
}
Unless the assignment of "foo" is expensive, then you'd assign it in an else.
If you really want to, you can do it in a single line too:
foo := map[bool]string{true: "this", false: "that"}[bar]