Let’s try the new “embed” feature we are going to have in the Go 1.16 release. These will be very basic examples but will get you a grasp on how to use this great feature, we will also check how to use the embed.FS file system, symlinks (and hardlinks…), how to read multiple files or directories, wildcards and what a linter says about our code.
First, create a file that we can reach from our program:
0 🐧 leo@lein ~/go-embed $ cat hello.txt
A simple text file with two lines. To embed this file in our Go program we can use the…