mirror of
https://github.com/bdnugget/eggos.git
synced 2026-11-07 04:17:27 +00:00
32 lines
411 B
Go
32 lines
411 B
Go
package assets
|
|
|
|
import (
|
|
"net/http"
|
|
"sync"
|
|
|
|
"github.com/rakyll/statik/fs"
|
|
)
|
|
|
|
//go:generate statik -m -src=./files -dest .. -p assets
|
|
|
|
var (
|
|
rootfs http.FileSystem
|
|
once sync.Once
|
|
)
|
|
|
|
func FS() http.FileSystem {
|
|
var err error
|
|
once.Do(func() {
|
|
rootfs, err = fs.New()
|
|
})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return rootfs
|
|
}
|
|
|
|
func Open(fname string) (http.File, error) {
|
|
fs := FS()
|
|
return fs.Open(fname)
|
|
}
|