Skip to content

x/mod/modfile: document what the path is used for in Parse #45149

Closed
@dsnet

Description

@dsnet

The Parse function takes in a file name as the first argument. It does not seem obvious to me why a parse function should care about the file name at all in order to parse the contents of the the go.mod file. We should document better what this is used for and whether it is required.

Without studying the code too deeply, it seems that the filename is primarily used in error reporting and also to populate modfile.File.Syntax.Name but otherwise has not semantic impact on how the file is parsed.

In my situation, I don't have the original go.mod path on hand and it's not clear to me whether I should spend the effort to produce the exact right one or just put some arbitrary path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions