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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With