In Go there’s a type that specifies zero methods is known as empty interface, interface{}
package main
func main() {
var i any
i = 42
i = "foo"
i = struct {
s string
}{
s: "bar",
}
i = f
_ = i
}
func f() {
}
When assigning value to a any type, we lose all type information
Avoid using the any keywords especially in the returns values, Especially when you want to return some data from a function be more expressive in your code any can be helpful if there is a genuine need for accepting or returning any possible type.