Fix

"invalid operation: struct comparison" in Go

Fix 'invalid operation: struct comparison' in Go by using reflect.DeepEqual or comparing individual fields instead of the whole struct.

Go forbids comparing structs containing slices, maps, or functions because their values cannot be compared for equality. Replace the struct comparison with reflect.DeepEqual or compare the specific comparable fields individually.

import "reflect"

// Instead of: if a == b { ... }
if reflect.DeepEqual(a, b) {
    // structs are equal
}

Alternatively, compare only the comparable fields (e.g., strings, ints) manually:

if a.ID == b.ID && a.Name == b.Name {
    // structs are equal
}