]> Cypherpunks repositories - gostls13.git/commit
database/sql: add "defer rows.Close()" to the example code.
authorNigel Tao <nigeltao@golang.org>
Tue, 25 Mar 2014 02:32:18 +0000 (13:32 +1100)
committerNigel Tao <nigeltao@golang.org>
Tue, 25 Mar 2014 02:32:18 +0000 (13:32 +1100)
commit50ca1a52ca39bdd76bb5f999a67450f5984ebba2
treef7cde716ca6b27395b444b64f4ae3b2374e9ad50
parent3750904a7efc36aa4f604497b53a9dc1ea67492b
database/sql: add "defer rows.Close()" to the example code.

Strictly speaking, it's not necessary in example_test.go, as the
Rows.Close docs say that "If Next returns false, the Rows are closed
automatically". However, if the for loop breaks or returns early, it's
not obvious that you'll leak unless you explicitly call Rows.Close.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews, rsc
https://golang.org/cl/79330043
src/pkg/database/sql/example_test.go
src/pkg/database/sql/sql.go