Hi!
If you're an experienced developer, you might want to follow this roadmap while taking this course.
This course starts from the most basics than advances toward the end, step by step. So, the complexity of the topics increases on each step. I've intentionally designed it so to make it easy for everyone.
If you think some of the topics are easy for you, then watch the recap lectures and skip the lectures in that section altogether, you can always come back to them later.
BTW, if you're also wondering about why should you learn Go, then scroll down to the bottom of this article.
-
Git clone the repo https://github.com/inancgumus/learngo
-
Read "Side Note About Go Modules" part right after the outline below.
- If you also want to learn about GOPATH, watch: "Learn about GOPATH and Go directory structure" lecture
-
You might want to increase the video speed.
- If you don't know how, here's how you can do that.
👉Then, watch the following lectures in this order.
- Install Go
- Configure: Visual Studio Code
- Code your first program
- Compile and Run your first program using Go Build
- Run your first program using Go Run
- Packages - Learn how to run multiple files
- Packages - Executable vs. Library Packages
- Importing and File Scope
- Importing - Rename imported packages
- Go Doc: Generate documentation automatically from your code
- Watch all the lectures here.
- Zero-Values
- Variable Declaration Examples (Code Along)
- Example: Greeter: Get input from the command-line
- Short Declaration: Initialization & Type Inference
- Short Declaration: Package Scope
- Redeclaration
- When to use short declaration?
- Recap
- Naming Things: Recommendations
- Printf: Recap: Let's summarize
- Numbers: IncDec: Easy Way to Increase and Decrease
- Strings: Raw String Literals
- Strings: Get the length of a string and Introduction to Runes
- Watch all the lectures here.
- Recap: Constants
- Typeless Constants: Understanding Typelessness
- Typeless Constants: Default Types
- Example: Real-Life Usage
- IOTA: Constant Number Generator
- Recap: If Statement
- Then watch all the lectures starting with:
- Error Handling Basics: Introduction
- Fallthrough Statement
- Recap
- Continue Statement and Debugging with Delve
- For Statement: Looping over Slices
- For Range Clause
- Recap: Loops
- Project: Lucky Number Part I: Randomization
- Project: Lucky Number Part II: Seeding with time
- Project: Lucky Number Part III
- Labeled Statements: Labeled Break and Continue
- Labeled Statements: Break from a Switch
- Labeled Statements: Goto (Optional)
The rest is coming soon.
Since Go 1.11, there's a new feature called Go Modules (it was known as vgo before).
With Go Modules, you are not required to put your source code files under $GOPATH anymore. You can put them in any directory that you want.
If you're a power user and want to try this experimental feature, just put your programs in a directory outside of $GOPATH
(this is very important). And then run this to initialize your module:
`go mod init [module-name]`
Afterward, while in this directory, Go assumes that it's like you're under your GOPATH. However, you'll be under your module's directory. You can create as many modules as you want. However, keep it simple and use only one module for now.
-
Let's say that my module directory is under:
~/Desktop/go
-
Also, my github.com username is:
inancgumus
-
And, I have a program called:
hello
-
So, I put my hello program under:
~/Desktop/go/hello
-
Then, while under
~/Desktop/go
I would call mod init like this:go mod init github.com/inancgumus
-
So, if I want to build my program, I'll go into
~/Desktop/go/hello
-
Moreover, I can use usual go build and go run commands there.
-
By doing so, I've created a single module for all my projects. As I've said, you can also create separate modules for each of your projects, like this:
go mod init github.com/inancgumus/hello
For more information check out this wiki article.
If you're curious about why you should learn Go, then check out this summary here.
In summary: Go is easy as Python and Javascript and it's as fast as C/C++. It's more enjoyable to work with Go than C/C++. You can go low-level, or you can stay high-level.
Go is used mostly by web companies: Google, Facebook, Twitter, Uber, Apple, Dropbox, Soundcloud, Medium, Mozilla Firefox, Github, Docker, Kubernetes, and Heroku.
Go is best for: Cross-Platform Command-line Tools, Distributed Network Applications, Cloud technologies like Microservices and Serverless, Web APIs, Database Engines, Big-Data Processing Pipelines, Embedded Development, and so on.
Go is not best for (but doable): Desktop Apps, Writing Operating Systems, Kernel Drivers, Game Development, etc.
Go designed by one of the most influential people in the industry:
- Unix: Ken Thompson
- UTF-8, Plan 9: Rob Pike
- Hotspot JVM (Java Virtual Machine): Robert Griesemer
- Network Driver written in Go (only 10% penalty compared to C driver)
- Google gVisor (User space kernel written in Go)
- Multi-platform Nintendo emulator
- Docker: Container system
- Kubernetes: Container scheduling and management
- VM image deduplication utility
- Chat server
- RUM beacon collector
- Time-series database engine, a client for it, commnad-line tools, etc.
- Map-reduce library
- Clustered front-end-optimizing reverse proxy with on the fly content rewriting, image resizing, caching, Lua event handler execution (all multi-tenant)
- Geographically distributed reverse proxy CDN nodes
- Health management daemon with event handlers and peer to peer reporting
- Pure Go DNS server
- API backend that interfaces with MySQL
- Linux process capture/restore utility
- Reverse Proxy to mask our asset server from clients.
- HTML -> PDF converter for invoice generation.
- URL shortener like tinyurl.com and goo.gl
- SMS messaging service.
- Credit Card payment gateway
- JSON Web Token package
- On the fly image processing services
- 3d render farm/content production pipeline (pretty large project)
- Production lxc container deployment
- Automated testing management
Reference: This reddit post.
Today, every single cloud company has critical components of their cloud infrastructure implemented in Go including Google Cloud, AWS, Microsoft Azure, Heroku, and many others. Go is a key part of cloud companies like Alibaba, Cloudflare, and Dropbox. Go is a critical part of open infrastructure including Kubernetes, Cloud Foundry, Openshift, NATS, Docker, Istio, Etcd, Consul, Juju and many more. Companies are increasingly choosing Go, to build cloud infrastructure solutions.