Go Developers
func25's profile
Phuong Le@func25•Jan 29
4.9K
Post cover image

I shipped a transaction bug, so I built a linter

From leonh.fr•Jan 29•11m read time

A developer encountered a production bug where database operations leaked outside transaction boundaries due to accidentally using the wrong repository reference. To prevent recurrence, they built a custom Go linter using the go/analysis framework that detects when code inside transaction callbacks uses outer repository instances instead of the transaction-scoped parameter. The linter walks the AST, tracks transaction parameters through type objects, recursively analyzes helper functions, and catches violations at compile time. It now runs in CI and has found multiple existing violations across the codebase.

Sort:

func25's user avatar
Phuong Le
@func25
Joined Oct 20. 2023
4.9K

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard