more examples
exitstop opened this issue · 2 comments
exitstop commented
Hi, there are not enough examples and how to properly configure gogrep.
How to search recursively only by your project.
- Only works like that:
find -name '*.go' -exec gogrep -x 'if $x != nil { $*_ }' {} \; # Slow
- Doesn't work as you want:
gogrep -r -x 'if $x != nil { $*_ }' # Gives everything that is in GOROOT, but not in my project.
gogrep -r -x 'if $x != nil { $*_ }' main.go # Gives everything that is in GOROOT, but not in my project.
gogrep -x 'if $x != nil { $*_ }' main.go # Returns found in only one file
- Is it possible to make it work like?
grep -r "hello" # Only current dir recursively
mvdan commented
I think you're misunderstanding the point of -r
; it's meant to recurse with dependencies, not with sub-packages.
If you want to query all packages under the current directory, you can just use ./...
as a package argument.
It's true that more examples would be good, but I don't intend to work on that right now.
exitstop commented
Thanks, this is exactly what I need :)
gogrep -x 'if $x != nil { $*_ }' ./...