Skip to content

text/template, html/template: ParseGlob does not document the pattern syntax #30608

@dmitshur

Description

@dmitshur

Packages text/template and html/template have a function named ParseGlob. They have the same documentation:

// ParseGlob creates a new Template and parses the template definitions from the
// files identified by the pattern, which must match at least one file. The
// returned template will have the (base) name and (parsed) contents of the
// first file matched by the pattern. ParseGlob is equivalent to calling
// ParseFiles with the list of files matched by the pattern.
//
// When parsing multiple files with the same name in different directories,
// the last one mentioned will be the one that results.
func ParseGlob(pattern string) (*Template, error)

The documentation of this function does not specify the rules of what the pattern should be. As a result, users reading the documentation cannot know how to use the function.

Both these packages also have a Template.ParseGlob method, which does specify the rules for the pattern:

// ...
// The pattern is processed by filepath.Glob and must match at least one file.
// ...

That information should be copied to the ParseGlob function documentation as well.

/cc @julieqiu @cnoellekb

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions