Embed static assets in binary with Go Generate

Опубликовано: 12 Февраль 2026
на канале: Jantcu
1,626
29

This video shows how to embed static file information in a binary using the "go generate" command. This allows you to reference files and information that might not necessarily be available on the end user's computer.

We use go generate with Plenti to embed JavaScript, JSON, and other static assets:
Calling the generator: https://github.com/plentico/plenti/bl...

Defining the generator: https://github.com/plentico/plenti/bl...
Example generated code: https://github.com/plentico/plenti/bl...

Proposal to allow embedding static assets (files) into binaries: https://github.com/golang/go/issues/3...

Go generate documentation: https://blog.golang.org/generate