Closed meling closed 9 years ago
The problem I was trying to overcome was that when using the * symbol to dereference the content within the pointer, it would give a nil pointer exception when it was nil. Any other way to get the content and at the same time avoid the nil pointer exception?
In
ListTeams
andListRepos
(and possibly other places) the following code template has lots of unneeded nil checks:If the
*t.<struct_var_name>
is nil, so will the correspondingteam.<var_name>
be. Suggest to construct theTeam{}
object passing in the relevant fields from the*t
object, e.g. something like:Or if you foresee that the
Team
(andRepo
) structs will be expanded, you may wish to name the destionation fields.If you agree with this suggestion, I can fix it. It would be helpful to have some unit tests to ensure that we don't mess things up.