MCPcopy
hub / github.com/six2dez/OneListForAll / writeLock

Function writeLock

internal/update/update.go:185–202  ·  view source on GitHub ↗
(results []SourceResult, cfg config.Config)

Source from the content-addressed store, hash-verified

183}
184
185func writeLock(results []SourceResult, cfg config.Config) error {
186 f, err := os.Create("sources_lock.yml")
187 if err != nil {
188 return fmt.Errorf("create lock file: %w", err)
189 }
190 defer f.Close()
191
192 _, _ = fmt.Fprintf(f, "lock_date: %q\n", time.Now().UTC().Format(time.RFC3339))
193 _, _ = fmt.Fprintln(f, "sources:")
194 for _, r := range results {
195 _, _ = fmt.Fprintf(f, " %s:\n", r.Name)
196 _, _ = fmt.Fprintf(f, " repo: %q\n", sourceRepo(cfg, r.Name))
197 _, _ = fmt.Fprintf(f, " commit: %q\n", r.Commit)
198 _, _ = fmt.Fprintf(f, " downloaded_files: %d\n", r.DownloadedFiles)
199 _, _ = fmt.Fprintf(f, " last_updated: %q\n", time.Now().UTC().Format(time.RFC3339))
200 }
201 return nil
202}
203
204func sourceRepo(cfg config.Config, name string) string {
205 for _, s := range cfg.Sources {

Callers 1

RunFunction · 0.85

Calls 2

sourceRepoFunction · 0.85
CloseMethod · 0.80

Tested by

no test coverage detected