-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
FrozenDueToAgeProposalWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.Issue is not actionable because of missing required information, which needs to be provided.
Milestone
Description
Currently many core libraries like grpc
have configurable flags and options that are either int32
or uint32
, e.g.
This forces the userland code for any configurable system to look something like this:
...
maxConcurrentStreams := f.Int("max_streams", 100, "Number of maximum concurrent streams")
f.Parse()
...
maxConcurrentConnectionsOption := grpc.MaxConcurrentStreams(uint32(maxConcurrentStreams))
...
Such casting (and any other workaround) results in error prone implementations sometimes, since the error handling has to be done by the developer, which I'm not particulary against, but it's better if we could trust Go's core flag parsing library to support and validate this.
In this manner, we could allow the implementations to simply look like this:
maxConcurrentStreams := f.Uint32("max_streams", 100, "Number of maximum concurrent streams")
f.Parse()
...
maxConcurrentConnectionsOption := grpc.MaxConcurrentStreams(maxConcurrentStreams)
...
I know it may look simple but flag
already supports int, int64 and float64, so imho, adding this makes sense and allows for better looking and more secure code.
lmittmann
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeProposalWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.Issue is not actionable because of missing required information, which needs to be provided.