How does Go support modularity and reusable code?
Go supports modularity with packages, modules, small interfaces, embedding and generics. Learn how to structure reusable Go code with best practices and examples.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
Go supports modularity with packages, modules, small interfaces, embedding and generics. Learn how to structure reusable Go code with best practices and examples.
A measure-first guide to optimising Go programs: benchmarks, pprof and tracing, allocation reduction, sync.Pool, bounded concurrency and efficient I/O.
Build a JSON API in Go using only the standard library: routing, validation, middleware, client timeouts, graceful shutdown and tests.
Use golang.org/x/text and go-i18n v2 to match languages, translate messages, handle plurals and format numbers for each locale in Go programs.
A practical tour of strings, strconv, regexp, bufio and encoding packages in Go, with UTF-8 pitfalls and efficient string-building techniques.
A practical guide to JSON and XML serialization in Go: struct tags, streaming encoders and decoders, custom marshalers, error handling and when to pick each approach.
Go includes testing, benchmarks, fuzzing, coverage, race detection, and profiling in its toolchain. See each feature with runnable code and best practices.
A practical tour of data storage in Go: database/sql with pooling and transactions, NoSQL clients, atomic file writes, in-memory caches and when to use an ORM.
A practical guide to securing Go applications: crypto, TLS, input handling, secrets, concurrency safety and tools like govulncheck, gosec and the race detector.
Go's net package makes TCP, UDP and HTTP programming straightforward. See servers, clients, deadlines, TLS and graceful shutdown with working code.
Go has errors as values instead of exceptions. Learn layered error handling, HTTP mapping, retries with errors.Join, testing and the mistakes to avoid.
Goroutines run work concurrently and channels pass data between them safely. Learn buffered channels, select, WaitGroup and a worker pool with runnable Go code.
Go runs lightweight goroutines on a runtime scheduler and coordinates them with channels. See how that compares with threads in Python, Java and C++.
Go suits IoT through ARM cross-compilation for Linux boards and TinyGo for microcontrollers. See MQTT telemetry code, design tips and when to use each toolchain.
Go suits IoT gateways and embedded Linux with static binaries, networking and concurrency. See examples, and where MQTT and microcontrollers need other tools.
Use gomobile to share Go code with Android and iOS, Fyne or Gio for full apps, and TinyGo or cross-compilation for embedded devices. Examples and design tips.
Go fits mobile backends and embedded Linux well, and gomobile or TinyGo cover more targets. See what the standard library can and cannot do on each.
Go offers fast numerics, Gonum matrices and statistics, and easy parallelism for research workloads. Learn techniques, limits and where Python still wins.
See what Go's standard library offers for research code: CSV parsing, statistics, exact math, random sampling and parallelism, plus when Gonum is needed.
Go has no built-in graphics, but goroutines, the net package and Ebitengine make it a solid choice for 2D games, multiplayer servers and game backends.