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

Make Status implement fmt.Stringer #58

Merged
merged 2 commits into from
Oct 3, 2023

Conversation

VoyTechnology
Copy link
Contributor

@VoyTechnology VoyTechnology commented Sep 6, 2023

Debugging is easier if Status implements fmt.Stringer.

@CLAassistant
Copy link

CLAassistant commented Sep 6, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@akshayjshah akshayjshah left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @VoyTechnology! This is generally a good idea.

Before we merge this, can you change the code to follow the casing convention we're using for connect.Code? The code is here. Please also handle unknown values the way they are in connect.Code, and add a simple unit test.

@VoyTechnology VoyTechnology force-pushed the status-string branch 2 times, most recently from 92d71f8 to 7b7ea26 Compare September 19, 2023 20:36
@VoyTechnology
Copy link
Contributor Author

Hi @akshayjshah, I have updated the PR with your requested changes. Since there are fewer statuses than codes, I manually create a list of valid status codes to check against.

Viewing the status code as a string is a bit awkward if we use int. The change adds the String function so that it's more human readable.
@akshayjshah akshayjshah changed the title String function for Status Make Status implement fmt.Stringer Oct 2, 2023
Copy link
Member

@akshayjshah akshayjshah left a comment

Choose a reason for hiding this comment

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

Looks good to me! I added a bit of logic to the tests to use testing/quick to test more status constants, but the rest of the change is nice. Thank you for the contribution, @VoyTechnology!

@akshayjshah akshayjshah merged commit 3e1b33f into connectrpc:main Oct 3, 2023
@VoyTechnology VoyTechnology deleted the status-string branch October 4, 2023 01:49
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.

3 participants