-
Notifications
You must be signed in to change notification settings - Fork 17.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
x/tools/go/analysis/passes/slog: misleading vet message for variadic params in Info functions #65154
Comments
CC @jba Including @timothy-king as it seems some vet has already been worked upon #59407. May be more verbose have (int) want (string,int) |
I believe this is working as intended. |
Let's be a bit more concrete https://go.dev/play/p/NCfv0h9tCIv?v=gotip :
This example prints:
The vet diagnostics themselves seem to be correctly pointing out and describing API usage problems. But there is always room for improving how to present and word diagnostics. It is a bit of an art to get pithy, correct, and helpful messages. IMO the messages are pithy and correct which vet messages must be. But perhaps insufficiently helpful. There are also multiple places to display information which are under different constraints, i.e. the analyzer package website can give long examples in detail and we can try to highlight the url to get users there. So there we have a few different things we could do to try to be more helpful. Do you have a suggestion for how would you prefer the diagnostic to have been worded? Or whether there was information or an example that would have made this clearer?
This would be a new API or a backwards incompatible change. In either case, it would be its own proposal. |
Maps are expensive to create. We wanted logging to be fast. |
@timothy-king , may be I will come with different issue as i tried currently going about api directly on IDE. But if we go through documentation and start including api, it is concise enough. May be we can propagate some or repeat with a doc link. @jba - make sense , we need to keep order and i had gone through discussion about ...kv , where kv is a struct and memory allocation discussion. So closing the issue for now. |
Go version
devel go1.22-20a03fc713 Mon Dec 11 17:49:10 2023 +0000
Output of
go env
in your module/workspace:What did you do?
For Every did you do -> did see happen
What did you see happen?
What did you expect to see?
If it says up front, it expects key as string and value of any would be great. It is always expected in even numbers.
I would just go little further and ask, instead of variadic why did we not consider having a map[string]any or ...map[string]any as it already expects thinks in a key, value missing and strictly key being the string.
The text was updated successfully, but these errors were encountered: