github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/model/flow/assignment/sort.go (about) 1 package assignment 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 ) 6 7 // FromIdentifierLists creates a `flow.AssignmentList` with canonical ordering from 8 // the given `identifierLists`. 9 func FromIdentifierLists(identifierLists []flow.IdentifierList) flow.AssignmentList { 10 assignments := make(flow.AssignmentList, 0, len(identifierLists)) 11 for _, identities := range identifierLists { 12 assignment := identities.Sort(flow.IdentifierCanonical) // sort each cluster in canonical order (already creates copy) 13 assignments = append(assignments, assignment) 14 } 15 return assignments 16 }