MCPcopy Create free account
hub / github.com/HashLoad/boss / SaveRepoData

Function SaveRepoData

models/cacheInfo.go:20–49  ·  view source on GitHub ↗
(key string, versions []string)

Source from the content-addressed store, hash-verified

18}
19
20func SaveRepoData(key string, versions []string) {
21 location := env.GetCacheDir()
22 data := &RepoInfo{}
23 data.Key = key
24 data.LastUpdate = time.Now()
25 data.Versions = versions
26 d, err := json.Marshal(data)
27 if err != nil {
28 msg.Err(err.Error())
29 }
30
31 pp := filepath.Join(location, "info")
32 err = os.MkdirAll(pp, 0755)
33 if err != nil {
34 msg.Err(err.Error())
35 }
36
37 p := filepath.Join(pp, key+".json")
38 f, err := os.Create(p)
39 if err != nil {
40 msg.Err(err.Error())
41 return
42 }
43 defer f.Close()
44
45 _, err = f.Write(d)
46 if err != nil {
47 msg.Err(err.Error())
48 }
49}
50
51// RepoData retrieves cached information about a repo.
52func RepoData(key string) (*RepoInfo, error) {

Callers 1

GetDependencyFunction · 0.92

Calls 3

GetCacheDirFunction · 0.92
ErrFunction · 0.92
WriteMethod · 0.80

Tested by

no test coverage detected