I looked at this slide for a while and couldn't understand it. Could you explain the detail a bit ?
It seems like relying on dynamic type casting over a nil variable, is that correct ?
But then what would the following "if" look like ?
This is how you can make sure that a struct implements an interface. The line 'var _ scan.Writer = (*ColumnWriter)(nil)' assigns a nil pointer of the struct to a scan.Writer interface reference which would fail if ColumnWriter doesn't implement the interface. And the casting always works.
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.