From 81b6c0b3d2165fbc8558056b310bf71647ea0cda Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Mon, 2 Oct 2023 20:44:00 +0300 Subject: [PATCH] fixup deps Signed-off-by: Vasiliy Tolstov --- cmd/pkgdashcli/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/pkgdashcli/main.go b/cmd/pkgdashcli/main.go index 1b941ce..6458741 100644 --- a/cmd/pkgdashcli/main.go +++ b/cmd/pkgdashcli/main.go @@ -239,16 +239,16 @@ func giteaPullRequest(ctx context.Context, cfg *Config, mods map[string]modules. req.Header.Add("Accept", "application/json") req.Header.Add("Content-Type", "application/json") - logger.Infof(ctx, "try to get pulls GET "+envAPIURL+"/repos/"+envREPOSITORY+"/pulls?state=open&token=XXXXXX") rsp, err := http.DefaultClient.Do(req) if err != nil { return err } + + buf, _ = io.ReadAll(rsp.Body) if rsp.StatusCode != http.StatusOK { - buf, _ = io.ReadAll(rsp.Body) return fmt.Errorf("unknown error: %s", buf) } - fmt.Printf("%#+v\n", rsp) + if err = json.Unmarshal(buf, &pulls); err != nil { logger.Fatalf(ctx, "failed to decode response %s err: %v", buf, err) }