How //go:embed Works: From Source Files to Binary
Since its release in Go 1.16 (2021), //go:embed has quickly proven to be one of the most loved features of the Go language. Russ Cox and Brad Fitzpatrick originally designed the feature in 2020 to embed files and directories into Go binaries using a go directive (more on what that is later). It allows engineers to quickly embed anything they want instead of using awkwardly formatted constant string literals or reaching for flaky third-party tooling to bake data directly next to their program.
参与讨论