Skip to content

Commit ea0db4d

Browse files
committed
Add predicate for package path without "/v2" etc
1 parent f9ae44c commit ea0db4d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

go/ql/lib/semmle/go/Packages.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ class Package extends @package {
1818
)
1919
}
2020

21+
/**
22+
* Gets the path of this package with the major version suffix (like "/v2")
23+
* removed.
24+
*/
25+
string getPathWithoutMajorVersionSuffix() {
26+
result = this.getPath().regexpReplaceAll("[./]v\\d+$", "")
27+
}
28+
2129
/** Gets the scope of this package. */
2230
PackageScope getScope() { packages(this, _, _, result) }
2331

0 commit comments

Comments
 (0)