Skip to content

x/tools/go/packages: Load(&cfg...) modifies cfg, contra explicit documentation #67702

Closed
@adonovan

Description

@adonovan

The Load function claims not to mutate the Config, but it does in fact mutate the non-exported fields, and has done for some time. In https://go.dev/cl588936 I proposed to update the docs to match reality:

// Calls to [Load] do not modify the public fields of this struct, but
// may modify hidden fields, so concurrent calls to [Load] must not
// use the same Config.

but perhaps we should instead reestablish the invariant rather than give it up.

@findleyr @matloob

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions