Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: single ']' character output when no data matches the query #9

Merged
merged 2 commits into from
May 27, 2024

Conversation

bzarboni1
Copy link
Contributor

ISSUE

[#8] - [Bug] single ']' character output when no data matches the query

When no repositories or organizations are found using one of the list commands, a single ] character is output. This break JSON parsing libraries that use this output.


@bzarboni1 bzarboni1 self-assigned this May 27, 2024
TylerMizuyabu
TylerMizuyabu previously approved these changes May 27, 2024
Comment on lines 45 to 49
if orgOut != "" {
orgOut = fmt.Sprintf("%s]", orgOut)
} else {
orgOut = "[]"
}
Copy link
Contributor

@TylerMizuyabu TylerMizuyabu May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider modifying the code to make use of the strings.Join function instead. Something like

orgOut := fmt.Sprintf("[%s]", strings.Join(orgs, ", "))

should be able to replace lines 36 to 49

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same thing can probably be applied to the repos file.

@bzarboni1 bzarboni1 merged commit 15bff8d into main May 27, 2024
1 check passed
@bzarboni1 bzarboni1 deleted the 8-bug-output-when-no-data-matches-the-query branch May 27, 2024 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants