Kick off your book project in 2 hours! Live workshop on Zoom. You’ll leave with a real book project, progress on your first chapter, and a clear plan to keep going. Tuesday, June 16, 2026. Learn more…

Leanpub Header

Skip to main content

From Ruby to Golang

A Ruby Programmer's Guide to Learning Go

This book is 100% completeLast updated on 2026-06-05

This book is built on one idea: the fastest way for a Rubyist to learn Go is to map every Go concept back to Ruby. Each chapter starts with Ruby code you already understand, then shows the Go equivalent. You’re not learning from scratch — you’re translating.

Take everything you know about Ruby — classes, hashes, exceptions, enumerable methods — and translate it directly to Go. No fluff, no abstract theory, just runnable Ruby-to-Go comparisons with hands-on exercises.

Minimum price

$20.00

$30.00

You pay

Author earns

$
PDF
EPUB
WEB
About

About

About the Book

Learning a new programming language is hard. Learning one that works completely differently from what you know is harder.

From Ruby to Golang skips the abstract theory and teaches Go the way a Rubyist actually learns: by mapping every Go concept back to Ruby. Structs replace classes. Maps replace hashes. `defer` replaces `ensure`. `if err != nil` replaces `begin/rescue`. Goroutines replace threads.

Each chapter starts with Ruby code you already understand, then shows the Go equivalent — complete, runnable, and explained line by line. You'll build structs, slices, maps, interfaces, and goroutines from the ground up, with hands-on exercises at every step.

In today's world of cloud-native microservices and containerized architectures, Go is everywhere. Docker, Kubernetes, Ethereum, and Terraform are built with it. Google, Netflix, Dropbox, and Uber run it in production at scale. It has been battle-tested and proven — a mature, powerful language to build your work on.

Updated for Go 1.22+, this edition covers generics, Go Modules, table-driven testing, JSON and struct tags, and the `go work` workspace command — everything you need to write production Go in 2026.

This book was written with a Rubyist in mind. Every learning metaphor is based on Ruby. If you know Ruby and want to add Go to your toolkit, this is the book.

Author

About the Author

Joel Bryan Juliano

Hi, I'm Joel.

I am Senior Software Engineer with 20+ years of experience.

And with over 20 years in the game, I’ve seen it all and loved every minute of it.

Originally from the Philippines, I am now a Dutchman living in Amsterdam together with my family.

My journey has taken me through a variety of industries, from sports streaming to cybersecurity, and everything in between.

Along the way, I’ve picked up a diverse set of skills and experiences, in which I document into books.

Contents

Table of Contents

Preface

Introduction

  1. Who This Book Is For
  2. How to Use This Book
  3. What This Book Is Not
  4. About the Author

Chapter 1: Getting Started

  1. Package Name and Imports
  2. Println
  3. Printf
  4. Sprintf
  5. Putting It Together
  6. Functions
  7. Function Basics
  8. Function Parameters and Arguments
  9. Function Return Types
  10. Main Function
  11. Chapter Exercises
  12. Summary

Chapter 5: Package Management

  1. Sharing Go Packages
  2. Go Modules
  3. Manual go.mod Generation
  4. Automatic go.mod Generation Through Source-Code
  5. Refresh Go Modules
  6. Go Workspaces
  7. A Note on dep
  8. Chapter Exercises
  9. Summary

Chapter 2: Structs

  1. Struct
  2. Public Structs
  3. Attaching a Struct to a Function
  4. Pass-by-value and Pass-by-reference
  5. Pointer Receiver
  6. Value Receiver
  7. Decouple and Reuse Structs through Embedding
  8. Anonymous Structs
  9. Anonymous Struct Fields
  10. Summary

