Using go:embed it's possible to embed files:
package main
import "embed"
//go:embed dir
var MyFs embed.FS
"embed" uses the path.Match call internally.
This doesn't work:
//go:embed dir/*{.js,tsx}
I don't see a way to match by filename extensions, is there any way to?
CodePudding user response:
Specify the patterns separately:
//go:embed dir/*.js dir/*.tsx
var MyFs embed.FS
Another option is to include the directory and ensure that the names of the files that you don't want to include start with a _
or .
.
//go:embed dir