GoEcosystem Style Guide
This document outlines the coding standards and style guidelines for GoEcosystem projects.
Go Code Style
- Follow the Effective Go guidelines
- Use
gofmt
to format your code - Follow the Go Code Review Comments
Package Structure
- Use small, focused packages
- Group packages by domain rather than type
- Avoid circular dependencies
- Keep the
main
package as small as possible
Error Handling
- Error values should be returned as the last return value
- Check errors immediately
- Use descriptive error messages
- Consider using wrapped errors (Go 1.13+)
Documentation
- Document all exported identifiers
- Write clear, concise documentation
- Include examples where appropriate
- Keep documentation up-to-date with code changes