-
Notifications
You must be signed in to change notification settings - Fork 569
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
Get rid of validation/errors.go #6955
Conversation
Signed-off-by: Yuri Nikolic <[email protected]>
pkg/querier/errors_test.go
Outdated
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'm not super sure we need these tests. I see you carried them over from the validation
package, but they just assert that the hardcoded string is the same as what's in the test. I don't see a ton of value in them
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 put these tests there just for completeness, since in every package where we have errors.go
, we also have errors_test.go
. But if you prefer to get rid of them, I will do that.
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.
my preference is for removing them; i don't think they will catch any bugs
Signed-off-by: Yuri Nikolic <[email protected]>
b6c8dc5
to
6abfabf
Compare
pkg/util/limiter/errors.go
Outdated
func limitErrorFunc(format string) func(uint64) validation.LimitError { | ||
return func(limit uint64) validation.LimitError { | ||
return validation.LimitError(fmt.Sprintf(format, limit)) | ||
} | ||
} |
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.
and at this point can't limitErrorFunc
become limitError
func limitError(format string, limit uint64) validation.LimitError {
return validation.LimitError(fmt.Sprintf(format, limit))
}
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.
You are right, it can. Will fix it right now
Signed-off-by: Yuri Nikolic <[email protected]>
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.
LGTM
What this PR does
This PR gets rid of
validation/errors.go
. This source contained different functions creating an instance ofvalidation.LimitError
, but most callers of of those errors called theirError()
functions immediately after the creation. These usages have been replaced with a more appropriate methods placed in the package of the caller.Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.