Chapter 3: Maps

  1. Maps by Declaration
  2. Initialization by Make
  3. Initialization by Literal Type Assignment
  4. Maps by Assignment
  5. Assignment with a Key/Value
  6. Assignment on an Empty Map
  7. Using Struct in Maps
  8. Struct Maps by Declaration
  9. Struct Maps by Assignment
  10. Struct Maps with Array Values
  11. Maps with Dynamic Types
  12. Deleting Map Values
  13. Reading a Non-Present Key from a Map
  14. Variadic Functions
  15. Variadic Functions with Maps
  16. Passing Variadic Arguments
  17. Summary

Chapter 4: Arrays, Slices, and Iteration

  1. Fixed Array
  2. Fixed-Array Automatic Size Calculation
  3. Fixed-Array Sizes
  4. Fixed-Array Assignment Behaviour
  5. Sliced Array
  6. Sliced-Array Assignment Behaviour
  7. Capacity
  8. Deep Copy
  9. Append
  10. Arrays with Variadic Types
  11. Mixed Array Types
  12. Iterating Over Arrays
  13. C-style Semantic Form
  14. Value Semantic Form
  15. Value Semantic Form with Muted Parameter
  16. Index Semantic Form for Range
  17. Value Semantic Form with Pointer Access
  18. Summary

Chapter 6: Collection Functions

  1. Predicate Method all?
  2. Predicate Method any?
  3. Collect Enumerable Method
  4. Cycle Enumerable Method
  5. Detect Enumerable Method
  6. Drop Enumerable Method
  7. Drop While Enumerable Method
  8. Select and Reject
  9. Reduce
  10. Count
  11. Min and Max
  12. Sort
  13. Group By
  14. Summary

Chapter 7: Interfaces

  1. Interface as a Self-Documenting API Reference
  2. Interface as Type contract
  3. Satisfying Return Values
  4. Summary

Chapter 8: Error Handling

  1. Ruby’s Exception Model
  2. Go’s Error-as-Value Model
  3. The error Interface
  4. Creating Errors
  5. Wrapping Errors
  6. defer: Go’s ensure
  7. panic and recover
  8. When Rubyists Overuse Panic
  9. Summary

Chapter 9: Concurrency

  1. Goroutines
  2. Channels
  3. select — Multiplexing Channels
  4. sync.WaitGroup — Waiting for Goroutines
  5. sync.Mutex — When You Need a Lock
  6. The Go Concurrency Proverb
  7. Chapter Exercises
  8. Summary

Chapter 10: Testing

  1. Your First Go Test
  2. Table-Driven Tests
  3. Subtests and Helpers
  4. Benchmarking
  5. Chapter Exercises
  6. Summary

Chapter 11: JSON & Struct Tags

  1. Marshal: Struct to JSON
  2. Struct Tags
  3. Unmarshal: JSON to Struct
  4. Nested Structs and Arrays
  5. Custom JSON Marshaling
  6. Chapter Exercises
  7. Summary

Chapter 12: Generics

  1. The Problem Generics Solve
  2. Your First Generic Function
  3. Constraints
  4. The comparable Constraint
  5. Generic Types
  6. When to Use Generics
  7. Generics vs Ruby Duck Typing
  8. Chapter Exercises
  9. Summary

Chapter 13: HTTP Servers

  1. Your First HTTP Server
  2. Request and Response
  3. Reading a JSON Request Body
  4. Status Codes and Headers
  5. Middleware
  6. A Complete REST Handler
  7. Summary

Appendix A: Go ↔ Ruby Quick Reference

  1. Syntax & Structure
  2. Variables & Types
  3. Data Structures
  4. Functions & Methods
  5. Error Handling
  6. Concurrency
  7. Packages & Modules
  8. Common Patterns
  9. Go CLI Cheat Sheet
  10. File Layout

Appendix B: Exercise Answers

  1. Chapter 1
  2. Chapter 3
  3. Chapter 4
  4. Chapter 5
  5. Chapter 8
  6. Chapter 9
  7. Chapter 10
  8. Chapter 12

Glossary

Acknowledgments

Credits

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