MCPcopy Create free account
hub / github.com/github/gh-aw / downloadReleaseProbeFile

Function downloadReleaseProbeFile

pkg/cli/compile_update_check.go:242–263  ·  view source on GitHub ↗
(ctx context.Context, client *http.Client, tag string)

Source from the content-addressed store, hash-verified

240}
241
242func downloadReleaseProbeFile(ctx context.Context, client *http.Client, tag string) (bool, error) {
243 req, err := http.NewRequestWithContext(ctx, http.MethodHead, compileUpdateCheckProbeURLFunc(tag), nil)
244 if err != nil {
245 return false, fmt.Errorf("failed to create probe request for %s: %w", tag, err)
246 }
247 req.Header.Set("User-Agent", "gh-aw/"+GetVersion())
248
249 resp, err := client.Do(req)
250 if err != nil {
251 return false, fmt.Errorf("failed to download probe file for %s: %w", tag, err)
252 }
253 defer resp.Body.Close()
254
255 switch resp.StatusCode {
256 case http.StatusOK:
257 return true, nil
258 case http.StatusNotFound:
259 return false, nil
260 default:
261 return false, fmt.Errorf("probe download for %s returned status %d", tag, resp.StatusCode)
262 }
263}
264
265func getCompileUpdateCheckFilePath() string {
266 return getCompileUpdateCheckFilePathFunc()

Callers 1

runCompileUpdateCheckFunction · 0.85

Calls 4

GetVersionFunction · 0.70
CloseMethod · 0.65
ErrorfMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected