static.go (250B)
1 package static 2 3 import ( 4 "embed" 5 "io/fs" 6 "net/http" 7 ) 8 9 //go:embed files 10 var StaticFiles embed.FS 11 12 func FS() (http.FileSystem, error) { 13 subFS, err := fs.Sub(StaticFiles, "files") 14 if err != nil { 15 return nil, err 16 } 17 return http.FS(subFS), nil 18 }