Hello,
Go newbie here

func (data map[string] interface {}) {
 if len(data) == 0 {
 data := make(map[string]interface{})
 data["user"], _ = store.GetUser(context.Get(req, "userid").(string))
 } else {
 data["user"], _ = store.GetUser(context.Get(req, "userid").(string))
 }
 log.Println(data["user"])
}

This produces <nil> in console, where as,


func (data map[string] interface {}) {
 if len(data) == 0 {
 data := make(map[string]interface{})
 data["user"], _ = store.GetUser(context.Get(req, "userid").(string))
 } else {
 data["user"], _ = store.GetUser(context.Get(req, "userid").(string))
 log.Println(data["user"])
 }
}

This produces the right value, why is it so ?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to