Skip to content

Commit

Permalink
Merge pull request #4022 from cockroachdb/go-sample-fix
Browse files Browse the repository at this point in the history
Add db.Close() to go samples
  • Loading branch information
Jesse Seldess authored Nov 9, 2018
2 parents af92186 + 5ac508b commit 6aa5ee1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions _includes/v2.0/app/basic-sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func main() {
if err != nil {
log.Fatal("error connecting to the database: ", err)
}
defer db.Close()

// Create the "accounts" table.
if _, err := db.Exec(
Expand Down
1 change: 1 addition & 0 deletions _includes/v2.0/app/txn-sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func main() {
if err != nil {
log.Fatal("error connecting to the database: ", err)
}
defer db.Close()

// Run a transfer in a transaction.
err = crdb.ExecuteTx(context.Background(), db, nil, func(tx *sql.Tx) error {
Expand Down
1 change: 1 addition & 0 deletions _includes/v2.1/app/basic-sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func main() {
if err != nil {
log.Fatal("error connecting to the database: ", err)
}
defer db.Close()

// Create the "accounts" table.
if _, err := db.Exec(
Expand Down
1 change: 1 addition & 0 deletions _includes/v2.1/app/txn-sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func main() {
if err != nil {
log.Fatal("error connecting to the database: ", err)
}
defer db.Close()

// Run a transfer in a transaction.
err = crdb.ExecuteTx(context.Background(), db, nil, func(tx *sql.Tx) error {
Expand Down

0 comments on commit 6aa5ee1

Please sign in to comment.