juniorGolang

How are interfaces implemented in Go?

Updated Apr 28, 2026

Short answer

Interfaces are implemented implicitly. A type implements an interface by implementing its methods. There is no implements keyword.

Deep explanation

An interface is a collection of method signatures. If a struct or custom type possesses all the methods with the exact signatures defined in an interface, it automatically satisfies that interface. This promotes decoupled, duck-typed designs.

Real-world example

Defining a Storage interface and swapping out a MySQLStorage struct for a MockStorage struct during unit testing.

Common mistakes

  • Creating massive interfaces. In Go, interfaces should be small (1-3 methods) following the proverb 'The bigger the interface, the weaker the abstraction.'

Follow-up questions

  • What is the empty interface `interface{}` or `any`?

More Golang interview questions

View all →