refactor: use pointer to sourceMeta
Alan Pearce alan@alanpearce.eu
Fri, 14 Feb 2025 15:07:09 +0100
2 files changed, 6 insertions(+), 6 deletions(-)
M internal/importer/main.go → internal/importer/main.go
@@ -47,7 +47,7 @@ } previousUpdate := sourceMeta.Updated ctx, cancel := context.WithTimeout(parent, source.Timeout.Duration) defer cancel() - files, err := fetcher.FetchIfNeeded(ctx, &sourceMeta) + files, err := fetcher.FetchIfNeeded(ctx, sourceMeta) if err != nil { var exerr *exec.ExitError
M internal/index/index_meta.go → internal/index/index_meta.go
@@ -103,18 +103,18 @@ return nil } -func (i *Meta) GetSourceMeta(source string) SourceMeta { +func (i *Meta) GetSourceMeta(source string) *SourceMeta { sourceMeta := i.data.Sources[source] if sourceMeta == nil { - return SourceMeta{} + return &SourceMeta{} } - return *sourceMeta + return sourceMeta } -func (i *Meta) SetSourceMeta(source string, meta SourceMeta) { +func (i *Meta) SetSourceMeta(source string, meta *SourceMeta) { if i.data.Sources == nil { i.data.Sources = make(map[string]*SourceMeta) } - i.data.Sources[source] = &meta + i.data.Sources[source] = meta }