mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
use new strconv API
All but 3 cases (in gcimporter.go and hixie.go) are automatic conversions using gofix. No attempt is made to use the new Append functions even though there are definitely opportunities. R=golang-dev, gri CC=golang-dev https://golang.org/cl/5447069
This commit is contained in:
parent
efbeaedb64
commit
2666b815a3
57 changed files with 150 additions and 153 deletions
|
|
@ -173,15 +173,15 @@ func (p *printer) marshalValue(val reflect.Value, name string) error {
|
|||
|
||||
switch k := val.Kind(); k {
|
||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||
p.WriteString(strconv.Itoa64(val.Int()))
|
||||
p.WriteString(strconv.FormatInt(val.Int(), 10))
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
|
||||
p.WriteString(strconv.Uitoa64(val.Uint()))
|
||||
p.WriteString(strconv.FormatUint(val.Uint(), 10))
|
||||
case reflect.Float32, reflect.Float64:
|
||||
p.WriteString(strconv.Ftoa64(val.Float(), 'g', -1))
|
||||
p.WriteString(strconv.FormatFloat(val.Float(), 'g', -1, 64))
|
||||
case reflect.String:
|
||||
Escape(p, []byte(val.String()))
|
||||
case reflect.Bool:
|
||||
p.WriteString(strconv.Btoa(val.Bool()))
|
||||
p.WriteString(strconv.FormatBool(val.Bool()))
|
||||
case reflect.Array:
|
||||
// will be [...]byte
|
||||
bytes := make([]byte, val.Len())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue