Programming languages
Go
A simple compiled language with built-in concurrency for network services and infrastructure.
What it is
Robert Griesemer, Rob Pike and Ken Thompson designed Go at Google. It went public in 2009. It is statically typed, compiled and garbage-collected.
The design is deliberately minimal: a small syntax, fast compilation, a single dependency-free binary. Concurrency is built in with goroutines and channels. The standard toolchain includes gofmt, testing and a profiler.
Docker, Kubernetes, Terraform and Prometheus are written in Go. It became the language of cloud infrastructure.
Use it when
- Network services, APIs and microservices with high concurrency.
- CLI tools and DevOps tooling as a single static binary.
- The team wants a simple language with a low barrier to entry and predictable code.
Avoid it when
- Complex domain logic that needs rich abstractions: Go is deliberately limited.
- Frontend, mobile UI and scientific computing.
- Hard real-time needs with no GC pauses: use Rust or C++.
Key concepts
- Goroutine
- A lightweight thread managed by the Go runtime. Started with the
gokeyword, you can create thousands. - Channel
- A typed queue for passing data between goroutines. The idea: do not share memory, communicate over channels.
- Interface
- Satisfied implicitly: if a type has the needed methods it implements the interface, no
implementsrequired. - Error as value
- Errors are returned as ordinary values (
val, err := f()), there are no exceptions. - Modules
- The
go.moddependency system with versioning.
Example
Cheat sheet
| Command or code | What it does |
|---|---|
go mod init example.com/app | Creates a module |
go run . | Runs the program |
go build ./... | Builds all packages |
go test ./... -race | Tests with the race detector |
go get github.com/pkg/name@latest | Adds a dependency |
go mod tidy | Tidies and syncs dependencies |
go func() { ... }() | Starts a goroutine |
ch := make(chan int, 10) | Buffered channel |
if err != nil { return err } | The usual error handling |
defer f.Close() | Deferred call that runs when the function returns |
How to learn it
- Install Go and go through the official Tour of Go.
- Learn types, slices, maps, structs and methods.
- Understand interfaces and error handling by returning error values.
- Study goroutines, channels and the sync and context packages.
- Write an HTTP server using only the net/http standard library.
- Add tests with go test and table driven cases.
- Connect a database and build a small REST API.
- Read Effective Go and look at the Gin framework.
Interview questions
1. What is a goroutine and how does it differ from an OS thread?
A goroutine is a lightweight task managed by the Go scheduler. It starts with a small stack (a few KB) and is multiplexed onto a few OS threads. That is why you can run hundreds of thousands of them.
2. How does Go handle errors?
A function returns the error as its last value, and the caller checks
if err != nil. It is explicit with no hidden control flow, if verbose. Wrapping usesfmt.Errorfwith%w.3. What is context for?
context.Contextcarries cancellation, deadlines and request values through a call chain. That lets long operations stop when the client disconnects.4. Does Go have inheritance?
No. It has composition (embedded structs) and interfaces that are satisfied implicitly.
Related technologies
- GinA fast HTTP framework for Go with a router, middleware and convenient JSON handling.
- DockerDocker packages an application with its dependencies into a container that runs the same on a laptop, a server and the cloud.
- KubernetesKubernetes is a container orchestration system that deploys, scales and heals applications across a cluster of servers.
- RustA systems language with memory safety and no garbage collector: C++ speed without its typical bugs.
Logos belong to their owners and are used for identification only. Icons: Simple Icons (CC0), Devicon (MIT).