gogrep
gogrep copied to clipboard
$*_ for import specs
It seems that $*_
can't be used inside import spec:
import ($*_; "something/of/interest"; $*_)
The parsing error is:
cannot parse expr: 1:1: expected statement, found 'import'
If this is expected behavior, this issue can be closed.
This is very similar to #48. Dollar expressions just get converted to gogrep_N
identifiers, so that's not a valid import spec there.
I think even if #32 becomes a preferred way to match something like this, it would be cool to have a way to match it via patterns as well.
To avoid another very similar issue, I'll add an additional case here:
type ($*_; $_ $x; $*_)
The type $_ $x
pattern can't match type spec if it's inside ( )
group.
Needed to make https://github.com/quasilyte/go-ruleguard/pull/43 more reliable.