refactor asset with embed tool

This commit is contained in:
sentriz
2019-06-26 12:01:49 +01:00
parent e6c6d2406f
commit d8881bd31c
35 changed files with 11004 additions and 21662 deletions

View File

@@ -0,0 +1,26 @@
// +build embed
package server
import (
"bytes"
"io"
"time"
)
func (_ *Assets) Find(path string) (time.Time, io.ReadSeeker, error) {
asset, ok := AssetBytes[path]
if !ok {
return time.Time{}, nil, ErrAssetNotFound
}
reader := bytes.NewReader(asset.Bytes)
return asset.ModTime, reader, nil
}
func (_ *Assets) FindBytes(path string) (time.Time, []byte, error) {
asset, ok := AssetBytes[path]
if !ok {
return time.Time{}, nil, ErrAssetNotFound
}
return asset.ModTime, asset.Bytes, nil
}