MCPcopy
hub / github.com/docker/compose / dedupeEntries

Function dedupeEntries

internal/sync/tar.go:342–354  ·  view source on GitHub ↗

Dedupe the entries with last-entry-wins semantics.

(entries []archiveEntry)

Source from the content-addressed store, hash-verified

340
341// Dedupe the entries with last-entry-wins semantics.
342func dedupeEntries(entries []archiveEntry) []archiveEntry {
343 seenIndex := make(map[string]int, len(entries))
344 result := make([]archiveEntry, 0, len(entries))
345 for i, entry := range entries {
346 seenIndex[entry.header.Name] = i
347 }
348 for i, entry := range entries {
349 if seenIndex[entry.header.Name] == i {
350 result = append(result, entry)
351 }
352 }
353 return result
354}

Callers 1

ArchivePathsIfExistMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected