interfaces
2 articles
-
Represent and transform data safely
Go Interface to String: When to Assert and When to Format
Use a type assertion to retrieve a string held by an interface, or fmt to produce a textual representation of another value.
-
Represent and transform data safely
Go Interfaces and Pointer Receivers: Does the Struct or Its Pointer Implement It?
If an interface requires a pointer-receiver method, pass a pointer to the struct: the struct value itself does not satisfy that interface.


