Implicit Interface Implementation

2025-01-153 minTech Related
#golang

Interfaces require no explicit implements keyword.

Interfaces are satisfied automatically.

Example:

type Writer interface {
    Write([]byte) (int, error)
}

type File struct{}

func (File) Write(b []byte) (int, error) {
    return len(b), nil
}