fix: create index metadata when index exists and meta doesn't
Alan Pearce alan@alanpearce.eu
Sat, 08 Jun 2024 21:18:39 +0200
1 files changed, 8 insertions(+), 0 deletions(-)
jump to
M internal/index/index_meta.go → internal/index/index_meta.go
@@ -46,6 +46,14 @@ }, nil } func openMeta(path string) (*Meta, error) { + exists, err := file.Exists(path) + if err != nil { + return nil, errors.WithMessage(err, "could not check for existence of index metadata") + } + if !exists { + return createMeta(path) + } + j, err := os.ReadFile(path) if err != nil { return nil, errors.WithMessage(err, "could not open index metadata file")