New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
commit api #3024
Comments
Yes, our Instead, please try: commit, _, err := c.Repositories.GetCommit(ctx, "Jerry-yz", "go-zero-example", "013bdd7b435e9bff6e13617fa85b47c06883890c", &github.ListOptions{})
if err != nil {
log.Fatalf("GetCommit: %v", err)
}
log.Printf("commit=%#v", commit) |
so, i think this func should not return resp |
If you take a look, all our methods return the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: