func (b *DirManifestBuilder) Build(dirModTime time.Time, incompleteReason string) *snapshot.DirManifest {
	b.mu.Lock()
	defer b.mu.Unlock()

	s := b.summary
	s.TotalDirCount++

	entries := b.entries

	if len(entries) == 0 {
		s.MaxModTime = dirModTime
	}

	s.IncompleteReason = incompleteReason

	b.summary.FailedEntries = sortedTopFailures(b.summary.FailedEntries)

	// sort the result, directories first, then non-directories, ordered by name
	sort.Slice(b.entries, func(i, j int) bool {
		if leftDir, rightDir := isDir(entries[i]), isDir(entries[j]); leftDir != rightDir {
			// directories get sorted before non-directories
			return leftDir
		}

		return entries[i].Name < entries[j].Name
	})

	return &snapshot.DirManifest{
		StreamType: directoryStreamType,
		Summary:    &s,
		Entries:    entries,
	}
}
// Build builds the directory manifest.
Build builds the directory manifest.
// Build builds the directory manifest .
func (b *DirManifestBuilder) Build(dirModTime time.Time, incompleteReason string) *snapshot.DirManifest {
	b.mu.Lock()
	defer b.mu.Unlock()
	s := b.summary
	s.TotalDirCount++
	entries := b.entries
	if len(entries) == 0 {
		s.MaxModTime = dirModTime
	}
	s.IncompleteReason = incompleteReason
	b.summary.FailedEntries = sortedTopFailures(b.summary.FailedEntries)
	sort.Slice(b.entries, func(i, j int) bool {
		if leftDir, rightDir := isDir(entries[i]), isDir(entries[j]); leftDir != rightDir {
			return leftDir
		}
		return entries[i].Name < entries[j].Name
	})
	return &snapshot.DirManifest{
		StreamType: directoryStreamType,
		Summary:    &s,
		Entries:    entries,
	}
}
func ( b * DirManifestBuilder ) Build ( dirModTime time . Time , incompleteReason string ) * snapshot . DirManifest { b . mu . Lock ( ) defer b . mu . Unlock ( ) s := b . summary s . TotalDirCount ++ entries := b . entries if len ( entries ) == 0 { s . MaxModTime = dirModTime } s . IncompleteReason = incompleteReason b . summary . FailedEntries = sortedTopFailures ( b . summary . FailedEntries ) sort . Slice ( b . entries , func ( i , j int ) bool { if leftDir , rightDir := isDir ( entries [ i ] ) , isDir ( entries [ j ] ) ; leftDir != rightDir { return leftDir } return entries [ i ] . Name < entries [ j ] . Name } ) return & snapshot . DirManifest { StreamType : directoryStreamType , Summary : & s , Entries : entries , } }
Build builds the directory manifest.
Build builds the directory manifest .
// sort the result, directories first, then non-directories, ordered by name // directories get sorted before non-directories