How do you assign a struct field variable in a multiple assignment statement? Please refer to code below.
type TestMultipleReturns struct {
value string
}
func (t *TestMultipleReturns) TestSomething() {
someMap := make(map[string]string)
someMap["Test"] = "world"
t.value, exists := someMap["doesnotexist"] // fails
// works, but do I really need a 2nd line?
tmp, exists := someMap["doesnotexist"]
t.value = tmp
if exists == false {
fmt.Println("t.value is not set.")
} else {
fmt.Println(t.value)
}
}