I built suggest and the library it uses for inspection over about the last 15 hours so both the library and suggest probably need some serious re-writing. (inspect library is here)
I don’t use Go everyday, so I always forget one thing or another and this might help.
It’d be interesting to try to expand to not only functions, though. Like, being able to look for stuff for concurrency and suchs - I know it might be complex, but it’s just an idea.
It’s not the most accurate for some things at the moment since the algorithm I wrote for actually giving functions higher priorities is very basic lol .
Although I have actually tested it with a few search terms and been quite impressed myself with some of the output!
Something I’ve wished for is a tool that would let me enter two types and would return a method or code snippet to go from one to the other. The use case would be answering questions like “I have an http.Request and want a Writer”, “I have a string and want it as a Reader”, “I want a Writer that puts the data in a bytes.Buffer”, and so on.
Hey @mathew, for example do you mean for the “I have a string and want it as a Reader” example, you would expect output such as strings.NewReader?
If that’s what you mean, I like that so I’ll actually keep that in mind.
It’ll be quite some time before I get my code where I want it to be, since the two things I had posted were tiny small prototypes for an idea and now that I have decided to actually turn them into something for a bit of a proper fun project, it’ll actually take a while to write them, unlike just a single day like the other 2 things I had posted took.
But ideas like that are pretty awesome and should be fairly easily to be mixed in to the concept that I’m going to be working on this time!
It’s not even that far off with the bad code that it’s using now
I just tried suggest -for "strings to a reader" and it’s first result was strings: func NewReader(s string) *Reader, but actually that one was more of a fluke probably
Yes, that’s exactly it. I often find myself looking at standard library method lists for the type I have and scanning down for something that returns the data type I want.