Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you quickly find the implementation(s) of an interface in Golang? [duplicate]

Tags:

go

Let's say I want to find all implementations of the io.ReadCloser interface.

How can I do this in Go?

like image 946
Bijan Avatar asked May 03 '15 10:05

Bijan


People also ask

Where is the implementation class of interface in Intellij?

Press Ctrl+F12 or choose Navigate | Implementation(s) from the main menu . Alternatively, you can press Ctrl+Shift+A , start typing the command name in the popup, and then choose it there.

How do you define an interface in Golang?

Go language interfaces are different from other languages. In Go language, the interface is a custom type that is used to specify a set of one or more method signatures and the interface is abstract, so you are not allowed to create an instance of the interface.


1 Answers

You can use:

  • the go oracle implements command
  • the go types Implements() function (which was used by Sourcegraph at one time)

You also have:

  • dominikh/implements (uses go types as well)
  • fzipp/pythia, a browser based user interface (uses go oracle)
like image 75
VonC Avatar answered Oct 25 '22 09:10

VonC