Preface
Introduction
Who This Book Is For
How to Use This Book
What This Book Is Not
About the Author
Chapter 1: Getting Started
Package Name and Imports
Println
Printf
Sprintf
Putting It Together
Functions
Function Basics
Function Parameters and Arguments
Function Return Types
Main Function
Chapter Exercises
Summary
Chapter 1 Quiz
3 attempts allowed
Chapter 5: Package Management
Try It Yourself
Sharing Go Packages
Try It Yourself
Go Modules
Try It Yourself
Manual go.mod Generation
Try It Yourself
Automatic go.mod Generation Through Source-Code
Try It Yourself
Refresh Go Modules
Go Workspaces
A Note on dep
Try It Yourself
Chapter Exercises
Summary
Chapter 5 Quiz
3 attempts allowed
Chapter 2: Structs
Struct
Try It Yourself
Public Structs
Try It Yourself
Attaching a Struct to a Function
Try It Yourself
Pass-by-value and Pass-by-reference
Try It Yourself
Pointer Receiver
Try It Yourself
Value Receiver
Try It Yourself
Decouple and Reuse Structs through Embedding
Try It Yourself
Anonymous Structs
Try It Yourself
Anonymous Struct Fields
Try It Yourself
Summary
Chapter 2 Quiz
3 attempts allowed
Chapter 3: Maps
Try It Yourself
Maps by Declaration
Initialization by Make
Try It Yourself
Initialization by Literal Type Assignment
Try It Yourself
Maps by Assignment
Assignment with a Key/Value
Assignment on an Empty Map
Chapter Exercises
Using Struct in Maps
Struct Maps by Declaration
Struct Maps by Assignment
Struct Maps with Array Values
Maps with Dynamic Types
Try It Yourself
Deleting Map Values
Try It Yourself
Reading a Non-Present Key from a Map
Try It Yourself
Variadic Functions
Try It Yourself
Variadic Functions with Maps
Try It Yourself
Passing Variadic Arguments
Try It Yourself
Try It Yourself
Summary
Chapter 3 Quiz
3 attempts allowed
Chapter 4: Arrays, Slices, and Iteration
Try It Yourself
Fixed Array
Try It Yourself
Fixed-Array Automatic Size Calculation
Try It Yourself
Fixed-Array Sizes
Try It Yourself
Fixed-Array Assignment Behaviour
Try It Yourself
Sliced Array
Try It Yourself
Sliced-Array Assignment Behaviour
Try It Yourself
Capacity
Try It Yourself
Deep Copy
Try It Yourself
Append
Try It Yourself
Arrays with Variadic Types
Try It Yourself
Mixed Array Types
Try It Yourself
Iterating Over Arrays
Chapter Exercises
C-style Semantic Form
Try It Yourself
Value Semantic Form
Try It Yourself
Value Semantic Form with Muted Parameter
Try It Yourself
Index Semantic Form for Range
Try It Yourself
Value Semantic Form with Pointer Access
Try It Yourself
Summary
Chapter 4 Quiz
3 attempts allowed
Chapter 6: Collection Functions
Predicate Method all?
Try It Yourself
Predicate Method any?
Try It Yourself
Collect Enumerable Method
Try It Yourself
Cycle Enumerable Method
Try It Yourself
Detect Enumerable Method
Try It Yourself
Drop Enumerable Method
Try It Yourself
Drop While Enumerable Method
Try It Yourself
Select and Reject
Try It Yourself
Reduce
Try It Yourself
Count
Try It Yourself
Min and Max
Try It Yourself
Sort
Try It Yourself
Group By
Try It Yourself
Summary
Chapter 6 Quiz
3 attempts allowed
Chapter 7: Interfaces
Interface as a Self-Documenting API Reference
Try It Yourself
Interface as Type contract
Try It Yourself
Satisfying Return Values
Try It Yourself
Try It Yourself
Summary
Chapter 7 Quiz
3 attempts allowed
Chapter 8: Error Handling
Ruby’s Exception Model
Go’s Error-as-Value Model
The error Interface
Creating Errors
Wrapping Errors
defer: Go’s ensure
panic and recover
When Rubyists Overuse Panic
Chapter Exercises
Summary
Chapter 8 Quiz
3 attempts allowed
Chapter 9: Concurrency
Goroutines
Try It Yourself
Channels
Try It Yourself
select — Multiplexing Channels
Try It Yourself
sync.WaitGroup — Waiting for Goroutines
Try It Yourself
sync.Mutex — When You Need a Lock
Try It Yourself
The Go Concurrency Proverb
Chapter Exercises
Summary
Chapter 9 Quiz
3 attempts allowed
Chapter 10: Testing
Your First Go Test
Try It Yourself
Table-Driven Tests
Try It Yourself
Subtests and Helpers
Try It Yourself
Benchmarking
Chapter Exercises
Summary
Chapter 10 Quiz
3 attempts allowed
Chapter 11: JSON & Struct Tags
Marshal: Struct to JSON
Struct Tags
Unmarshal: JSON to Struct
Nested Structs and Arrays
Custom JSON Marshaling
Try It Yourself
Chapter Exercises
Summary
Chapter 11 Quiz
3 attempts allowed
Chapter 12: Generics
The Problem Generics Solve
Your First Generic Function
Constraints
The comparable Constraint
Generic Types
When to Use Generics
Generics vs Ruby Duck Typing
Try It Yourself
Chapter Exercises
Summary
Chapter 12 Quiz
3 attempts allowed
Chapter 13: HTTP Servers
Your First HTTP Server
Request and Response
Reading a JSON Request Body
Status Codes and Headers
Middleware
A Complete REST Handler
Chapter Exercises
Summary
Chapter 13 Quiz
3 attempts allowed
Final Exam
Final Exam
2 attempts allowed
Appendix A: Go ↔ Ruby Quick Reference
Syntax & Structure
Variables & Types
Data Structures
Functions & Methods
Error Handling
Concurrency
Packages & Modules
Common Patterns
Go CLI Cheat Sheet
File Layout
Appendix B: Exercise Answers
Chapter 1
Chapter 3
Chapter 4
Chapter 5
Chapter 8
Chapter 9
Chapter 10
Chapter 12
Glossary
Acknowledgments
Credits
From Ruby to Golang: The Course
Use what you already know in Ruby to write idiomatic, production-ready Go.
Learn Go through the lens of Ruby, comparing each idiom side by side. Quizzes after every chapter and a final exam earn you a certificate.
Minimum price
$149
$149
You pay
Author earns
About
About the Course
From Ruby to Go
Use what you already know in Ruby to write idiomatic, production-ready Go.
What You'll Learn
✔ Set up Go and manage packages and modules
✔ Map Ruby objects and hashes to structs and maps
✔ Work with arrays, slices and collection functions
✔ Design with interfaces
✔ Handle errors the Go way
✔ Write concurrent code with goroutines
✔ Test, encode JSON with struct tags, and use generics
✔ Build HTTP servers
Who Is This Course For?
Ruby and Rails developers who want to add Go to their toolkit.
Prerequisites
Solid Ruby experience. No Go experience needed.
Why This Course?
Every Go concept is introduced next to the Ruby you already know, with side-by-side comparisons and exercises.
How It Works
- 13 chapters, each ending with a 5-question multiple-choice quiz (3 attempts, best score counts)
- A 20-question final exam covering the whole course
- 85 quiz questions in total
- Score 70% to pass; 85% or more earns honors
- Pass to receive a certificate of completion
Written by Joel Bryan Juliano.
This course is included in this track...
Categories
Instructor
About the Instructor
Hi, I'm Joel.
I am Dutch-Filipino 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.
My journey has taken me through a variety of industries, from sports streaming to cybersecurity, both in the private sector and for the Dutch government, and everything in between.
Along the way, I’ve picked up a diverse set of skills and experiences, in which I document into books.
Material
Course Material
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.)
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.
