Comments (5)
We could use Go-style operators:
x.bar
- call of bar
from a package x
(*x.Foo).bar
- call of bar
from a type x.Foo
however, those look more verbose than the proposed Where(var.Package.Path())
syntax.
from go-ruleguard.
We can't use that syntax, since it has different meaning in Go.
It's a method expression.
Here is an example: https://play.golang.org/p/icaUkRgqCda
Everything inside Match()
argument is a plain gogrep template and it matches everything, except meta variables (things starting with $
) literally, so (*x.Foo).bar
would match method expression.
from go-ruleguard.
What about adding a match that expresses that a specific import path is imported for that file and is not renamed?
If gogrep could handle it, the import package name path could also be transparently replaced to the imported name while applying the match and the replacement.
from go-ruleguard.
Is it still an active discussion?
from go-ruleguard.
@sarathsp06 it is.
But my main problem is the lack of time to work on it. :(
from go-ruleguard.
Related Issues (20)
- Why does ':=' and '=' match differently? (short var declaration vs regular) HOT 2
- panic in runner.go:113 HOT 2
- Not working while importing golangci-lint under deeper packages. HOT 2
- Re-implement xtypes using the newer version of go/types
- panic with generics HOT 1
- Should not recommend to use `ignore` build tag HOT 5
- Ability to check if a match is within a method implementing interface (or method name matches) HOT 2
- Slow rule speed HOT 1
- ruleguard allows rules to be in any package
- [help needed] rule for missing ellipsis in forwarded arg HOT 11
- Ability to match on a non-deferred function call only HOT 2
- [go 1.20] Ruleguard intermittently failing with invalid compilation errors
- /x/tools dependency is too old, causes flaky interface satisfaction failures HOT 1
- Text matcher not behaving as expected HOT 2
- Support for string constexpr evaluation HOT 2
- go1.21: load rules: parse rules file: typechecker error: ...: could not import HOT 22
- Allow filtering by package name (not just path)
- Loop and Configuration HOT 1
- Go 1.22 compatibility HOT 2
- Is it possible to match implementors of generic interfaces? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-ruleguard.