Philipp Winter
Validating data in Go # Mat Ryer’s approach to validating data in Go is simple and elegant. I have been using it extensively while building WhyNotLog. The idea is to define a Validator interface and any type that implements this interface is validation-ready:
type Validator interface { Validate() map[string]string } The Validate method returns a map of field names to problem descriptions. The map is a bit unwieldy, so I like returning a Problems type instead:
Philipp Winter