Skip to content

errors: should have minimal dependency on reflectlite #54341

Closed as not planned
Closed as not planned
@dsnet

Description

@dsnet

On go1.19, A blank import of "errors" increases the binary size by ~15.5KiB due to the transitive dependency on reflectlite.

The hard dependency occurs because of the program initialize variable for:

var errorType = reflectlite.TypeOf((*error)(nil)).Elem()

We could consider a trick similar to 419757

This is relevant since many packages depend on errors only for errors.New, and we should not expect those packages to force reflectlite to be transitively linked in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions