func (l *Loader) Load(u *ui.UI, name string) (*AnnotatedManifest, error) {
	mnf, err := l.get(name)
	if err != nil {
		err := l.sources.Sync(u, true)
		if err != nil {
			return nil, errors.Wrap(err, err.Error())
		}
		mnf, err = l.get(name)
		if err != nil {
			return nil, errors.WithStack(err)
		}
	}
	return mnf, nil
}
Load a manifest for the given package.
Syncs the sources if the manifest is not initially found.
Will return a wrapped ErrUnknownPackage if the package could not be found.

If any errors occur during the load, the first error will be returned.
package manifest
import (
	"fmt"
	"io/fs"
	"os"
	"sort"
	"strings"
	"sync"
	"time"
	"github.com/alecthomas/hcl"
	"github.com/gobwas/glob"
	"github.com/pkg/errors"
	"github.com/cashapp/hermit/sources"
	"github.com/cashapp/hermit/ui"
)
type AnnotatedManifest struct {
	FS        fs.FS
	Path      string  
	Name      string
	Errors    []error
	*Manifest  
}
func (f *AnnotatedManifest) String() string { return f.Path }
type ManifestErrors map[string][]error
func (merrors ManifestErrors) LogErrors(l ui.Logger) {
	for fullPath, errors := range merrors {
		for _, e := range errors {
			l.Warnf("invalid manifest %s: %s", fullPath, e)
		}
	}
}
type Loader struct {
	lock    sync.Mutex
	sources *sources.Sources
	files   map[string]*AnnotatedManifest
}
func NewLoader(sources *sources.Sources) *Loader {
	return &Loader{
		sources: sources,
		files:   map[string]*AnnotatedManifest{},
	}
}
func (l *Loader) get(name string) (*AnnotatedManifest, error) {
	l.lock.Lock()
	defer l.lock.Unlock()
	file, ok := l.files[name]
	if !ok {
		path := name + ".hcl"
		for _, bundle := range l.sources.Bundles() {
			file = load(bundle, name, path)
			if file == nil {
				continue
			}
			l.files[name] = file
			break
		}
	}
	if file == nil {
		return nil, errors.Wrap(ErrUnknownPackage, name)
	}
	if len(file.Errors) > 0 {
		return nil, errors.WithStack(file.Errors[0])
	}
	return file, nil
}