Go-github: BUG > IDPGroupList.Groups should not be omitempty

Created on 14 Jan 2020  路  2Comments  路  Source: google/go-github

Description

Current Behavior

Expected Behavior

  • IDPGroupList.Groups is not set to omitempty

Additional Details

Code

    groups := make([]*github.IDPGroup, 0)
    opt := github.IDPGroupList{Groups: groups}
    _, _, err := client.Teams.CreateOrUpdateIDPGroupConnections(ctx, teamId, opt)

Request

2020-01-14T14:40:08.054-0500 [DEBUG] plugin.terraform-provider-github: 2020/01/14 14:40:08 [DEBUG] Github API Request Details:
2020-01-14T14:40:08.054-0500 [DEBUG] plugin.terraform-provider-github: ---[ REQUEST ]---------------------------------------
2020-01-14T14:40:08.054-0500 [DEBUG] plugin.terraform-provider-github: PATCH /teams/#######/team-sync/group-mappings HTTP/1.1
2020-01-14T14:40:08.055-0500 [DEBUG] plugin.terraform-provider-github: Host: api.github.com
2020-01-14T14:40:08.055-0500 [DEBUG] plugin.terraform-provider-github: User-Agent: go-github
2020-01-14T14:40:08.055-0500 [DEBUG] plugin.terraform-provider-github: Content-Length: 3
2020-01-14T14:40:08.055-0500 [DEBUG] plugin.terraform-provider-github: Accept: application/vnd.github.team-sync-preview+json
2020-01-14T14:40:08.055-0500 [DEBUG] plugin.terraform-provider-github: Content-Type: application/json
2020-01-14T14:40:08.055-0500 [DEBUG] plugin.terraform-provider-github: Accept-Encoding: gzip
2020-01-14T14:40:08.055-0500 [DEBUG] plugin.terraform-provider-github:
2020-01-14T14:40:08.055-0500 [DEBUG] plugin.terraform-provider-github: {}

Most helpful comment

@gmlewis I can give it a shot tomorrow

All 2 comments

Reading through the docs and the code, I don't see any downside to removing the ,omitempty on the Groups field.

Noting that the IDPGroupList struct is used both as a method parameter and is also returned from methods, it seems to me that since Groups is a slice, it should have no effect on existing code.

Thank you for reporting this, @kuwas. Would you like to put together a PR to remove that field tag modifier and update the unit tests if necessary to demonstrate the new behavior?

@gmlewis I can give it a shot tomorrow

Was this page helpful?
0 / 5 - 0 ratings

Related issues

csandanov picture csandanov  路  3Comments

you06 picture you06  路  3Comments

OGKevin picture OGKevin  路  3Comments

gmlewis picture gmlewis  路  3Comments

gmlewis picture gmlewis  路  3Comments