()
| 146 | } |
| 147 | |
| 148 | func 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. |
no test coverage detected