|
|
|
|
|
by dfawcus
1357 days ago
|
|
"You can accept a struct where an interface is a parameter but you cannot return a struct where an interface is the return type." Possibly I'm misunderstanding the complaint, but that is because an interface is a fat pointer, so one returns a pointer to a struct implementing the interface. https://go.dev/play/p/YOa6NF7rjPF |
|
It's because an interface is structurally evaluated only on variable assignment, but it's not always structurally evaluated which limits its usefulness