-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Inconsistent nature of messageFromMsgAndArgs
#1679
Comments
Some real examples of using non-string arg: Antonboom/testifylint#169 (comment) And this explores the another solution – to implement package fmt
func Print(a ...any) (n int, err error)
func Printf(format string, a ...any) (n int, err error) Thus, support both options (formatted print and not formatted print of N args). But I am not happy with it :( |
My word! I didn't know that was supported. I'd prefer to entirely remove the msgAndArgs argument from the "non-f" assertions. But that and removing this is a breaking change, no? |
Technically no (because no signature changes), but logically yes (panicking of existing code) 🤔 But I need to know "party vector", if 💯 you are moving to "entirely remove the msgAndArgs argument from the "non-f" assertions", then I can enable warning on this single-not-string arg case in Currently I propose use f-assertions only if format string is used, but this special case is ignored, that leads to checker inconsistency 😞 |
I would go with always direct people to the f functions. The variadic just shouldn't be used, even for this sprint like behavior. |
Got it. Thanks 🫡 |
Description
Hello, team!
I was surprised, but
testify
allows to set non-string inmsgAndArgs...
if this is the single argument:testify/assert/assertions.go
Lines 290 to 296 in 89cbdd9
So I can do
But cannot
Proposed solution
Remove support of non-string single arg (as rare and strange? case) and allows only
msg string
+args ...any
.Use case
f-assertions future (#1089 (comment)).
The text was updated successfully, but these errors were encountered: