MCPcopy Create free account
hub / github.com/PolyhedraZK/ExpanderCompilerCollection / updateLib

Function updateLib

ecgo/rust/wrapper/wrapper.go:120–155  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

118}
119
120func updateLib(path string) {
121 stat, err := os.Stat(path)
122 fileExists := !os.IsNotExist(err)
123 if err != nil && fileExists {
124 panic(err)
125 }
126 data, err := getUrl("https://api.github.com/repos/PolyhedraZK/ExpanderCompilerCollection/branches/rust-built-libs")
127 if err != nil {
128 if fileExists {
129 return
130 }
131 panic(err)
132 }
133 var repoInfo repoInfo
134 err = json.Unmarshal(data, &repoInfo)
135 if err != nil {
136 if fileExists {
137 return
138 }
139 panic(err)
140 }
141 remoteTime, err := time.Parse(time.RFC3339, repoInfo.Commit.Commit.Committer.Date)
142 if err != nil {
143 if fileExists {
144 return
145 }
146 panic(err)
147 }
148 if fileExists {
149 localTime := stat.ModTime()
150 if localTime.After(remoteTime) {
151 return
152 }
153 }
154 downloadLib(path)
155}
156
157func initCompilePtr() {
158 compilePtrLock.Lock()

Callers 1

initCompilePtrFunction · 0.85

Calls 2

getUrlFunction · 0.85
downloadLibFunction · 0.85

Tested by

no test coverage detected