npx claudepluginhub jamesprial/prial-plugins --plugin golang-workflowThis skill uses the workspace's default tool permissions.
Nil slices are valid and usable, but behavior differs from empty slices.
Guides Go slices, maps, arrays usage: new vs make, append, nil vs empty slices for JSON, map sets, boundary copying. Activates for collection building/manipulation.
Enforces defensive Go coding to prevent nil panics, append aliasing, map/channel access bugs, defer pitfalls, numeric issues, and data corruption in Go code.
Provides idiomatic Go patterns for simple, maintainable code: zero values, accept interfaces return structs, contextual error wrapping, custom errors. Useful when writing, reviewing, or refactoring Go.
Share bugs, ideas, or general feedback.
Nil slices are valid and usable, but behavior differs from empty slices.
var s []int // nil slice
s = append(s, 1, 2, 3) // OK, creates new backing array
fmt.Println(s) // [1 2 3]
var nilSlice []int // nil slice
emptySlice := []int{} // empty slice (non-nil)
len(nilSlice) == 0 // true
len(emptySlice) == 0 // true
nilSlice == nil // true
emptySlice == nil // false
json.Marshal(nilSlice) // "null"
json.Marshal(emptySlice) // "[]"
// JSON encoding differs
type Response struct {
Items []string // Will encode as null if nil, [] if empty
}