-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed as not planned
Labels
Milestone
Description
Description
- Change
strconv.FormatIntto be a generic that accepts any integer type. - Deprecate
strconv.FormatUintand suggest to usestrconv.FormatIntinstead.
Motivation
During a review of a medium-sized codebase I have noticed that there are two causes of typecasts to the arguments of strconv.Format[U]Int: casting integers to a wider type, and casting non-integers (floats, types based on integers). These two cases are hard to distinguish and as a result of the review we had to add a comment to every typecast.
First type of casts (wider-type casts) ought not exist, they are an artifact of Format[U]Int been created before generics. This proposal gets rid of the useless typecasts of first type, leaving only second, meaningful, typecasts in place.
As far as I can tell this proposal does not break backward compatibility, as it makes FormatInt accept strictly more types than before.
Reactions are currently unavailable