You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
What is Go
What is Go
Go (often called Golang) is an open-source programming language created at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. It was publicly announced in 2009 and reached version 1.0 in 2012. Go was designed to address the challenges of building large-scale, reliable software at Google — particularly long compile times, dependency management complexity, and the difficulty of writing concurrent programs.
A Brief History
- 2007 — Robert Griesemer, Rob Pike, and Ken Thompson begin designing Go at Google
- 2009 — Go is publicly announced as an open-source project
- 2012 — Go 1.0 released with the Go 1 compatibility promise — code written for Go 1.0 will continue to compile and run
- 2015 — Go 1.5 — the compiler is rewritten from C to Go (self-hosting)
- 2018 — Go Modules introduced for dependency management
- 2022 — Go 1.18 adds generics, the most significant language change since 1.0
- 2024 — Go 1.22 introduces range-over-integer and improved loop variable scoping
- Today — Go powers critical infrastructure at Google, Docker, Kubernetes, Cloudflare, and thousands of companies worldwide
Design Philosophy
Go was designed with a clear set of principles:
1. Simplicity
Go deliberately has a small language specification. There is usually one obvious way to do something. The language avoids features like inheritance, operator overloading, and implicit conversions.
2. Readability
Go code should be easy to read and understand — even by programmers who did not write it. The gofmt tool enforces a single formatting style across all Go code.
3. Fast Compilation
Go compiles to native machine code in seconds, even for large projects. This was a direct response to the slow C++ build times experienced at Google.
4. Built-in Concurrency
Go has first-class support for concurrency through goroutines and channels, making it straightforward to write programs that do many things at once.
5. Pragmatism
Go is designed for real-world software engineering, not academic elegance. It includes garbage collection, strong typing, and a rich standard library.
Key Features at a Glance
| Feature | Description |
|---|---|
| Statically typed | Types are checked at compile time |
| Compiled | Produces a single native binary — no runtime dependency |
| Garbage collected | Automatic memory management |
| Concurrent | Goroutines and channels built into the language |
| Simple syntax | ~25 keywords, minimal language specification |
| Fast builds | Large projects compile in seconds |
| Cross-platform | Compile for Linux, macOS, Windows, ARM, and more |
| Rich standard library | HTTP server, JSON, crypto, testing, and more — built in |
| Single binary | Deploy a single executable with no external dependencies |
What is Go Used For?
Go is particularly popular in the following areas:
Cloud and Infrastructure
Go is the dominant language for cloud-native tools:
- Docker — container runtime
- Kubernetes — container orchestration
- Terraform — infrastructure as code
- Prometheus — monitoring and alerting
- etcd — distributed key-value store
Web Services and APIs
Go's standard library includes a production-grade HTTP server:
- RESTful APIs and microservices
- gRPC services
- Reverse proxies and load balancers (e.g., Caddy, Traefik)
Command-Line Tools
Go produces single static binaries, making CLI tool distribution trivial:
- GitHub CLI (
gh) - Hugo (static site generator)
- CockroachDB CLI
Networking and Distributed Systems
Go's concurrency model excels at network programming:
- DNS servers (CoreDNS)
- Service meshes (Istio, Linkerd)
- Message brokers (NATS)
How Go Compares
| Feature | Go | Python | Java | Rust | C++ |
|---|---|---|---|---|---|
| Compilation | Native binary | Interpreted | JVM bytecode | Native binary | Native binary |
| Garbage collection | Yes | Yes | Yes | No (ownership) | No (manual) |
| Concurrency | Goroutines + channels | asyncio / threads | Threads + virtual threads | async / threads | Threads |
| Learning curve | Low | Low | Medium | High | High |
| Build speed | Very fast | N/A | Slow | Slow | Slow |
| Memory safety | GC + no pointer arithmetic | GC | GC | Compile-time guarantees | Manual |
| Generics | Yes (since 1.18) | Yes (duck typing) | Yes | Yes | Yes (templates) |
The Go Ecosystem
Go Modules
Go uses modules for dependency management. A module is a collection of packages with a go.mod file that declares its dependencies.
Standard Library Highlights
| Package | Purpose |
|---|---|
net/http |
HTTP client and server |
encoding/json |
JSON encoding and decoding |
fmt |
Formatted I/O |
os |
Operating system functionality |
testing |
Built-in test framework |
context |
Request-scoped values, cancellation, deadlines |
sync |
Mutexes, WaitGroups, and other primitives |
io |
I/O interfaces and helpers |
crypto |
Cryptographic functions |
database/sql |
Generic SQL database interface |
Popular Third-Party Libraries
| Library | Purpose |
|---|---|
| Gin / Echo / Chi | HTTP frameworks |
| GORM | ORM for databases |
| Cobra / urfave/cli | CLI application frameworks |
| Zap / zerolog | Structured logging |
| Viper | Configuration management |
| sqlx | Extensions to database/sql |
The Go Playground
The Go team provides an online playground at go.dev/play where you can write, run, and share Go code directly in your browser — no installation required.
Tip: Go's official website is go.dev. The documentation, tour, blog, and package index are all available there.
Summary
Go is a statically typed, compiled language designed for simplicity, fast compilation, and built-in concurrency. Created at Google to address the challenges of large-scale software engineering, it has become the language of choice for cloud infrastructure, web services, and command-line tools. Its small feature set, fast builds, and single-binary deployment model make it an excellent choice for teams building production systems. In the following lessons, we will set up Go and write our first program.