Похожие чаты

Would someone know how to rewrite packr (v1) code to

the go-native embed?

https://github.com/ansible-semaphore/semaphore/issues/1015#issuecomment-1657194811

It's a handful of lines in the codebase, but I have no clue how to rewrite it as I do not usually work with golang.

12 ответов

42 просмотра

learn and do it yourself

you can use embed in two ways: - embed dir as filesystem - embed file as string or []byte variable

https://github.com/ansible-semaphore/semaphore/blob/85d9936082bc8a3fc763ff8d3f1f6a6695bfc956/db/sql/migration.go#L38 this looks like it requires the first approach

here's how to use embed.FS

Martin-Rys Автор вопроса
Roman Sharkov
here's how to use embed.FS

I've ran into a bit of a snag. /api/router.go embeds ../web/dist and embed does not support accessing parent. I've seen this resolved by putting the embeds in a higher go file, but there isn't one, what's the proper solution here? A) Reorganizing the directory structure (author probably won't like this and it will require a lot of reorganizing) B) Creating /embed.go and putting embeds there C) Something else entirely

Martin Rys
I've ran into a bit of a snag. /api/router.go embe...

How many embedded files are there? If there aren't many I would simply use variable embedding

Martin Rys
screenshot

Ah, it's an embedded web frontend, I see Then variables are not an option.

Martin Rys
I've ran into a bit of a snag. /api/router.go embe...

Variant B would be using the variables approach in embed.go?

Martin-Rys Автор вопроса
Roman Sharkov
Variant B would be using the variables approach in...

it would be using /embed.go to embed web/dist as then there will be no need to access a higher directory structure, though I am not sure how exactly to implement it.

Martin-Rys Автор вопроса
Roman Sharkov
Variant B would be using the variables approach in...

I am not sure if that's a valid approach, tried using the same api package for the include, but apparently then it should be in the same directory as the other api files. Tried creating another new package, but I failed at all attempts to import it.

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта