github.com/onflow/flow-go@v0.33.17/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 // in place sort to order the assignment in canonical order 12 for _, identities := range identifierLists { 13 assignment := flow.IdentifierList(identities).Sort(flow.IdentifierCanonical) 14 assignments = append(assignments, assignment) 15 } 16 return assignments 17 }