Use go-bindata instead of go-bindata-assetfs
This commit is contained in:
parent
abc8ef5818
commit
b3a4ca7449
3 changed files with 5 additions and 18 deletions
|
|
@ -13,7 +13,6 @@ import (
|
|||
"bytes"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"github.com/elazarl/go-bindata-assetfs"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
|
@ -372,13 +371,3 @@ func _filePath(dir, name string) string {
|
|||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||||
}
|
||||
|
||||
func assetFS() *assetfs.AssetFS {
|
||||
assetInfo := func(path string) (os.FileInfo, error) {
|
||||
return os.Stat(path)
|
||||
}
|
||||
for k := range _bintree.Children {
|
||||
return &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: assetInfo, Prefix: k}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
|
|
|||
10
bindata.go
10
bindata.go
|
|
@ -1,12 +1,10 @@
|
|||
package main
|
||||
|
||||
//go:generate go-bindata-assetfs -nometadata -o ./bindata.generated.go webdata/...
|
||||
//go:generate go-bindata -nometadata -o ./bindata.generated.go webdata/...
|
||||
//go:generate gofmt -w ./bindata.generated.go
|
||||
|
||||
import "net/http"
|
||||
import "github.com/elazarl/go-bindata-assetfs"
|
||||
|
||||
func fixedAssetFS() http.FileSystem {
|
||||
fs := assetFS()
|
||||
fs.AssetInfo = AssetInfo
|
||||
return fs
|
||||
func assetFS() *assetfs.AssetFS {
|
||||
return &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo, Prefix: "webdata"}
|
||||
}
|
||||
|
|
|
|||
2
main.go
2
main.go
|
|
@ -205,7 +205,7 @@ func main() {
|
|||
}
|
||||
port := addr.Port
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("/", http.FileServer(fixedAssetFS()))
|
||||
mux.Handle("/", http.FileServer(assetFS()))
|
||||
mux.Handle("/ws", websocket.Handler(func(ws *websocket.Conn) {
|
||||
var message string
|
||||
challenge := <-authenticationChallenges
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue