GitHub Classroom CLI Extension is a powerful and easy-to-use command line tool that enhances the functionality of the GitHub CLI, specifically tailored for educators using GitHub Classroom.
While trying to debug https://github.com/github/gh-classroom/issues/69 I was running into a panic in the NewAssignmentList function. This panic was caused by an empty assignments slice being passed to the function. To prevent this panic, I added a check to return an empty AssignmentList when the assignments slice is empty. I also added a similar check to the NewAcceptedAssignmentList function to prevent a panic when an empty assignments.
What approach did you choose and why?
Since it's expected to be able to return an empty list of AcceptedAssignments or regular Assignments, this is the expected behaviour.
What are you trying to accomplish?
While trying to debug https://github.com/github/gh-classroom/issues/69 I was running into a panic in the
NewAssignmentList
function. This panic was caused by an emptyassignments
slice being passed to the function. To prevent this panic, I added a check to return an emptyAssignmentList
when theassignments
slice is empty. I also added a similar check to theNewAcceptedAssignmentList
function to prevent a panic when an emptyassignments
.What approach did you choose and why?
Since it's expected to be able to return an empty list of AcceptedAssignments or regular Assignments, this is the expected behaviour.