golang / gddo

Go Doc Dot Org
https://godoc.org
BSD 3-Clause "New" or "Revised" License
1.1k stars 265 forks source link

Display implements relationships between types and interfaces #127

Open garyburd opened 11 years ago

garyburd commented 11 years ago

List the interfaces implemented by a type. List the types that implement an interface.

Display the lists in a popup or on a separate page.

Consider linking to sourcegraph.com in the interim.

sqs commented 10 years ago

I would contribute the code we use at Sourcegraph for this, but it's no additional work in our Go code or in go/types; it's just an SQL table schema and query, which I'm assuming wouldn't help.

sqs commented 10 years ago

We copied the gcimporter.GcImport and gcimporter.FindPkg functions and modified them slightly to take a build.Context parameter.

sqs commented 10 years ago

Yeah, we compile the dependencies using go get.

vinimdocarmo commented 6 years ago

Hi!

Has this feature been implemented some how yet? If not +1 for it. As a newbie learning golang it's been kinda hard to know which interfaces a certain type implements and which types implements a certain interface.

I got frustrated when I was learning the method bufio.NewScanner for example. It receives a parameter of type io.Reader, which is an interface, but I didn't know in advance which types implement io.Reader.

Is there any easy way to get those informations about a type/interface in www.golang.org?

Thank you,

dmitshur commented 6 years ago

There isn't a solution online for this that I'm aware of, but the godoc command you can run locally has some static analysis features that you might fit your needs. It can tell you all the types in the standard library and your GOPATH workspace that implement io.Reader, for example.

See https://golang.org/lib/godoc/analysis/help.html for more information about it.

vinimdocarmo commented 6 years ago

Thank you, @shurcooL! I'll check it out.