Skip to content

Instantly share code, notes, and snippets.

@bardic
Created October 31, 2024 05:35
Show Gist options
  • Select an option

  • Save bardic/7de4f19ac099627d0b8b0e5bb04c5d5a to your computer and use it in GitHub Desktop.

Select an option

Save bardic/7de4f19ac099627d0b8b0e5bb04c5d5a to your computer and use it in GitHub Desktop.
package main
import (
"embed"
"fmt"
"io/fs"
)
//tmpl contains 3 empty files for example; 1,2,3
//go:embed tmpl/*
var templates embed.FS
func main() {
fs.WalkDir(templates, ".", func(path string, d fs.DirEntry, err error) error {
fmt.Println(path)
return nil
})
}
//Output:
//.
//tmpl
//tmpl/1
//tmpl/2
//tmpl/3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment