Closed
Conversation
When `p` doesn't contain `$ANYVERSION` then the result shouldn't call `package`.
Contributor
Author
|
Tests are failing because various MaD models need to be updated to use |
Contributor
Author
|
Closed in favour of #16799. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
pdoesn't contain$ANYVERSIONthen the result shouldn't callpackage. This allows us to write a model for v1 ofgithub.com/a/bwhich doesn't apply forgithub.com/a/b/v2, for example.Context:
When the go package
github.com/a/b/c/d, which is in the go module defined bygithub.com/a/b/go.mod, upgrades from v1 to v2 then its import path becomesgithub.com/a/b/v2/c/d, or equivalentlygithub.com/a/b.v2/c/d. In the go codebase we have a predicatepackage(string mod, string path)which deals with this, so thatpackage("github.com/a/b", "c/d")will match both of those import paths (and v3, v4, and so on). This is so that when a package we have modelled releases a new version, our models already work for that new version.The vast majority of the time this is what we want. When we actually want different models for different versions of a package then we have to specify the package path without using
package().One exception to the convention of using package is for standard library packages, because we didn't expect there to ever be a v2 of them. (In fact v2 of the math/rand library is coming out in the next release.)
For MaD we have to put
github.com/a/b/$ANYVERSION/c/dto achieve the same result.Looking closely at the function for interpreting the package string from MaD, I see that for
github.com/a/bit givespackage("github.com/a/b", ""), so it would also matchgithub.com/a/b/v2). In the situation that both of those exist, it wouldn't be possible to use MaD to model v1 but not v2. It seems to me like we should change the predicate to instead givegithub.com/a/bin that situation. The downside is that we ought to put$ANYVERSIONin almost every MaD package column, which is quite ugly. On the other hand, when there is a non-trivial path, we will have to put$ANYVERSIONin anyway, so it might be easier if we have it in almost all cases.