MCPcopy Create free account
hub / github.com/SamNet-dev/snix / resolveLatestAPI

Function resolveLatestAPI

cmd/snix/update.go:148–161  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146}
147
148func resolveLatestAPI() (string, error) {
149 resp, err := http.Get("https://api.github.com/repos/SamNet-dev/snix/releases/latest")
150 if err != nil {
151 return "", err
152 }
153 defer resp.Body.Close()
154 var body struct {
155 TagName string `json:"tag_name"`
156 }
157 if err := json.NewDecoder(resp.Body).Decode(&body); err != nil {
158 return "", err
159 }
160 return strings.TrimPrefix(body.TagName, "v"), nil
161}
162
163// downloadWithProgress fetches url into path, streaming to disk to avoid
164// loading the full archive in memory.

Callers 1

resolveLatestFunction · 0.85

Calls 2

GetMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected