From 37a706422c36c76ec0b032fd5aeb0aea341ec465 Mon Sep 17 00:00:00 2001 From: Rodolfo Rodriguez Date: Fri, 24 Nov 2017 22:15:21 -0600 Subject: [PATCH] defer db connection close --- en/05.2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/en/05.2.md b/en/05.2.md index 96dc2292..9fd1852e 100644 --- a/en/05.2.md +++ b/en/05.2.md @@ -39,6 +39,7 @@ The following example shows how to operate on a database based on the `database/ func main() { db, err := sql.Open("mysql", "astaxie:astaxie@/test?charset=utf8") + defer db.Close() checkErr(err) // insert @@ -93,7 +94,6 @@ The following example shows how to operate on a database based on the `database/ fmt.Println(affect) - db.Close() }