diff options
| author | Jeff Carr <[email protected]> | 2025-10-21 16:25:45 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-21 16:25:45 -0500 |
| commit | 66d0426ccc05f7b88c102739f1f7f37984d927ac (patch) | |
| tree | 7dfbf663beaa916e22c0cf853d145e999da68b8f /Load.go | |
| parent | d54c59107289968116211111ff52850768fcec24 (diff) | |
load PatchesPB
Diffstat (limited to 'Load.go')
| -rw-r--r-- | Load.go | 29 |
1 files changed, 15 insertions, 14 deletions
@@ -11,6 +11,7 @@ package forgepb import ( "errors" + "os" "go.wit.com/lib/ENV" "go.wit.com/lib/config" @@ -60,24 +61,24 @@ func (f *Forge) reposCacheLoad() error { return err } -/* -func (f *Forge) loadPatchsets() error { - f.Patchsets = NewSets() - - data, err := os.ReadFile(config.Get("PatchPB")) - if err != nil { - return err +func (f *Forge) patchesCacheLoad() error { + if f.Patches != nil { + return errors.New("already loaded") + } + f.Patches = NewPatches() + err := config.LoadAppnameCache(f.Patches, "forge") + if errors.Is(err, os.ErrNotExist) { + // is a new file + f.Patches.Save() + return os.ErrNotExist } - - err = f.Patchsets.Unmarshal(data) if err != nil { - log.Infof("LoadPatchsets() proto.Marshal() error %v\n", err) - return err + log.Printf("patchesCacheLoad() failed err (%v) filename (%s)\n", err, f.Patches.Filename) + panic("failed to load patches") } - // log.Infof("LoadPatchsets() found %d patches.\n", f.Patchsets.Len()) - return nil + ENV.SetGlobal("lib/forgepb", "PatchesPB", f.Patches.Filename) + return err } -*/ func makeDefaultConfig() (*ForgeConfigs, error) { cfg := NewForgeConfigs() |
