-
Notifications
You must be signed in to change notification settings - Fork 275
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
refactor: make NewClient return an error #674
Conversation
@magiconair I worked on a TODO you defined in source. |
9bd25ad
to
1d031e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I've missed that part with the move to v0.5. Please do not check the error for the c.Close()
method everywhere since we cannot do anything with that error anyway. There is no way to recover. We just have this in the signature to be consistent.
As for testify
. I went down that route before and decided against this since it would introduce the third testing framework into the code base. Yes, it is more convenient but it doesn't justify the cost of having different code styles in different parts of the code base. So please refactor this to look like the rest (i.e. got
,want
style and maybe use verify.Values
)
1d031e4
to
64892ee
Compare
Oh and before I forget, take a closer look (@magiconair) what I did with |
I'll have a look. As a guiding principle I prefer consistency when we make changes like this. I'm OK with changing direction but then let's do it all over the place. And in a separate PR. |
fbb016c
to
88cd5e9
Compare
Clarifying question on that: I assumed that comment was related to wrapping with %w. Should I switch from errrors join to early exit too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final nitpick about a variable name but then this LGTM.
88cd5e9
to
0487a3a
Compare
As an aside: I've done the force-push update as well earlier in my career and while that keeps the commit cleaner it makes reviewing harder since I don't see what you have changed and always have to review the full change set. I've come to settle on individual commits and leave it to the maintainer to squash the commits if they want. |
0487a3a
to
bdbded7
Compare
Usually I don't force push either but I read somewhere that it was requested to squash commits before merge so I started doing that from the start. But yes I agree: that makes following changes hard |
On this project? I'll have a look or can you point me to it... |
You'll learn something new every day :) |
This PR addresses the TODO
Note: Starting with v0.5 this function will return an error.
and let NewClient return an error.Note on the PR: I use
github.com/stretchr/testify
for error assertion with seems IMHO pretty standard in the go projects I worked with. If this is unwanted I could rework this.resolves #621