I am new for golang, I think following code is too redundant , is there any way simplify it ?
name, ok := fieldsMap["name"] if !ok { name = "" } topic, ok := fieldsMap["topic"] if !ok { topic = "" } desc, ok := fieldsMap["desc"] if !ok { topic = "" } if result, err := db.Exec("INSERT INTO rooms VALUES('%s' , '%s', '%s', '%s', '%d', %t, %t, '%s')", roomjid, name, desc, topic, false, fieldsMap["secret"]); err != nil { panic(" insert new room into database failed") } Rooms[roomjid].locking = false -- 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.