DEV Community

Cover image for Seamlessly Embed Files Into Your Go Binary

Seamlessly Embed Files Into Your Go Binary

prakash chokalingam on February 02, 2024

Incorporating YAML, JSON, or other configuration files into your Go application is becoming a standard practice, these files are often being refere...
Collapse
 
siwalikm profile image
Siwalik Mukherjee

Nice read Prakash, can go:embed be used to embed dynamic content generated during runtime?

Collapse
 
prakash_chokalingam profile image
prakash chokalingam

I don't think so @siwalikm, We can't write files within the embed fs dynamically, It can be used only to read. You can utilize the actual file system (pkg.go.dev/os) to read and write files dynamically.