Interface — behavior (methods). Struct — data structure.
Interface:
1// Interface2type Speaker interface {3 Speak() string4}56// Any type with Speak() implements Speaker7type Dog struct { Name string }89func (d Dog) Speak() string {10 return "Woof"11}
Struct:
1// Struct2type Person struct {3 Name string4 Age int5}67// Method8func (p Person) Greet() {9 fmt.Println("Hello")10}
Empty interface:
1// Accepts any type2func PrintAnything(v interface{}) {3 fmt.Println(v)4}