3 ms·
So it's a static typing check ? the code won't even compile if the ColumnWriter struct doesn't implement the interface ?
by bsaul 12y ago
So it's a static typing check ? the code won't even compile if the ColumnWriter struct doesn't implement the interface ?
- webtopaz 12y agoYes. It won't compile. This check is not really needed as the code would fail when a function which accepts scan.Writer would fail (compilation) if ColumnWriter is sent and if it doesn't satisfy the interface. However, this is easier to debug.
- NateDad 12y agoYeah, this type of check is nice if you intend to implement an interface, but don't actually use the type as that interface in your package. This will give a compile time error if your type doesn't satisfy the interface. You could write a test for it too, but this is a little simpler and harder to miss.