-
-
Notifications
You must be signed in to change notification settings - Fork 16
API for gogrep matching engine #55
Comments
As an example usage, I have a linter that wants to flag cases where methods of certain types don't call out to their "super" -- that is, where you have a declaration func (recv *SomeType) SomeMethod(...) ... which does not call recv.<something>.SomeMethod(...) So one part of that is to look for expressions of the form The former constraint we could do with some loss of fidelity (due to shadowing) with gogrep alone, something like |
Sorry that I never replied here. To be honest, I've gotten tired of working on the gogrep project for now, and I don't know when I'll actively get back to it. I assume you already saw the refactor branch linked in #32; that was my latest thinking when it comes to a reusable API. If you want anything other than that, I would suggest to fork or copy code, as that will be the fastest and simplest way. I will probably resurrect/redesign this project at some point in the future, but it's not going to be in the immediate future. |
Totally understandable and appreciate the guidance! I'll post here if I end up forking. |
@benjaminjkraft I would love to have an API, too. |
In writing linters (in my case,
go/analysis
passes to be run as golangci-lint plugins) I find myself wanting some sort of AST-matching engine. This tool seems like a really great one! But I want to use it inside my own tool, rather than as a simple global search, like this package or go-ruleguard is designed to do. To do that, I need to use thegogrep
matcher, but then refer back to the AST or types in an arbitrary way.A sample API that I think would be sufficient, and which looks to my quick glance similar to what you're already using internally:
Related to #32, but it seems like that won't actually do what we would want, for the same reason go-ruleguard isn't quite enough for us: we would still have no direct access to the underlying AST/types.
The text was updated successfully, but these errors were encountered: