Go for Ruby Developers
Transfer your Ruby experience to Go: typed values, control flow, slices, functions, methods, interfaces and error handling. Build a tested multi-file order pipeline.
Ruby and Go side by side
The same program in Ruby and in Go, from the lessons of this course.
Files and the first run
Ruby require_relative loads and executes a sibling file once, and modules can be namespaces or mixins. Go sibling files declare one package and compile together; imports are not runtime source includes. Exported names begin uppercase. The course uses a flat…
Ruby1puts "ready"Go1package main2import ("fmt")3 4func main(){fmt.Println("Go", 3)}If and scoped names
Ruby if expressions and ternary expressions can produce a selected value. Go if is a statement and has no ternary operator. Assign inside branches or return explicitly. Preserve valid false, zero and empty values with explicit presence checks rather than…
Ruby1ready = true2puts(ready && 0 || 5)Go1package main2import ("fmt")3 4func main(){if n := len("go"); n > 1 { fmt.Println("long") } else { fmt.Println("short") }}Arrays are values
Ruby Array is growable and assignment aliases the same object. Go arrays are fixed-length values that copy on assignment; Go slices are views over backing storage. Slice assignment can share elements but append can replace the backing allocation, so it is not…
Ruby1items = [4, 8]2saved = items.push(12)3p savedGo1package main2import ("fmt")3 4func main(){a:=[2]int{3,5}5b:=a6b[0]=97fmt.Println(a[0],b[0])}Typed function contracts
Ruby methods normally return the last evaluated expression. Go functions with results require explicit return paths. Go also checks argument and result types at compile time. Return a value to the locked driver rather than printing from a helper and relying…
Ruby1def twice(value)2 value * 23end4puts twice(4)Go1package main2import ("fmt")3func IsEven(n int) bool { return n%2==0 }4func main(){fmt.Println(IsEven(6))}Struct values
Ruby class objects, new and initialize create reference objects. Go structs are values and New-style factory functions are ordinary functions. Go has no class object, initialize hook or automatic constructor call. Use a pointer when shared identity and…
Ruby1class Parcel2 attr_accessor :label3end4parcel = Parcel.new5parcel.label = 'sample'6puts parcel.labelGo1package main2import ("fmt")3type Label struct { Text string }4func main(){a:=Label{Text:"old"}5b:=a6b.Text="new"7fmt.Println(a.Text,b.Text)}Errors are returned values
Ruby raise/rescue/ensure uses exceptional control flow and guaranteed cleanup scopes. Go routine failures are returned errors, checked explicitly by callers. Defer schedules cleanup at function return, not at the end of an arbitrary nested block.…
Ruby1def managed2 yield3ensure4 puts 'released'5end6begin7 managed { Integer('oops', 10) }8rescue ArgumentError9 puts 'invalid'10endGo1package main2import ("fmt";"errors")3func Positive(n int)(int,error) { if n<=0{return 0,errors.New("not positive")};return n,nil }4func main(){_,e:=Positive(-2)5fmt.Println(e!=nil)}
Syllabus
9 chapters48 lessons1 project48 challenges99 quiz questionsValues and expressions
7 lessonsControl flow
5 lessonsCollections
6 lessonsFunctions and pointers
6 lessonsTypes and behavior
8 lessonsErrors and organization
6 lessonsText and absence
4 lessonsOrder pipeline
Project4 lessonsFinal challenges
2 lessonsFrequently asked questions
Who is Go for Ruby Developers for?
For people who already write Ruby and want to learn Go. Each lesson starts from Ruby you know and shows how Go does the same thing, so you skip the beginner basics.
Do I need to know Go already?
No. The course starts with your first Go program. You need Ruby basics: variables, conditions, loops, functions and collections.
How many lessons does Go for Ruby Developers have?
Go for Ruby Developers contains 48 interactive lessons you can complete at your own pace.
What does Go for Ruby Developers cover?
The course is organized into chapters covering: Values and expressions, Control flow, Collections, Functions and pointers, and more.
Is Go for Ruby Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.