You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 9, 2020. It is now read-only.
Interpret strings as branches > semver constraints
When a user supplied string in an imported config file, or specified to
dep ensure, can be interpreted multiple ways, prefer the branch over a
semver constraint.
In #710, glide.yaml specified v2 for https://github.com/go-mgo/mgo.
When we assume that is a semver constraint, solve fails because the
hinted revision in the lock (a commit on the v2 branch) doesn't satisfy
the assumed constraint of ^2.0.0.
The new preferred match order for the user string is:
* revision
* branch
* semver constraint
* tag
I am giving preference of a semver constraint over a tag so that a bare
version, 1.0.0, is interpreted more loosely with an implied caret,
^1.0.0, instead of the stricter exact match.
// Warn about the problem, it is not enough to warrant failing
226
-
warn:=errors.Wrapf(err, "Unable to lookup the version represented by %s in %s(%s). Falling back to locking the revision only.", revision, pi.ProjectRoot, pi.Source)
funclookupVersionForRevision(rev gps.Revision, pi gps.ProjectIdentifier, sm gps.SourceManager) (gps.Version, error) {
149
+
funclookupVersionForLockedProject(pi gps.ProjectIdentifier, c gps.Constraint, rev gps.Revision, sm gps.SourceManager) (versiongps.Version,warningerror) {
150
150
// Find the version that goes with this revision, if any
151
151
versions, err:=sm.ListVersions(pi)
152
152
iferr!=nil {
153
-
returnnil, errors.Wrapf(err, "Unable to list versions for %s(%s)", pi.ProjectRoot, pi.Source)
153
+
warning=errors.Wrapf(err, "Unable to lookup the version represented by %s in %s(%s). Falling back to locking the revision only.", rev, pi.ProjectRoot, pi.Source)
154
+
return
154
155
}
155
156
156
157
gps.SortPairedForUpgrade(versions) // Sort versions in asc order
157
158
for_, v:=rangeversions {
158
159
ifv.Underlying() ==rev {
159
-
returnv, nil
160
+
version=v
161
+
return
160
162
}
161
163
}
162
164
163
-
returnrev, nil
165
+
// Use the version from the manifest as long as it wasn't a range
0 commit comments