npx claudepluginhub jamesprial/prial-plugins --plugin golang-workflowThis skill uses the workspace's default tool permissions.
Methods with pointer receivers can be called on nil. Must handle nil receiver.
Enforces defensive Go coding to prevent nil panics, append aliasing, map/channel access bugs, defer pitfalls, numeric issues, and data corruption in Go code.
Guides Go interface design patterns: consumer-side definition, accept-interfaces-return-structs, composition, implicit satisfaction, and pitfalls. For decoupling packages, defining contracts, reviewing usage, refactoring for testability.
Provides idiomatic Go patterns and best practices for simplicity, zero values, interfaces, error handling. Useful for writing, reviewing, refactoring, designing Go code.
Share bugs, ideas, or general feedback.
Methods with pointer receivers can be called on nil. Must handle nil receiver.
type Tree struct {
Value int
Left *Tree
}
func (t *Tree) Sum() int {
return t.Value + t.Left.Sum() // PANIC if t or t.Left is nil
}
type Tree struct {
Value int
Left *Tree
Right *Tree
}
func (t *Tree) Sum() int {
if t == nil {
return 0 // Nil tree has sum of 0
}
return t.Value + t.Left.Sum() + t.Right.Sum()
}
// Now safe to call
var tree *Tree // nil
sum := tree.Sum() // Returns 0, no panic
Nil receiver pattern enables elegant recursive algorithms and optional behavior.
If nil receiver doesn't make semantic sense, panic early with clear message.