What problem does it solve?
This Skill provides a comprehensive guide to Go coding conventions, ensuring that your code is efficient, readable, and maintainable.
Core Features & Use Cases
- Go Coding Conventions: Detailed guidelines on naming, error handling, testing, HTTP handlers, caching, concurrency, and observability.
- Tooling Integration: Instructions on using gopls, linters like
go vet, go-critic, and staticcheck.
- Formatting: Steps for formatting code using
gofumpt and goimports-reviser.
- Structs and Variables: Best practices for struct and variable declarations.
- Abbreviations and Naming: Guidance on naming conventions, including struct names, field names, and variables.
- Imports: Best practices for importing packages and structuring imports.
- Comments: Recommendations on writing effective comments and removing redundant ones.
- Error Handling: Detailed explanation of error handling patterns and conventions.
- Constructors: Best practices for creating constructors with dependency injection.
- Interfaces: Guidelines on defining and using interfaces.
- Logging: Best practices for logging within the Go ecosystem.
- Observability: Recommendations for adding trace spans and metrics.
- Concurrency: Guidance on using goroutines and handling context cancellation.
- Context Values: Best practices for using context values for request-scoped metadata.
- Testing: Instructions for writing table-driven tests and using testing tools.
- HTTP Handlers: Best practices for writing HTTP handlers.
- Service Layer: Guidelines on defining service methods and input validation.
- Repository Layer: Best practices for wrapping repository methods with metrics and tracing.
Quick Start
Load the go-conventions skill to ensure your Go code adheres to best practices.