mod: added support for version constraint when fetching a remote version

Signed-off-by: Sam Alba <samalba@users.noreply.github.com>
This commit is contained in:
Sam Alba
2021-10-21 17:50:18 -07:00
parent 428aca1c03
commit cee8c91e50
7 changed files with 74 additions and 49 deletions

View File

@@ -98,7 +98,8 @@ func read(fMod, fSum io.Reader) (*file, error) {
return nil, fmt.Errorf("repos in mod and sum line don't match: %s and %s", modSplit[0], sumSplit[0])
}
require, err := newRequire(modSplit[0])
// FIXME: if we want to add support for version constraints in the mod file, it would be here
require, err := newRequire(modSplit[0], "")
if err != nil {
return nil, err
}
@@ -204,7 +205,7 @@ func (f *file) updateToLatest(req *Require) (*Require, error) {
}
// checkout the latest tag
latestTag, err := gitRepo.latestTag()
latestTag, err := gitRepo.latestTag(req.versionConstraint)
if err != nil {
return nil, err
}