What problem does it solve?
This Skill helps prevent common Go programming pitfalls, such as nil panics, silent data corruption, and subtle runtime bugs, by enforcing defensive coding and best practices.
Core Features & Use Cases
- Nil Safety: Detects and prevents nil pointer dereferences.
- Slice and Map Safety: Mitigates issues with slice aliasing, append behavior, and concurrent map access.
- Numeric Safety: Ensures safe numeric comparisons and type conversions.
- Resource Safety: Manages resources like goroutines and deferred operations correctly.
- Immutability & Defensive Copying: Encourages the use of defensive copying for shared data.
- Initialization Safety: Ensures types are initialized safely, and initializes structures correctly.
- Use Case: When reviewing Go code or writing a new Go application, use this Skill to enforce best practices and improve code safety.
Quick Start
Run the 'golang-safety' skill on your codebase to automatically identify and fix common safety issues.