1. 3
  1.  

  2. 2

    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?

    1. 2

      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…

      1. 2

        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.

        https://imgur.com/a/WHx5siT

      2. 1

        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.

        1. 1

          I believe

          var _ I = (*A)(nil)
          

          would save you an alloc all together.

          1. 2

            While that is theoretically correct, it turns out that

            var _ I = new(A)
            

            is compiled away, so there is no alloc to remove.