Skip to content

Go embed

Allows you to **include the contents of files and directories in your Go application. Examples:

var (
    Version string = strings.TrimSpace(version)
    //go:embed version.txt
    version string
)

//go:embed static
var embededFiles embed.FS
//go:embed *.tmpl
var tpls embed.FS

References

  1. https://blog.carlana.net/post/2021/how-to-use-go-embed/