Похожие чаты

What if I need to use the same template in

two packages?

16 ответов

38 просмотров

can't you just read the file data in runtime yourself?

Bryan Joshua-Pedini Автор вопроса
woto 「 噂 」
can't you just read the file data in runtime yours...

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

Bryan Joshua-Pedini Автор вопроса
woto 「 噂 」
can't you just read the file data in runtime yours...

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")

Bryan Joshua Pedini
since I build in docker (and in two stages) this d...

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

Bryan Joshua-Pedini Автор вопроса
woto 「 噂 」
here is my suggestion then: have a separated pack...

you mean to just put one stupid file in there with package assets and put the variables in there

Bryan Joshua Pedini
you mean to just put one stupid file in there with...

yes it's 1 file now, but it might become more files in future

Bryan Joshua Pedini
never will

programmer famous last words

Bryan Joshua-Pedini Автор вопроса
Eli Davis
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

Bryan Joshua-Pedini Автор вопроса
woto 「 噂 」
yes it's 1 file now, but it might become more file...

anyway, I did this package templates import _ "embed" //go:embed aethra/7500.tmpl var Aethra75template string

Embed it in the template package then export Render functions

woto 「 噂 」
can't you just read the file data in runtime yours...

You'll have to ship the templates besides the executable too then, not very practical

Похожие вопросы

Обсуждают сегодня

30500 за редактор? )
Владимир
47
any reference of this implementation?
BitBuddha
29
Ⓐrtto, [4/23/24 7:02 PM] Please explain more fully how it is not working exactly, and what are the steps you are taking, and what error messages come or what happens. Ⓐrtto, ...
Ezza Kezza
2
sounds like people have lost their kaspa on tradeogre... does this mean tradeogre not trustworthy?
Ezza Kezza
15
Страшнейшая правда про списки ЦБ. С первых дней жизни P2P сферы, молодые человеки, начитавшись законодательной базы и "внутренних" документов, решили, что им противостоит сер...
Foxcool
3
Недавно Google Project Zero нашёл багу в SQLite с помощью LLM, о чём достаточно было шумно в определённых интернетах, которые сопровождались рассказами, что скоро всех "ибешни...
Alex Sherbakov
5
So much speculation in the last week. So much volatility in price. This is because Hedera has a GC that isn't using the network it's governing. Why aren't people asking why a...
Summit Seeker R
8
Anyone else having this error when trying to make transactions?
Datzel
11
Question: How viable is it to use Anvil as the backend infrastructure for managing a TradFi portfolio, while integrating Flexa for instant liquidity and payment solutions? Cou...
Kevin
2
вы делали что-то подобное и как? может есть либы готовые? увидел картинку нокода, где всё линиями соединено и стало интересно попробовать то же в ddl на lua сделать. решил с ч...
Victor
8
Карта сайта