# How to get your database access code deadlocked in Golang

DevFeed: [How to get your database access code deadlocked in Golang](<https://devfeed.tech/articles/how-to-get-your-database-access-code-deadlocked-in-golang-5968.md>)

Original publisher: [Read original article](<https://turso.tech/blog/how-to-get-your-database-access-code-deadlocked-in-golang-f31ec98c3833>)

Author: Piotr Jastrzebski

Published: 2023-07-27T00:00:00Z

Content type: tutorial

Language: en

Sources: [Turso Blog](<https://devfeed.tech/sources/turso-blog.md>)

Topics: [Deadlock](<https://devfeed.tech/topics/deadlock.md>), [C++](<https://devfeed.tech/topics/c-plus-plus.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [database](<https://devfeed.tech/tags/database.md>), [deadlock](<https://devfeed.tech/tags/deadlock.md>), [golang](<https://devfeed.tech/tags/golang.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [turso](<https://devfeed.tech/tags/turso.md>)

## AI overview

A Go database/sql deadlock can occur when an error exits a row-processing loop before the rows are closed. The article explains that explicitly closing rows releases a reader lock so a deferred writer-lock operation can proceed.

## Source excerpt

Unlike C++ or Rust, Golang is supposed to be a programmer friendly language. Most of the time it does a great job in increasing developer productivity by being a relatively easy programming language...