News for hackers. Stuff that matters.
Re:Go runtime: 4 years later by dfawcus on Tuesday September 27, 2022 @12:59PM (#32998008)
"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

Re:Go runtime: 4 years later by apatheticonion on Wednesday September 28, 2022 @05:12AM (#33005979)
It's more this scenario https://go.dev/play/p/S2yQqriYTtm

It's because an interface is structurally evaluated only on variable assignment, but it's not always structurally evaluated which limits its usefulness