
NO SILVER BULLET Unpopular opinions about Go
4 snips
May 1, 2025 In this discussion, simplicity in Go is scrutinized, revealing that complex applications demand thoughtful design patterns. The hosts argue that reading the standard library can mislead beginners, and prefer using router libraries for better functionality. They debate the merits of struct-based configuration over the optional pattern, advocating for clear documentation. The conversation also challenges the excessive use of channels and goroutines, emphasizing that concurrency should be applied judiciously. Finally, they explore the practicalities surrounding generics and error handling, highlighting key misconceptions.
AI Snips
Chapters
Transcript
Episode notes
Evolve Project Structure Gradually
- Avoid dogmatic adherence to project structures like 'Golang standards project layout'; start simple and evolve organically. - Group packages meaningfully, use 'internal' and separate non-Go files to keep projects manageable and clear.
Write Stubs Manually for Testing
- Write testing stubs manually rather than using mocking libraries to ease debugging and encourage small, manageable interfaces. - Keep stub implementations close to production code for sync and easier maintenance.
Favor Code Generation Over Reflection
- Prefer code generation over reflection to retain type safety, performance, and easier debugging in ORMs and DI libraries. - Avoid excessive reflection and complex struct tags that obscure code and hinder compile-time checks.
