当该方法的结构已更改时,两次调用 defer 会发生什么?
例如:
rows := Query(`SELECT FROM whatever`)
defer rows.Close()
for rows.Next() {
// do something
}
rows = Query(`SELECT FROM another`)
defer rows.Close()
for rows.Next() {
// do something else
}
哪个rows时候上次rows.Close()打电话?
qq_花开花谢_0
猛跑小猪
相关分类