Using embedded fs for static
parent
c5aab74159
commit
83ac76795c
@ -0,0 +1,14 @@
|
||||
package ui
|
||||
|
||||
import "embed"
|
||||
|
||||
// The below is actually a comment directive. Comment directives must be
|
||||
// placed immediately above the variable used. The path provided is relative
|
||||
// to the .go file it is in. You can only embed on global variables at a package
|
||||
// level. Paths cannot contain . or .. or begin with / So you are effectively
|
||||
// restricted to embedding files within the same directory as the .go file.
|
||||
// Lastly the embedded file system is always rooted in the directory that contains
|
||||
// the embed directive. So in this example the root is in our ui dir.
|
||||
|
||||
//go:embed "static"
|
||||
var Files embed.FS
|
Loading…
Reference in New Issue