Skip to content

proposal: embed: allow map[string]string, map[string][]byte, and/or map[string]any types #68909

Closed as not planned
@myaaaaaaaaa

Description

@myaaaaaaaaa

Proposal Details

Currently, go:embed allows embedding individual files as strings or []bytes, but directories must go through the embed.FS interface.

Allowing directories to be represented as maps would improve the ergonomics of walking through embedded filesystem trees, since there would no longer be any (nonexistent) errors to handle (or ignore).

Options:

  • map[string]string and/or map[string][]byte would represent flattened directory hierarchies (similar to how S3 buckets work)
  • map[string]any would represent the full tree, where keys are directory/file names without slashes, and values are map[string]any | []bytes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions