I am essentially trying to walk through a folder of html files. I want to embed them into the binary file and be able to parse them upon request for template execution purpo
Another tool to consider: Another recent good tool comes from esc: Embedding Static Assets in Go (GitHub repo)
a program that:
- can take some directories and recursively embed all files in them in a way that was compatible with http.FileSystem
- can optionally be disabled for use with the local file system for local development
- will not change the output file on subsequent runs
- has reasonable-sized diffs when files changed
- is vendoring-friendly
Vendoring-friendly means that when I run
godepor party, the static embed file will not change.
This means it must not have any third-party imports (since their import path will be rewritten duringgoimports, and thus different than what the tool itself produces), or a specifiable location for the needed third-party imports.It generates nice, gzipped strings, one per file.
There is a simple flag to enable local development mode, which is smart enough to not strip directory prefixes off of filenames (an option inescthat is sometimes needed).
The output includes all needed code, and does not depend on any third-party libraries for compatibility withhttp.FileSystem.