Implementation contracts in Go
For a long time, I considered a filled interface type as an
implementation contract in Go. A very quick shorthand on how you can
check for implementation compliance is to add the following snippet to
your _test.go files:
var _ rpc.UserService = &UserService{}Until your UserService meets the interface contract, the test will result in failure. You’re likely to add this check to ensure your API is decoupled and can be used behind that interface.