INNER CODE UNIT · Go
suffix
cc1a2b/JShunter · internal/jshunter/chunkgraph.go:412
suffix = cap.literals[len(cap.literals)-1]
}
out := make([]ChunkRef, 0, len(hashes))
for id, hash := range hashes {
name := id
if names != nil {
if n, ok := names[id]; ok && n != "" {
name = n
}
}
path := prefix + name + mid + hash + suffix
out = append(out, ChunkRef{ID: id, Name: name, Path: path, Source: source})
}
// Map iteration is unordered; sort so the result is reproducible.
sort.Slice(out, func(i, j int) bool { return out[i].Path < out[j].Path })
return out
}