Go by Example: Embed Directive
Go by Example : Embed Directive
|
|
Import the
|
|
|
|
Or embed the contents of the file into a
|
|
We can also embed multiple files or even folders with wildcards. This uses a variable of the embed.FS type , which implements a simple virtual file system. |
|
| |
Print out the contents of
|
|
Retrieve some files from the embedded folder. |
|
|
Use these commands to run the example. (Note: due to limitation on go playground, this example can only be run on your local machine.) |
|
|
Next example: Testing and Benchmarking .