-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat: add suggestions #74
Conversation
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.
Few comments
2d3fe77
to
9ea75af
Compare
Hmmm tests are making CI fail with Open to suggestions on how to make it more stable :) |
main.go
Outdated
type suggestionNotFoundErr struct { | ||
suggestions []string | ||
} | ||
|
||
func (e suggestionNotFoundErr) Error() string { |
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.
the name makes me think this error happens when no suggestions are found, but seems like its not it... maybe another name?
💅: I think prefixing the error with err
is more common than suffixing with it
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.
Hmmm very good point. I had it as dbNotFoundErr
before which I think makes more sense. Also will change e
-> err
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.
Oh wait or did you mean that it's more common to see errDbNotFound
vs dbNotFoundErr
?
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.
I think so, yes, at least in the stdlibrary... eg. os.ErrNotExists
and many others... although all of those are public, haven't checked the private ones 🤔
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.
Just did a quick check - the private ones also prefix with err
instead of having it as a suffix. Thanks for the tip! It's a great call to use stdlib for conventions in your own code 💭
Yeah, so my tests are making the Ubuntu build fail... Going to need to change the path to a temp dir with an env variable ( |
9d2e61c
to
39cd552
Compare
noice! |
Not sure if I should also add a check for reflect.DeepEqual on the suggestions we get back 🤔. Not sure that ordering is consistent... Will check if it changes anything locally, so don't merge yet pls 😄 |
oookay I improved the tests and added a formatting func for the databases which I needed for the tests and hopefully makes formatting dbs more reusable. It adds an extra loop for our |
Co-authored-by: Carlos Alexandro Becker <[email protected]>
713a71f
to
3917ef5
Compare
Will update the |
builds off of the
delete-db
PR. Suggests a db name that does exist based on the first two characters of a mistyped arg. Just kept it simple, but would be great to hear if there are better ways to do this. I also experimented with having a more reusable function for getting the[]os.DirEntry
for a default client.Would also love some guidance on how I could write tests for this 💭