Videos
Structs every where.. But Why ?
Started learning Go today as my second language and I'm having trouble understanding structs and interfaces. So, interfaces define the functions a type should have? And structs group related data together, like objects in JS/TS? But if you can attach functions to structs then wouldn't that struct have functions in it therefore also acting as an interface?? I'm confused, I don't know if this is like Go's little cute take on OOP or what, I've asked ChatGPT to explain it to me like 4 times and I've read the examples on gobyexample and I watched a video, but still don't get it, I probably just need some hands-on practice, but I want to see if I can understand the concept first. I'd appreciate it if anybody has an easy explanation on what's the use of having structs and interfaces instead of structs OR interfaces, or what they're used for, like in what situation do you use one or the other, and overall what makes interfaces useful.