How does Go support object-oriented programming concepts?
Go has no classes or inheritance, yet supports encapsulation, polymorphism and reuse through structs, interfaces and embedding. Examples included.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
Go has no classes or inheritance, yet supports encapsulation, polymorphism and reuse through structs, interfaces and embedding. Examples included.
Config files hold structured defaults and environment variables carry deployment settings and secrets. See how to load both in Go and combine them with clear precedence.
How to manage settings in Go programs with environment variables, flags and config files, including validation, defaults, secrets and library options.
Go's toolchain does the build, test and vet work, while scripts decide when it runs. See go generate, tool directives, cross-compilation and CI examples.
Go's built-in commands plus staticcheck, govulncheck and Docker let you automate building, testing, linting and deploying Go programs in CI.
Logging records events, while instrumentation measures behaviour with metrics, traces and profiles. See how to use log/slog, OpenTelemetry and pprof in Go.
A practical guide to Go instrumentation: profiling with pprof, execution traces, Prometheus metrics, health endpoints, structured logs and OpenTelemetry.
Go error handling detects and reports failures; transactions make a group of database changes all-or-nothing. See a runnable transfer example using both.
Practical Go recovery techniques by scenario: fallbacks, retries with backoff, defer cleanup, recover at boundaries and combining errors with errors.Join.
Code organization arranges files and directories, while modularization defines package boundaries. Learn how to structure Go projects well.
Structure Go programs with packages, modules and the internal directory. Covers go.mod, a practical project layout, interfaces and avoiding import cycles.
Profiling finds where a Go program spends time and memory; tuning changes code or runtime settings to fix it. Learn the workflow with pprof, trace and benchstat.
Use pprof, go test benchmarks, runtime/trace and benchstat to find and fix CPU, memory and concurrency bottlenecks in Go programs.
Version control tracks history while code review checks quality before merge. See how Git, Go modules and CI combine in a Go team workflow.
Learn how Go teams review code with pull requests and automated tools like gofmt, go vet and golangci-lint, and how to give feedback that improves readability.
Go documentation tools explain what code does through doc comments and tested examples. Collaboration tools coordinate the developers who change it.
Go doc comments start with the declared name and feed go doc and pkg.go.dev. Covers formatting, examples and inline comments.
Testing checks that code works; QA is the wider process that keeps quality high. See how go test, fuzzing, linters, govulncheck and CI fit together.
A practical tour of verifying Go programs with go test: table-driven tests, fuzzing, race detection, coverage and boundary input validation.
Debugging pauses and inspects a running Go program; logging records what happened. See Delve and log/slog in practice and how to choose between them.