Fix

"cannot range over X (type Y)"

Fix 'cannot range over X' by dereferencing pointers or converting the value to a slice, array, map, or string.

The error occurs because you are trying to iterate over a type that is not a slice, array, map, or string. You must convert the value to a slice or array before using a range loop.

// If X is a pointer to a slice, dereference it
for _, v := range *X {
    // use v
}

// If X is a custom type, convert it to a slice
for _, v := range X.Slice() {
    // use v
}