When working with Go projects, adhere to the Standard Go Project Layout conventions:
Place executable entry points in the cmd/
directory, with each subdirectory representing a single binary.
Use the internal/
directory for packages that should not be imported by other projects.
Organize code into focused packages with single responsibilities.
Follow Go's standard naming conventions:
New[Type]
for constructorsPlace packages that may be imported by external applications in the pkg/
directory.
Maintain clear separation of concerns between packages.
Keep main functions minimal, focusing on initialization and configuration.
Create small interfaces focused on the consumer's needs.
Pass context through function calls for cancellation support.
Follow idiomatic Go error handling patterns.
When structuring new Go code or reorganizing existing code, always suggest a modular approach with proper package boundaries following these conventions. Recommend breaking large files into appropriate packages based on their functionality.