I'm doing some due-diligence and wondering if there's any old topics about extending interfaces to support field sets.
ie. type WithID interface { ID string } type X struct { ID string } type Y struct { ID string } func PrintID(item WithID) { fmt.Println(item.ID) } In the above the PrintID function only accepts structs with a field named `ID` - which X & Y satisfy. This is sort of like duck typing but with fields. I've found https://groups.google.com/g/golang-nuts/c/18gH5TR_3ZE/m/9dyyT4veBgAJ but I don't know the discussion the person was referencing and it seems specific to generics. thanks, dave -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/23a991c6-1aa8-4a64-b718-fc6ebc8a6557n%40googlegroups.com.