Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/mod/modload: sort module versions when adding a new dependency
Otherwise, if a module already depends on [email protected] and we run cue mod get [email protected] we get a panic due to the new module version being out of order: panic: NewRequirements called with unsorted roots: [[email protected] [email protected]] The test case reproduced the panic without the fix. Due to the fact that the test panicked, we could not add it in an earlier commit to demonstrate the bug. All other callers to modrequirements.NewRequirements obtain module version lists from methods such as modfile.File.DepVersions, which are already guaranteed to be sorted. newVersions, however, is a newly constructed list taking the user's arguments and needs to be sorted before being used. Fixes #3499. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I1543879981d3fa473aae53fecbffa136178c70bf Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1205761 Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Rustam Abdullaev <[email protected]> Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1205928 Reviewed-by: Paul Jolly <[email protected]>
- Loading branch information