File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ class Package extends @package {
23
23
* removed.
24
24
*/
25
25
string getPathWithoutMajorVersionSuffix ( ) {
26
- result = this .getPath ( ) .regexpReplaceAll ( "[./]v\\d+" , "" )
26
+ result = this .getPath ( ) .regexpReplaceAll ( majorVersionSuffixRegex ( ) , "" )
27
27
}
28
28
29
29
/** Gets the scope of this package. */
@@ -33,6 +33,8 @@ class Package extends @package {
33
33
string toString ( ) { result = "package " + this .getPath ( ) }
34
34
}
35
35
36
+ string majorVersionSuffixRegex ( ) { result = "[./]v\\d+" }
37
+
36
38
/**
37
39
* Gets an import path that identifies a package in module `mod` with the given path,
38
40
* possibly modulo [semantic import versioning](https://github.com/golang/go/wiki/Modules#semantic-import-versioning).
Original file line number Diff line number Diff line change @@ -322,16 +322,15 @@ private predicate elementSpec(
322
322
*/
323
323
bindingset [ p]
324
324
private string interpretPackage ( string p ) {
325
- exists ( Package pkg , string thisVersion , string specifiedVersionRegex |
325
+ exists ( Package pkg , string thisVersion |
326
326
result = pkg .getPath ( ) and
327
- thisVersion = "$THISVERSION" and
328
- specifiedVersionRegex = "[./]v\\d+"
327
+ thisVersion = "$THISVERSION"
329
328
|
330
329
p = result + thisVersion
331
330
or
332
331
not p = any ( string s ) + thisVersion and
333
332
(
334
- if exists ( p .regexpFind ( specifiedVersionRegex , 0 , _) )
333
+ if exists ( p .regexpFind ( majorVersionSuffixRegex ( ) , 0 , _) )
335
334
then result = p
336
335
else p = pkg .getPathWithoutMajorVersionSuffix ( )
337
336
)
You can’t perform that action at this time.
0 commit comments