-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: cmd/vet: check argument count of strings.NewReplacer #47994
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
Comments
If there is a vet check , it would make sense to start by only handling cases when the number of arguments is locally known.
or
|
Does this really merit a It seems like this check would be most useful when |
The main check will be on the variadic argument case. My preliminary study of some code base indicates the following common patterns:
and
where "k" and "m" usually come from function arguments. To make it work we will need to reason about "k" and the size of "m" through inter-procedural analysis, which is probably out of the scope of vet. |
This seems too specialized and with too little benefit. |
It is also not clear if the pattern described by @guodongli-google satisfies the requirement of high enough frequency. |
This proposal has been added to the active column of the proposals project |
Based on the discussion above, this proposal seems like a likely decline. |
Can't comment since the primary reason for this issue is the parameter type. |
No change in consensus, so declined. |
Docs says,
Currently vet doesn't check if NewReplacer has an odd number of arguments
Reason for having NewReplacer's parameters this way was answered here
The text was updated successfully, but these errors were encountered: