From Ruby to Golang
From Ruby to Golang
A Ruby Programmer's Guide to Learning Go
About the Book
Imagine that you like to learn a new programming language, and you start by leveraging what you already know and bridge the gap in learning specific parts of the new language. This book was created on that idea, it starts with using my existing language knowledge and experience to breakdown Go into familiar Ruby concepts and implementations.
By teaching familiar implementations found in Ruby, you will see the correlation between the two languages, establishing familiar concepts to give you enough knowledge to be comfortable with Go and to start programming with it.
In today's world of cloud native microservices, containerized architectures, You can be up-to-date with a knowledge in Go. Many notable open-source projects are built using Go (i.e. Docker, Kubernetes, Ethereum and Terraform to name a few), and those platforms have APIs and SDKs readily available natively for you to use. And many global companies have been using Go in production (i.e. Google, Netflix, Dropbox, Heroku and Uber to name a few), proving that it has been battle-tested and powerful mature language to based your work into.
This book was made with a Rubyist in mind, all the learning metaphors are based on Ruby and I think it will help you to learn Go programming language when you already knows Ruby. Go can be your second or third programming language and this book can help you get started.
Table of Contents
- Preface
-
Introduction
- About the Author
-
Chapter 0: Go Primer
- Package Name and Imports
- Println
- Printf
- Sprintf
- Functions
- Function Basics
- Function Parameters and Arguments
- Function Return Types
- Main Function
-
Chapter 1: Structs
- Instance Variables
- Struct
- Public Structs
- Attaching a Struct to a Function
- Pass-by-value and Pass-by-reference
- Pointer Receiver
- Value Receiver
- Decouple and Reuse Structs through Inheritance
- Anonymous Structs
- Anonymous Struct Fields
- Chapter Questions
-
Chapter 2: Maps
- Maps by Declaration
- Initialization by Make
- Initialization by Literal Type Assignment
- Maps by Assignment
- Assignment with a Key/Value
- Assignment on an Empty Map
- Using Struct in Maps
- Struct Maps by Declaration
- Struct Maps by Assignment
- Struct Maps with Array Values
- Maps with Dynamic Types
- Deleting Map Values
- Reading a Non-Present Key from a Map
- Variadic Functions
- Variadic Interface
- Maps with Variadic Interface
- Chapter Questions
-
Chapter 3: Arrays and Slices
- Fixed Array
- Fixed-Array Automatic Size Calculation
- Fixed-Array Sizes
- Fixed-Array Assignment Behaviour
- Sliced Array
- Sliced-Array Assignment Behaviour
- Capacity
- Deep Copy
- Append
- Arrays with Variadic Types
- Empty Interface Array Type
- Chapter Questions
-
Chapter 4: Array Navigation
- C-style Semantic Form
- Value Semantic Form
- Value Semantic Form with Muted Parameter
- Index Semantic Form for Range
- Value Semantic Form with Pointer Access
- Chapter Questions
-
Chapter 5: Package Management
- Sharing Go Packages
- Package Management using Go Modules
- Manual go.mod Generation
- Automatic go.mod Generation Through Source-Code
- Automatic go.mod Generation Through dep Package Manager
- Refresh Go Modules
- Package Management using Dep
- Chapter Questions
-
Chapter 6: Collection Functions
-
Predicate Method
all?
-
Predicate Method
any?
- Collect Enumerable Method
- Cycle Enumerable Method
- Detect Enumerable Method
- Drop Enumerable Method
- Drop While Enumerable Method
- Chapter Questions
-
Predicate Method
-
Chapter 7: Interfaces
- Interface as a Self-Documenting API Reference
- Interface as Type contract
- Satisfying Return Values
- Chapter Questions
- Glossary
- Acknowledgments
- Credits
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 earnedover $14 millionwriting, 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