go-github: IssuesService.Edit cannot clear an issue's milestone

Much like #181 I fail to see how to use go-github to clear an issue’s milestone. The API requires the milestone be to set to null in the request so that it is cleared, but that is not possible since the field uses omitempty.

Not sure what the right solution would be, perhaps a standalone method for clearing milestones?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 2
  • Comments: 15 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @gmlewis, i would like to this work on this issue. Thanks

Indeed, we can workaround it like that (tested) :

       u := fmt.Sprintf("repos/%v/%v/issues/%d", owner, repo, issue)
       req, err := githubCli.NewRequest("PATCH", u, &struct {
               Milestone interface{} `json:"milestone"`
       }{})
       if err != nil {
               return err
       }
       _, err = githubCli.Do(req, nil)
       if err != nil {
               return err
       }

Hi @AGMETEOR, you can take this up. apologies for not being able to respond

Hi @gmlewis , I would like to pick this one up in case @sagar23sj is ok with that 😃

I think that’s the case because the GitHub API is very large, and removing a milestone from an issue is something only a few people ever need. It has a well described workaround here, so those who need it use that and move on.

To resolve the issue, we need to come up with a good API/good way of doing so.