diff options
| author | bogem <[email protected]> | 2016-09-10 12:08:47 +0500 |
|---|---|---|
| committer | bogem <[email protected]> | 2016-09-10 12:08:47 +0500 |
| commit | d16d05ecad8d146ef127c975e2e3e167b6e38ad6 (patch) | |
| tree | a13921d2f956128ed2d1c123d89749db36625645 /uint.go | |
| parent | 6fd2ff4ff8dfcdf5556fbdc0ac0284408274b1a7 (diff) | |
Use strconv instead of fmt in values' String funcs
The existing implementation of flag values with fmt package uses
more memory and works slower than the implementation with strconv
package.
Diffstat (limited to 'uint.go')
| -rw-r--r-- | uint.go | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -1,9 +1,6 @@ package pflag -import ( - "fmt" - "strconv" -) +import "strconv" // -- uint Value type uintValue uint @@ -23,7 +20,7 @@ func (i *uintValue) Type() string { return "uint" } -func (i *uintValue) String() string { return fmt.Sprintf("%v", *i) } +func (i *uintValue) String() string { return strconv.FormatUint(uint64(*i), 10) } func uintConv(sval string) (interface{}, error) { v, err := strconv.ParseUint(sval, 0, 0) |
