Skip to content

proposal: text/template: struct tags #47663

@ainsleyclark

Description

@ainsleyclark

Proposal:

It would be great if we could assign template tags to a struct so we can hide them from public view or rewrite the name when executing a template.
On many occasions we have to create a Public method. Having a tag similar to json on the struct would make so much sense.

I'm not sure if this has been discussed before but an example is below:

Example

File struct {
	URL        string            `json:"url" template:"URL"`
	Name       string            `json:"name" template: "-"`
}

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions