empty interface

The interface with no methods, spelled any or interface{}, which every Go type satisfies.

In more detail

Use it only at true boundaries, such as decoded data of unknown shape or print arguments. A value of type any hides its real type from the compiler, so you must assert back to a concrete type before doing anything useful. Typed structs keep compiler checks and are easier to reason about.

Example

func show(value any) {}

Related terms

Taught in

References