You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i meet a error when i request get commit api;
this is my code:
c := github.NewClient(&http.Client{}).WithAuthToken("xxxxxxxxxxxxxx")
_, resp, err := c.Repositories.GetCommit(context.TODO(), "Jerry-yz", "go-zero-example", "013bdd7b435e9bff6e13617fa85b47c06883890c", &github.ListOptions{})
if err != nil {
panic(err)
}
defer resp.Body.Close()
commit := new(github.RepositoryCommit)
b, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
if err := json.Unmarshal(b, commit); err != nil {
panic(err)
}
panic: file already closed
so, i find this err in client.Do
this func read this resp.body and defer resp.close(), so i meet error when read resp.body from GetCommit() func
The text was updated successfully, but these errors were encountered:
i meet a error when i request get commit api;
this is my code:
c := github.NewClient(&http.Client{}).WithAuthToken("xxxxxxxxxxxxxx")
_, resp, err := c.Repositories.GetCommit(context.TODO(), "Jerry-yz", "go-zero-example", "013bdd7b435e9bff6e13617fa85b47c06883890c", &github.ListOptions{})
if err != nil {
panic(err)
}
defer resp.Body.Close()
commit := new(github.RepositoryCommit)
b, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
if err := json.Unmarshal(b, commit); err != nil {
panic(err)
}
panic: file already closed
so, i find this err in client.Do
this func read this resp.body and defer resp.close(), so i meet error when read resp.body from GetCommit() func
The text was updated successfully, but these errors were encountered: