Skip to content

proposal: embed: add -embed=compress flag to go #61322

Closed
@twmb

Description

@twmb

The design proposal for embed contains a section on compression to reduce binary size. This has come up for me a few times recently and I wonder if there is any appetite for the final sentence of this section,

"Future work might be to add -embed=compress as a go build option for use in limited environments."

Having written the same decompression logic a few times now in a few different ways (decompress one file, decompress a tarball, gunzip vs. zstd), it'd be super convenient to have compression of embedded files or dirs built directly into Go.

Another benefit of of allowing compression at the build stage (and on-the-fly decompression once) is for code repositories. Currently, I am checking in a tiny compressed tarball and have tests against the sha256 of the checkin. Tarballs aren't really great for GH repositories, but considering how infrequently this tarball changes, it's an alright tradeoff right now.

This isn't a super pressing need, but I couldn't find a previous open nor closed proposal, and in the original proposal, the only comment that mentions compression is this one (the point of which is that TinyGo rarely targets RAM heavy systems).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions