列出在Go中实现接口的所有类型
问题描述:
I'm new to Go, and I'd like to know if there's a way in Goland or w/ a CLI tool to list all the types that implement a given interface.
I found a tool called guru
that can list all interfaces implemented by a given type, but I haven't been able to make it work in CLI.
我是Go的新手,我想知道Goland中是否有办法或 CLI工具列出了实现给定接口的所有类型。 p>
我找到了一个名为 guru code> 可以列出由给定类型实现的所有接口,但我无法使其在CLI中工作。 p> div>
答
You can use Navigate | Declaration
or Navigate | Implementation(s)
on any type/interface and you'll see a list of interfaces implemented by a type or of types implementing an interface.
You can also use the green buttons on the IDE left side next to their type definitions to perform the same actions.