gogrep icon indicating copy to clipboard operation
gogrep copied to clipboard

feature request: -single-file param

Open quasilyte opened this issue 4 years ago • 0 comments

Suppose you're about to do some refactoring inside some specific file. You want to do a -x pattern with -s replacement to get the job done. The problem is that we can't reliably run a gogrep over a single file since it looks like it does a typechecking even if no type-related filters are involved (I may be wrong here).

We can get a cheap fix of this problem by adding a way of telling "I'm giving you a package as a target, but I'm only interested in one specific file". It could either be a bool param that makes gogrep infer the file package from the specified filename, load the package and then print results only for that file. A simpler approach is to make that param a string that tells which filename to include into the output, all other matches should be discarded.

If we generalize, it looks like I need an additional file filter, which may not necessarily be limited to 1 file, but I can't come up with a good use case for that at the moment.

quasilyte avatar Jun 06 '20 17:06 quasilyte