Never miss a beat

Join my newsletter.

Tag: interfaces

How Golang Interfaces Work

Published: 7/8/2019

Interfaces are a tool that allows you to define the behavior of objects and in Golang, interfaces are no different (except that they work on structs instead of “objects”). However, Go has some strange features for interfaces that users from other languages might not expect. Let’s take it slow and start by defining an interface in Go: This fairly simple interface defines what a sandwich is capable of. Not what it looks like, not how it’s composed, but for the purposes of our application it’s all…