two packages?
can't you just read the file data in runtime yourself?
since I build in docker (and in two stages) this doesn't work (or rather, it's not scalable)
why do you have so many packages
to put templates in the final docker image I need to copy them from the build stage, since the final docker image only contains the binary and nothing else (not even bash or "an os")
here is my suggestion then: have a separated package for them, e.g. assets package, which contains all of the template files you want to embed and then put all of the template files inside of that directory and use go:embed in there and then import that package in other packages and use the variables
you mean to just put one stupid file in there with package assets and put the variables in there
yes it's 1 file now, but it might become more files in future
programmer famous last words
I'm the only one that put their hands in this shit and the only stuff that this program needs to do is embed a router template configuration and handle stuff via URL parameters
anyway, I did this package templates import _ "embed" //go:embed aethra/7500.tmpl var Aethra75template string
All I'm saying is never say never.
Embed it in the template package then export Render functions
You'll have to ship the templates besides the executable too then, not very practical
Обсуждают сегодня