Leanpub Header

Skip to main content

Go Programming Cookbook, Second Edition

100+ solutions across scaling concurrency, resource budgets, gRPC, databases, profiling, and network security

Go Programming Cookbook, Second Edition
This book is 100% completeLast updated on 2026-08-31

Whenever I've worked on a service, there's always been a morning when it stops being a demo. Then traffic arrives from somewhere nobody planned for, a nightly job overruns into the working day, and a number somebody chose months ago turns out to be wrong. That morning was a different story, though. The thing that separates a survival program from one that doesn't is a set of habits, and those habits can be learned. So, this second edition is organised around them rather than around syntax.

Minimum price

$29.99

$29.99

You pay

Author earns

Packages

Details
$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
1 Previous Editionwith 24 Readers
About

About

About the Book

With Go 1.25, you get a runtime that reads the CPU quota of its own container, a standard library that closes long-standing gaps in filesystem safety and JSON handling, and a testing package that makes concurrent behaviour deterministic. And this second edition puts all of it to excellent use.

This book is all about building one system, rather than a bunch of snippets in a folder. This means you can size a connection pool based on its own statistics, run 40,000 jobs on a fixed number of goroutines, retry serialisation conflicts without corrupting a ledger, and hold tens of thousands of open connections without exhausting file descriptors. Each recipe tackles a real problem, and then there's the simplest code to solve it, along with the reasoning behind when to use it again. Whether you're a developer who's already got some experience with Go and now needs it to get by in production, we've got you covered.

Key Learnings
  • Size worker pools and concurrency limits from measured CPU and memory budgets
  • Confine untrusted file paths so traversal attacks fail in the kernel
  • Test 30 secs timeouts in milliseconds using testing/synctest and its virtual clock
  • Propagate one timeout budget across every service hop without starving downstream callers
  • Retry serialisation conflicts and deadlocks safely with bounded, jittered transaction backoff
  • Find goroutine leaks from a profile and prove their absence in tests
  • Read escape analysis and pprof profiles to remove the allocations that matter
  • Drain response bodies so HTTP connections return to the pool and stay reused
  • Ship schema changes across rolling updates using expand, switch, and contract releases
  • Harden services with govulncheck, minimal images, and secrets that never touch disk

Table of Content
  1. Up and Running with Go 1.25
  2. Go Advanced and Concurrency
  3. File Handling and Data Processing
  4. Building and Managing Go APIs
  5. RPC and gRPC Services
  6. Automation and Concurrency at Scale
  7. Microservices Architecture
  8. Strengthening Database Interactions
  9. Performance, Profiling and Resource Management
  10. Networking, Protocols and Security

Target Readers

This book is for every Go programmer who wants to bring error-free performance, immediate troubleshooting to issues, better reliability and active security. All you need is basics of Go and nothing beyond to pursue this book.

Packages

Pick Your Package

All packages include the ebook in the following formats: PDF and EPUB

This book only

Minimum price

Suggested price$29.99

$29.99

    This book + Extras Downloadable (Web Programming with Go, Second Edition)

    Minimum price

    Suggested price$56.99

    $49.99

    • Web Programming with Go, Second Edition
      Code, create, and troubleshoot every component of web application using Go and its libraries

    This book is also available in the following packages:

    • This book + Extras Downloadable (Co-Intelligence with Claude)

      No Description Available

      • Co-Intelligence with Claude
        You don't have to be a programmer to learn from this book. This book asks nothing of you but your willingness to tell Claude what and how you think. I've written this for the professional who's been thinking, maybe quietly, that their real value wasn't in the busywork. You can automate anything that's between you and them.
      Minimum price
      $49.99
      Suggested price
      $56.99
    • This book + Extras Downloadable (Web Programming with Go, 2nd Edition Co-Intelligence with Claude)

      No Description Available

      • Web Programming with Go, Second Edition
        Code, create, and troubleshoot every component of web application using Go and its libraries
      • Co-Intelligence with Claude
        You don't have to be a programmer to learn from this book. This book asks nothing of you but your willingness to tell Claude what and how you think. I've written this for the professional who's been thinking, maybe quietly, that their real value wasn't in the busywork. You can automate anything that's between you and them.
      Minimum price
      $69.99
      Suggested price
      $76.99

    Author

    About the Author

    GitforGits | Asian Publishing House

    We are the engineer’s publisher, the coder’s mentor, and the content alchemist—meticulously turning dense tech into practical gold. With a growing library of 100+ titles, we don’t just develop technical books, rather we build roadmaps for professionals across Python, MySQL, DevOps, Rust, AI, Kotlin, Arduino, Golang and everything around the massive IT ecosystem. Every chapter, every script, every project is a tool in the hands of developers who want to get things done.

    Where others summarize, we construct step-by-step learning blueprints, cutting through clutter, banning the fluff, and ensuring every paragraph delivers hands-on value. Our audience isn’t learning from scratch—they’re leveling up with purpose, and we stand by them with code-first content, consistent project workflows, and a zero-redundancy approach.

    The Leanpub 60 Day 100% Happiness Guarantee

    Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

    See full terms...

    Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

    We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

    (Yes, some authors have already earned much more than that on Leanpub.)

    In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

    Learn more about writing on Leanpub

    Free Updates. DRM Free.

    If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

    Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

    Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

    Learn more about Leanpub's ebook formats and where to read them

    Write and Publish on Leanpub

    You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

    Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

    Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

    Learn more about writing on Leanpub