Google Go Best Practices
Google guidance on robust, maintainable Go patterns for naming, imports, errors, documentation, tests, globals, strings, and interfaces.
Google guidance on robust, maintainable Go patterns for naming, imports, errors, documentation, tests, globals, strings, and interfaces.
- Author: Google
- Authority: community
- Kind: guide
- URL: https://google.github.io/styleguide/go/best-practices
What it covers
- package and interface patterns
- error and testing practices
- global state and string construction guidance
Why authoritative
Practical Google guidance for common Go patterns used to keep large codebases readable and maintainable.
Use when
- what are Google’s Go best practices here
- is this a Google-style Go best practice
- how would Google prefer this Go pattern
Keywords
- google go best practices, google readability, error flow, global state, string construction, test failures
Used by
- docs-comments
- interface-design
- package-layout
- package-and-import-semantics
- variable-shadowing
- zero-values
- error-handling
- error-wrapping
- panic-and-recover
- init-functions
- logging-slog
- subtests
- table-driven-tests
- test-helpers
- testing
- import-style
- error-strings-and-error-flow
- test-failure-messages
- global-state
- string-construction
- flags-and-cli-structure