# xxjwxc/uber_go_guide_cn

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/xxjwxc-uber-go-guide-cn).**

8,172 stars · 1,337 forks · Apache-2.0

## Links

- GitHub: https://github.com/xxjwxc/uber_go_guide_cn
- awesome-repositories: https://awesome-repositories.com/repository/xxjwxc-uber-go-guide-cn.md

## Topics

`chinese` `cn` `go` `guide` `style` `uber`

## Description

This project is a translated Go language style guide and programming standard. It provides a collection of coding standards and best practices designed to ensure that Go code remains maintainable, readable, and efficient.

The guide focuses on idiomatic patterns for error handling, interface compliance, and memory optimization. It establishes standards for package naming and the use of functional options to maintain backward compatibility in constructors.

It covers a broad range of capabilities, including concurrency management for coordinating process lifecycles and preventing resource leaks. Further guidance is provided on memory optimization through pre-allocation strategies, the use of static analysis for automated linting, and the implementation of table-driven unit testing workflows.

## Tags

### Programming Languages & Runtimes

- [Go Ecosystem Conventions](https://awesome-repositories.com/f/programming-languages-runtimes/language-specifications-standards/language-specifications/go-ecosystem-conventions.md) — Provides comprehensive standards for Go ecosystem conventions, including coding styles and project layouts.
- [Collection Capacity Reservation](https://awesome-repositories.com/f/programming-languages-runtimes/collection-capacity-reservation.md) — Recommends specifying initial capacity for collections to minimize runtime memory reallocations. ([source](https://github.com/xxjwxc/uber_go_guide_cn#readme))
- [Compile-Time Interface Verification](https://awesome-repositories.com/f/programming-languages-runtimes/compile-time-interface-verification.md) — Provides patterns for verifying that a type implements an interface at compile time using zero-value assignments.
- [Deferred Resource Management](https://awesome-repositories.com/f/programming-languages-runtimes/deferred-resource-management.md) — Promotes the use of delayed execution patterns to ensure system locks and files are reliably released.
- [Identifier Naming Conventions](https://awesome-repositories.com/f/programming-languages-runtimes/identifier-naming-conventions.md) — Establishes standardized naming conventions for packages and variables to ensure codebase consistency. ([source](https://github.com/xxjwxc/uber_go_guide_cn#readme))
- [Memory Allocation Optimizations](https://awesome-repositories.com/f/programming-languages-runtimes/memory-allocation-optimizations.md) — Provides strategies for pre-allocating data structures to reduce garbage collection overhead. ([source](https://github.com/xxjwxc/uber_go_guide_cn/blob/master/README.md))
- [Go Memory Optimization](https://awesome-repositories.com/f/programming-languages-runtimes/memory-allocation-optimizations/go-memory-optimization.md) — Offers specific strategies for optimizing Go runtime memory usage and reducing GC pressure.
- [Static Analysis Tools](https://awesome-repositories.com/f/programming-languages-runtimes/language-ecosystems-tooling/programming-environments-tooling/go-environments/static-analysis-tools.md) — Guides the use of automated linting and static analysis tools to enforce style consistency.

### Software Engineering & Architecture

- [Coding Standards](https://awesome-repositories.com/f/software-engineering-architecture/development-methodologies/engineering-best-practices/code-craftsmanship-standards/coding-standards.md) — Provides a curated collection of language conventions and formatting rules to ensure code remains readable and maintainable. ([source](https://github.com/xxjwxc/uber_go_guide_cn/blob/master/README.md))
- [Go Quality Validators](https://awesome-repositories.com/f/software-engineering-architecture/automated-code-quality-tools/go-quality-validators.md) — Provides a framework for validating Go-specific formatting, linting, and performance standards.
- [Code Style Guides](https://awesome-repositories.com/f/software-engineering-architecture/code-style-guides.md) — Establishes human-readable standards for naming, formatting, and layout to ensure consistent Go source code.
- [Concurrency Managers](https://awesome-repositories.com/f/software-engineering-architecture/concurrency-managers.md) — Provides guidelines for coordinating the lifecycles of concurrent operations and managing task cancellation.
- [Task Lifecycle Coordination](https://awesome-repositories.com/f/software-engineering-architecture/concurrent-state-coordination/task-lifecycle-coordination.md) — Explains how to synchronize the start and stop times of concurrent tasks to ensure predictable shutdowns.
- [Error Handling Patterns](https://awesome-repositories.com/f/software-engineering-architecture/error-handling-patterns.md) — Defines idiomatic architectural approaches for treating errors as explicit return values and wrapping them for context. ([source](https://github.com/xxjwxc/uber_go_guide_cn#readme))
- [Error Wrapping](https://awesome-repositories.com/f/software-engineering-architecture/error-reporting/custom-error-interfaces/error-wrapping.md) — Establishes standardized patterns for wrapping errors to provide context without causing duplicate log entries.
- [Functional Options](https://awesome-repositories.com/f/software-engineering-architecture/functional-design-patterns/functional-options.md) — Implements the pattern of using variadic functions in constructors to handle optional parameters while maintaining compatibility.
- [Goroutine Leak Prevention](https://awesome-repositories.com/f/software-engineering-architecture/memory-usage-analysis/memory-leak-prevention/goroutine-leak-prevention.md) — Provides best practices for managing goroutine lifecycles to prevent memory leaks. ([source](https://github.com/xxjwxc/uber_go_guide_cn#readme))
- [Resource Acquisition and Release](https://awesome-repositories.com/f/software-engineering-architecture/resource-acquisition-and-release.md) — Implements deferred execution patterns to ensure reliable acquisition and release of system locks and files. ([source](https://github.com/xxjwxc/uber_go_guide_cn#readme))
- [Shared Resource Lifecycles](https://awesome-repositories.com/f/software-engineering-architecture/rpc-cancellation/asynchronous-operation-cancellation/context-aware-cancellation/resource-lifecycle-managers/shared-resource-lifecycles.md) — Defines synchronization mechanisms to coordinate the shutdown of shared concurrent resources. ([source](https://github.com/xxjwxc/uber_go_guide_cn/blob/master/README.md))

### Part of an Awesome List

- [Slice Capacity Pre-allocation](https://awesome-repositories.com/f/awesome-lists/devtools/memory-allocation/slab-based-pre-allocation/slice-capacity-pre-allocation.md) — Provides strategies for pre-allocating data collection capacity to minimize runtime overhead and garbage collection pressure.

### Education & Learning Resources

- [Go Concurrency Guides](https://awesome-repositories.com/f/education-learning-resources/go-concurrency-guides.md) — Serves as a guide for managing parallel execution and synchronization specifically within the Go language.

### Development Tools & Productivity

- [Code Quality and Analysis](https://awesome-repositories.com/f/development-tools-productivity/code-quality-analysis.md) — Employs static analysis and formatting tools to maintain a consistent visual style and identify potential bugs. ([source](https://github.com/xxjwxc/uber_go_guide_cn/blob/master/README.md))
- [Table-Driven Tests](https://awesome-repositories.com/f/development-tools-productivity/debugging-profiling-testing/test-execution-management/test-suites/table-driven-tests.md) — Organizes repetitive testing logic into structured data slices to increase test coverage and simplify maintenance.
- [Static Code Linting](https://awesome-repositories.com/f/development-tools-productivity/static-code-linting.md) — Recommends the use of automated static analysis tools to enforce style consistency and detect errors.

### Testing & Quality Assurance

- [Table-Driven Tests](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/unit/unit-testing/table-driven-tests.md) — Implements structured table-driven testing workflows to increase code coverage and simplify maintenance.
