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 {
2323 * removed.
2424 */
2525 string getPathWithoutMajorVersionSuffix ( ) {
26- result = this .getPath ( ) .regexpReplaceAll ( "[./]v\\d+" , "" )
26+ result = this .getPath ( ) .regexpReplaceAll ( majorVersionSuffixRegex ( ) , "" )
2727 }
2828
2929 /** Gets the scope of this package. */
@@ -33,6 +33,8 @@ class Package extends @package {
3333 string toString ( ) { result = "package " + this .getPath ( ) }
3434}
3535
36+ string majorVersionSuffixRegex ( ) { result = "[./]v\\d+" }
37+
3638/**
3739 * Gets an import path that identifies a package in module `mod` with the given path,
3840 * 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(
322322 */
323323bindingset [ p]
324324private string interpretPackage ( string p ) {
325- exists ( Package pkg , string thisVersion , string specifiedVersionRegex |
325+ exists ( Package pkg , string thisVersion |
326326 result = pkg .getPath ( ) and
327- thisVersion = "$THISVERSION" and
328- specifiedVersionRegex = "[./]v\\d+"
327+ thisVersion = "$THISVERSION"
329328 |
330329 p = result + thisVersion
331330 or
332331 not p = any ( string s ) + thisVersion and
333332 (
334- if exists ( p .regexpFind ( specifiedVersionRegex , 0 , _) )
333+ if exists ( p .regexpFind ( majorVersionSuffixRegex ( ) , 0 , _) )
335334 then result = p
336335 else p = pkg .getPathWithoutMajorVersionSuffix ( )
337336 )
You can’t perform that action at this time.
0 commit comments