Golang Interface for types Implementing the String() func

Earlier today my forgetful nature struck me again and I was trying to remember what the name is of the built-in Go interface for types that implement the String() method / func. It’s the Stringer interface in the fmt package. I figured I better make a quick post here so that I’ve got an easy place to check next time I forget. Truth is, now that I’ve written a post about it I probably won’t forget the next time. Year 12 chemistry exam all over again!

The source for the interface can be found at https://golang.org/src/fmt/print.go#L62.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s