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"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/elazarl/go-bindata-assetfs"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -372,13 +371,3 @@ func _filePath(dir, name string) string {
|
||||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
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
|
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
|
//go:generate gofmt -w ./bindata.generated.go
|
||||||
|
|
||||||
import "net/http"
|
import "github.com/elazarl/go-bindata-assetfs"
|
||||||
|
|
||||||
func fixedAssetFS() http.FileSystem {
|
func assetFS() *assetfs.AssetFS {
|
||||||
fs := assetFS()
|
return &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo, Prefix: "webdata"}
|
||||||
fs.AssetInfo = AssetInfo
|
|
||||||
return fs
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
main.go
2
main.go
|
|
@ -205,7 +205,7 @@ func main() {
|
||||||
}
|
}
|
||||||
port := addr.Port
|
port := addr.Port
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.Handle("/", http.FileServer(fixedAssetFS()))
|
mux.Handle("/", http.FileServer(assetFS()))
|
||||||
mux.Handle("/ws", websocket.Handler(func(ws *websocket.Conn) {
|
mux.Handle("/ws", websocket.Handler(func(ws *websocket.Conn) {
|
||||||
var message string
|
var message string
|
||||||
challenge := <-authenticationChallenges
|
challenge := <-authenticationChallenges
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue