Skip to content

strconv: no way to ParseFloat / ParseInt from []byte #3197

@bradfitz

Description

@bradfitz
The strconv package's ParseFloat / ParseInt only take string.

To reduce allocations, I need to parse an int from a []byte.

I attempted to convert strconv's Parse internals to use []byte instead, and then make
the existing string versions make an unsafe []byte of the string's memory using
reflect.SliceHeader / reflect.StringHeader, but the reflect package already depends on
strconv, so there's an import loop.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions