Go (Golang)
Overview
Go from Google emphasizes simple syntax, fast compile times, static typing, built-in concurrency (goroutines, channels), and a single static binary deployment story. It is widely used for CLIs, network services, Kubernetes ecosystem tools, and cloud infrastructure.
Key concepts
- Goroutines — Lightweight threads scheduled by the runtime.
- Channels — Communicate sequential processes (CSP style).
- Interfaces — Implicit satisfaction; small interface composition.
- Modules —
go.mod/go.sumdependency management. - Error handling — Explicit
if err != nil(with helper patterns).
Goroutine + channel (conceptual)
Sample: HTTP server
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/api/health", func(w http.ResponseWriter, _ *http.Request) {
fmt.Fprintf(w, `{"ok":true}`)
})
_ = http.ListenAndServe(":8080", nil)
}