Leanpub Header

Skip to main content

Production Go

Build modern, production-ready web services in Go

Production Go is the book about creating and maintaining modern production applications written in Go. It assumes prior programming knowledge, and is recommended for professional programmers.

Minimum price

Free!

$7.99

You pay

$7.99

Authors earn

$6.39
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
WEB
1,765
Readers
156
Pages
24,166Words
About

About

About the Book

With its focus on simplicity and getting things done, Go is a great language for developing performant, robust and maintainable applications. Production Go first teaches the basics of the Go language, then discusses how to bring an application from development to real users. The authors draw from years of experience running high-volume real-world Go applications to explain the tricks behind making—and keeping—Go applications performant, robust and maintainable.

Author

About the Authors

Herman Schaaf

London-based software engineer developing production Go systems at Skyscanner.

Shawn Smith

Shawn Smith is a software engineer based in Japan. His first contribution to Go was in Fall 2012, and he's been using Go primarily ever since.

Contents

Table of Contents

Introduction

Installing Go

  1. Installation
  2. Writing Code
  3. Editor Integrations
  4. (Optional) Linters and Correctness Tooling

Basics

  1. Program Structure
  2. Variables and Constants
  3. Basic Data Types
  4. Structs
  5. Operators
  6. Conditional Statements
  7. Arrays
  8. Slices
  9. Maps
  10. Loops
  11. Functions
  12. Exported Names
  13. Pointers
  14. Goroutines
  15. Channels
  16. Interfaces
  17. Error Handling
  18. Reading Input
  19. Writing Output

Style and Error Handling

  1. Style
  2. Error Handling
  3. Wrapping Up

Strings

  1. Appending to Strings
  2. Splitting strings
  3. Counting and finding substrings
  4. Advanced string functions
  5. Ranging over a string

Supporting Unicode

  1. A very brief history of string encodings
  2. Strings are byte slices
  3. Printing strings
  4. Runes and safely ranging over strings
  5. Text Normalization
  6. Summary

Concurrency

  1. sync.WaitGroup
  2. errgroup
  3. Channels
  4. Goroutines in web handlers
  5. Pollers
  6. Race conditions

Testing

  1. Why do we need tests?
  2. Writing Tests
  3. Testing HTTP Handlers
  4. Mocking
  5. Generating Coverage Reports
  6. Writing Examples

Benchmarks

  1. A simple benchmark
  2. Comparing benchmarks
  3. Resetting benchmark timers
  4. Benchmarking memory allocations
  5. Modulo vs Bitwise-and

Tooling

  1. Godoc
  2. Go Guru
  3. Race Detector
  4. Go Report Card
  5. Staticcheck
  6. Go-fuzz
  7. govalidate
  8. Pinning tools with Go modules

Security

  1. Keep Go Up to Date
  2. CSRF
  3. HTTP Strict Transport Security (HSTS)
  4. Content Security Policy (CSP)
  5. SQL Injection
  6. See Also

Going into Production

  1. Continuous Integration & Continuous Deployment (CI/CD)
  2. Deployment
  3. Logging
  4. Monitoring
  5. Alerting

Further Reading

Acknowledgements

  1. Licenses

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

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.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

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 $14 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