This account has never commented and only posted links to their own blog. This is the definition of a spammer. Can an admin please boot them?
Sometimes I really feel it would help to quickly check this from the documentation. Knowing what types are implementing what is actually growing with experience, but it’s hard to remember them all. Testing this by hand each time is really annoying…
gopls will give a list of the interfaces a type implements. I don’t know the explicit gopls interaction, but in emacs, if you put point on a type and hit M-RET g i, it will list the interfaces it implements, and take you there if you pick one.
M-RET g i
You could package this functionality into a library by using os.Exec to execute the code under a different process and seeing if it manages to compile.
I’m mostly joking, but tbh I’ve never been that desperate to know if something implements an interface.
var _ I = (*A)(nil)
would save you an alloc all together.
While that is theoretically correct, it turns out that
var _ I = new(A)
is compiled away, so there is no alloc to remove.