Removed: - New(), NewFromPaths(), NewFromFS() - unused constructors - Scan(), addFile(), addInputPath(), addInputFS() - unused scanning code - WriteToFile(), Write() - unused output methods (Builder.Build() is used) - GetFileCount(), GetTotalFileSize() - unused accessors - pathIsHidden() - duplicated in internal/scanner - ManifestScanOptions - unused options struct - HasError(), AddError(), WithContext() - unused error/context handling - NewFromProto() - deprecated alias - manifestFile struct - unused internal type Kept: - manifest struct (simplified to just pbInner, pbOuter, output) - NewManifestFromReader(), NewManifestFromFile() - for loading manifests - Files() - returns files from loaded manifest - Builder and its methods - for creating manifests
32 lines
642 B
Go
32 lines
642 B
Go
package mfer
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
)
|
|
|
|
// manifest holds the internal representation of a manifest file.
|
|
// Use NewManifestFromFile or NewManifestFromReader to load an existing manifest,
|
|
// or use Builder to create a new one.
|
|
type manifest struct {
|
|
pbInner *MFFile
|
|
pbOuter *MFFileOuter
|
|
output *bytes.Buffer
|
|
}
|
|
|
|
func (m *manifest) String() string {
|
|
count := 0
|
|
if m.pbInner != nil {
|
|
count = len(m.pbInner.Files)
|
|
}
|
|
return fmt.Sprintf("<Manifest count=%d>", count)
|
|
}
|
|
|
|
// Files returns all file entries from a loaded manifest.
|
|
func (m *manifest) Files() []*MFFilePath {
|
|
if m.pbInner == nil {
|
|
return nil
|
|
}
|
|
return m.pbInner.Files
|
|
}
|