Description
Simple program that embeds target files and/or directories into current directory go package source code. It generates a file containing a function that returns a []byte. Files are packed into a tar if more than one file is present, otherwise the file is encoded as is. Intended to be used with go generate.
embed alternatives and similar packages
Based on the "Resource Embedding" category.
Alternatively, view embed alternatives based on common mentions on social networks and blogs.
-
go.rice
go.rice is a Go package that makes working with resources such as html,js,css,images,templates, etc very easy. -
vfsgen
Takes an input http.FileSystem (likely at go generate time) and generates Go code that statically implements it. -
fileb0x
a better customizable tool to embed files in go; also update embedded files remotely without restarting the server -
go-bindata
A small utility which generates Go code from any file. Useful for embedding binary data in a Go program. -
statics
:file_folder: Embeds static resources into go files for single binary compilation + works with http.FileSystem + symlinks
CodeRabbit: AI Code Reviews for Developers

Do you think we are missing an alternative of embed or a related project?
Popular Comparisons
README
embed
Simple program that embeds target files and/or directories into current directory go package source code. It generates a file containing a function that returns a []byte. Files are packed into a tar if more than one file is present, otherwise the file is encoded as is. This allows targeting prepackaged tar files without specific checks, but means that programs need to be aware if the file is NOT a tar file.
Note that each argument passed to embed is walked, thus you can add multiple directories at once.
To use the data in the program call bindata()
, which returns a []byte copy of data. Generally you will then use a tar reader to read it.
Personally I used embed with the go generate
command on a separate sub-package of my intended package and place handling logic for assets there.
See embed -h
for details.