x/tools/cmd/guru: no way to find functions which are assignable to (match the signature of) a function type #25165
Labels
Milestone
Comments
This would be a nice feature and could probably become part of the existing "implements" query. If you'd like to contribute the code you wrote, feel free to send out a review. Otherwise, I'd be happy to look into adding this. |
Does anyone have any interest in reviewing this on Gerrit? https://go-review.googlesource.com/c/tools/+/114800 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I define a function type:
And a function which accepts a
Printer
:I'd like to be able to use
guru
to find methods which satisfy thePrinter
type's signature. I'd also be able to find any matching functions for an anonymous function signature too (e.g.var x func(s string)
).guru
is often used to provide text editor features. Having the ability to discover implementations would allow being able to place a caret onp Printer
, selectFind implementations
from the text editor options, then view a list of possible implementations to use.I've put together an example of how this might work at https://gist.github.com/a-h/dd48a97aba7c07f988aac8e529dadf6d
(See Stackoverflow question at https://stackoverflow.com/questions/50059956/how-do-i-find-implementations-of-a-function-type/50086309#50086309)
The text was updated successfully, but these errors were encountered: