Go for Rubyists
Go language guide for Ruby developers โ every concept compared with Ruby
๐ Basics
Variables & Types โ When You Miss Ruby's Dynamic Typing
Surviving a World Without Duck Typing
In Ruby, x = 1 and you're done. In Go, var x int = 1. Annoying at first, but once the compiler catches bugs for you, you start to appreciate it.
Control Flow โ if/for Look Similar but There's No while
A for-loop World Where You'll Miss Ruby's each/map/select
Go has no while. for handles everything. No .each, .map, .select like Ruby. You loop through everything with for range.
Functions & Methods โ Methods in a Classless World
Ruby's def lives inside classes. Go's func attaches to structs.
Go has no classes. Functions are the default, and methods are attached to structs to simulate OOP. Fundamentally different from Ruby's class ... def pattern.
๐ฉ Type System
Struct vs Class โ Living Without Inheritance
Go's Struct Embedding Instead of Ruby's class < Base
Go has no class. Structs hold data, methods attach to structs. Code reuse through embedding instead of inheritance. Similar to Ruby's include/extend, yet different.
Interfaces โ When Ruby's Duck Typing Meets a Type System
No explicit implements โ if the methods match, the interface is satisfied automatically
Go's interface sits between Ruby's duck typing and Java's interface. "If it has these methods, it is this type" โ think of it as compile-time duck typing.
if err != nil โ Why You'll Miss Ruby's begin/rescue
Go doesn't use exceptions. Errors are returned as values. Half your code becomes error handling.
Ruby catches exceptions with begin/rescue/end. Go has no exceptions. Functions return (result, error) and callers check if err != nil every time. This is 50% of Go code.
โก Concurrency
Goroutines โ Lightweight Concurrency on a Different Level Than Ruby's Threads
Run tens of thousands of concurrent tasks with a single go keyword. No GIL.
Ruby's Threads can't achieve true parallelism due to the GIL. Go's goroutines are lighter than OS threads and can run tens of thousands concurrently.
Channels โ Pipelines Between Goroutines
A concept Ruby doesn't have. Safe data passing between goroutines.
Channels are type-safe pipes for sending values between goroutines. Ruby has no exact equivalent. Queue is closest, but channels are a language-level feature.
๐ Project Structure
Packages & Modules โ When Gemfile Becomes go.mod
Ruby's require/gem System vs Go's package/module System
Ruby's Gemfile + Bundler becomes go.mod + go get in Go. Package management concepts are similar, but Go uses GitHub URLs as package names and has no central registry like RubyGems.
Testing โ Living Without RSpec
Go's testing is built into the standard library. No gem install needed.
Setting up RSpec + FactoryBot + shoulda-matchers in Ruby takes 30 minutes. In Go, create a _test.go file and you're ready. One go test command.
๐ฌ OSS Analysis
Keploy โ How eBPF Intercepts Traffic to Auto-Generate API Tests
A CNCF project that creates tests without code changes using Go + eBPF + transparent proxy
Keploy intercepts network syscalls at kernel level via eBPF, records traffic through a transparent proxy, and converts it directly into test cases + mocks. Without changing a single line of code.
eBPF Destination Redirect โ How connect() Syscalls Get Rewritten at Kernel Level
The core mechanism behind transparent proxies used by Keploy, Cilium, and Istio
When an app calls connect() to postgres:5432, eBPF rewrites the destination to 127.0.0.1:proxyPort inside the kernel. The app is completely unaware. Here's how this trick works, examined at the Go code level.