GOLANG_INTERVIEW Telegram 1284
👣 Go совет

Встраивайте файлы прямо в Go-код с помощью пакета embed и директивы //go:embed.

Это работает как для отдельных файлов, так и для целых директорий:


import _ "embed"

//go:embed config.json
var config []byte

//go:embed version.txt
var version string

//go:embed templates/*
var templates embed.FS


📌 Удобно для:

- конфигов
- файлов с версией
- HTML-шаблонов
- любых статических ресурсов
Please open Telegram to view this post
VIEW IN TELEGRAM
👍3311🔥7



tgoop.com/golang_interview/1284
Create:
Last Update:

👣 Go совет

Встраивайте файлы прямо в Go-код с помощью пакета embed и директивы //go:embed.

Это работает как для отдельных файлов, так и для целых директорий:


import _ "embed"

//go:embed config.json
var config []byte

//go:embed version.txt
var version string

//go:embed templates/*
var templates embed.FS


📌 Удобно для:

- конфигов
- файлов с версией
- HTML-шаблонов
- любых статических ресурсов

BY Golang вопросы собеседований




Share with your friend now:
tgoop.com/golang_interview/1284

View MORE
Open in Telegram


Telegram News

Date: |

How to create a business channel on Telegram? (Tutorial) Telegram has announced a number of measures aiming to tackle the spread of disinformation through its platform in Brazil. These features are part of an agreement between the platform and the country's authorities ahead of the elections in October. 3How to create a Telegram channel? Invite up to 200 users from your contacts to join your channel best-secure-messaging-apps-shutterstock-1892950018.jpg
from us


Telegram Golang вопросы собеседований
FROM American