Tag

embed

0 views collected around this technical thread.

Go Programming World
Go Programming World
Jul 14, 2024 · Backend Development

Embedding Static Resources in Go with //go:embed

Since Go 1.16, the //go:embed directive allows developers to embed files, directories, or entire static assets directly into the compiled binary, simplifying deployment; this article explains the directive, its three embedding methods, usage in HTTP servers, unit tests, handling parent directories, and important considerations.

Goembedgo1.16
0 likes · 24 min read
Embedding Static Resources in Go with //go:embed
Go Programming World
Go Programming World
May 14, 2024 · Backend Development

Handling External File Dependencies in Go Unit Tests with Temporary Files and embed

This article explains how to resolve external file dependencies in Go unit tests by creating temporary files with os.CreateTemp, initializing global variables, and leveraging the embed package to embed changelog files as []byte or a file system, providing complete code examples and test results.

File DependencyGoembed
0 likes · 12 min read
Handling External File Dependencies in Go Unit Tests with Temporary Files and embed
IEG Growth Platform Technology Team
IEG Growth Platform Technology Team
Nov 29, 2021 · Backend Development

Understanding Go 1.16 embed: Use Cases, Implementation Details, and Design Rationale

This article explains the Go 1.16 embed feature by describing the typical configuration‑file problem, showing traditional file‑reading code versus embed‑based code, and diving into the compiler’s embedcfg handling and the underlying design philosophy of the new io/fs package.

BackendGoembed
0 likes · 6 min read
Understanding Go 1.16 embed: Use Cases, Implementation Details, and Design Rationale