Skip to content

Commit 53133ff

Browse files
Address case where person has no Github handle
Make sure that when searching for a person using the empty string as the key, no result is returned.
1 parent c78d0fa commit 53133ff

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/team/team.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ func Load(peopleYAML, teamYAML io.Reader) ([]Person, error) {
7777
// PersonByJiraName returns the first person in the slice with the given Jira
7878
// name. The returned boolean is false if not found.
7979
func PersonByJiraName(people []Person, jiraName string) (Person, bool) {
80+
if jiraName == "" {
81+
return Person{}, false
82+
}
8083
for i := range people {
8184
if people[i].Jira == jiraName {
8285
return people[i], true
@@ -88,6 +91,9 @@ func PersonByJiraName(people []Person, jiraName string) (Person, bool) {
8891
// PersonByGithubHandle returns the first person in the slice with the given
8992
// Github handle. The returned boolean is false if not found.
9093
func PersonByGithubHandle(people []Person, githubHandle string) (Person, bool) {
94+
if githubHandle == "" {
95+
return Person{}, false
96+
}
9197
for i := range people {
9298
if people[i].Github == githubHandle {
9399
return people[i], true

0 commit comments

Comments
 (0)