all repos — searchix @ 6c0730b1be9bddc1aa59d74fa65e66acee3484fe

Search engine for NixOS, nix-darwin, home-manager and NUR users

refactor: use pointer to sourceMeta
Alan Pearce alan@alanpearce.eu
Fri, 14 Feb 2025 15:07:09 +0100
commit

6c0730b1be9bddc1aa59d74fa65e66acee3484fe

parent

ea8c3053006e67210e16ed55febbcb0c6a374b54

2 files changed, 6 insertions(+), 6 deletions(-)

jump to
M internal/importer/main.gointernal/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.gointernal/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
 }