列出在Go中实现接口的所有类型 [英] List all types implementing an interface in Go
问题描述
我是Go的新手,我想知道Goland中是否有一种方法或使用CLI工具来列出实现给定接口的所有类型的方法.
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.
我找到了一个名为 guru
的工具所有接口均由给定类型实现,但我无法使其在CLI中正常工作.
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.
推荐答案
您可以在任何类型/接口上使用Navigate | Declaration
或Navigate | Implementation(s)
,并且会看到按类型实现的接口列表或实现界面.
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.
您还可以使用IDE左侧的类型定义旁边的绿色按钮来执行相同的操作.
You can also use the green buttons on the IDE left side next to their type definitions to perform the same actions.
这篇关于列出在Go中实现接口的所有类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!