Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time



Please use embed from Go's standard library instead.


embed is a tool for embedding static content in your Go application.

It provides three methods, listing embedded files and getting their content as []byte or string. If you need a io.Writer just wrap the []byte content in a bytes.NewBuffer.

The motivation for building yet another static file embedding tool for Go was that I am not satisfied with any of the existing tools, they either have inconvenient APIs or did not support to include more than a single folder or file.

Please note that this tool, as well as most other static file embedding tools, will be redundant as soon as the proposal to add support for embedded files lands in go/cmd.


a demo of embed

You can run the tool with go run or by downloading a precompiled binary from the releases page.

$ ./embed
   embed - A new cli application

   embed [global options] command [command options] [arguments...]

   help, h  Shows a list of commands or help for one command

   --package value, -p value                    name of the package the generated Go file is associated to (default: "main")
   --destination value, --dest value, -d value  where to store the generated Go file (default: "embeds.go")
   --include value, -i value                    paths to embed, directories are stored recursively (can be used multiple times)
   --help, -h                                   show help (default: false)

Running embed --include assets --include views will create a file embeds.go (you can change the destination) that bundles all files from the assets and views directory. In your application you can then use embeds.File("assets/my-asset.png") to get the contents of an embedded file. For an example of such a generated file see internal/embeds.go.

golang-migrate driver

The package also provides a migration source driver for golang-migrate. For a usage example refer to examples/migrate/migrate.go.