Rewrite vendored imports in subpackages, get rid of assetfs and implement filesystem on top of bindata that supports -debug, update build instructions
This commit is contained in:
parent
65229f7a9e
commit
6378131a9d
@ -18,6 +18,7 @@ name_pending
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd $GOPATH/src/github.com/khlieng/name_pending
|
cd $GOPATH/src/github.com/khlieng/name_pending
|
||||||
|
|
||||||
go install
|
go install
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -29,13 +30,11 @@ go install
|
|||||||
```bash
|
```bash
|
||||||
npm install -g gulp
|
npm install -g gulp
|
||||||
go get github.com/jteeuwen/go-bindata/...
|
go get github.com/jteeuwen/go-bindata/...
|
||||||
go get github.com/elazarl/go-bindata-assetfs/...
|
|
||||||
|
|
||||||
cd $GOPATH/src/github.com/khlieng/name_pending/client
|
cd $GOPATH/src/github.com/khlieng/name_pending/client
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
gulp -p
|
gulp -p
|
||||||
go-bindata-assetfs -nomemcopy dist/...
|
go-bindata -nomemcopy -o ../bindata.go dist/...
|
||||||
mv bindata_assetfs.go ../bindata.go
|
|
||||||
|
|
||||||
# Rebuild the server :)
|
# Rebuild the server :)
|
||||||
```
|
```
|
40
bindata.go
40
bindata.go
@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/elazarl/go-bindata-assetfs"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -87,7 +86,7 @@ func dist_bundle_js() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/bundle.js", size: 282901, mode: os.FileMode(436), modTime: time.Unix(1429742349, 0)}
|
info := bindata_file_info{name: "dist/bundle.js", size: 282901, mode: os.FileMode(436), modTime: time.Unix(1430087402, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -107,7 +106,7 @@ func dist_bundle_js_gz() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/bundle.js.gz", size: 81846, mode: os.FileMode(436), modTime: time.Unix(1429742349, 0)}
|
info := bindata_file_info{name: "dist/bundle.js.gz", size: 81846, mode: os.FileMode(436), modTime: time.Unix(1430087402, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -127,7 +126,7 @@ func dist_css_fontello_css() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/css/fontello.css", size: 689, mode: os.FileMode(436), modTime: time.Unix(1429742340, 0)}
|
info := bindata_file_info{name: "dist/css/fontello.css", size: 689, mode: os.FileMode(436), modTime: time.Unix(1430087392, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -147,7 +146,7 @@ func dist_css_fontello_css_gz() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/css/fontello.css.gz", size: 329, mode: os.FileMode(436), modTime: time.Unix(1429742349, 0)}
|
info := bindata_file_info{name: "dist/css/fontello.css.gz", size: 329, mode: os.FileMode(436), modTime: time.Unix(1430087402, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -167,7 +166,7 @@ func dist_css_style_css() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/css/style.css", size: 3166, mode: os.FileMode(436), modTime: time.Unix(1429742340, 0)}
|
info := bindata_file_info{name: "dist/css/style.css", size: 3166, mode: os.FileMode(436), modTime: time.Unix(1430087392, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -187,7 +186,7 @@ func dist_css_style_css_gz() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/css/style.css.gz", size: 1024, mode: os.FileMode(436), modTime: time.Unix(1429742349, 0)}
|
info := bindata_file_info{name: "dist/css/style.css.gz", size: 1024, mode: os.FileMode(436), modTime: time.Unix(1430087402, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -207,7 +206,7 @@ func dist_font_fontello_eot() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/font/fontello.eot", size: 5288, mode: os.FileMode(436), modTime: time.Unix(1429742340, 0)}
|
info := bindata_file_info{name: "dist/font/fontello.eot", size: 5288, mode: os.FileMode(436), modTime: time.Unix(1430087392, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -227,7 +226,7 @@ func dist_font_fontello_eot_gz() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/font/fontello.eot.gz", size: 2704, mode: os.FileMode(436), modTime: time.Unix(1429742349, 0)}
|
info := bindata_file_info{name: "dist/font/fontello.eot.gz", size: 2704, mode: os.FileMode(436), modTime: time.Unix(1430087402, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -247,7 +246,7 @@ func dist_font_fontello_svg() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/font/fontello.svg", size: 1571, mode: os.FileMode(436), modTime: time.Unix(1429742340, 0)}
|
info := bindata_file_info{name: "dist/font/fontello.svg", size: 1571, mode: os.FileMode(436), modTime: time.Unix(1430087392, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -267,7 +266,7 @@ func dist_font_fontello_svg_gz() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/font/fontello.svg.gz", size: 812, mode: os.FileMode(436), modTime: time.Unix(1429742349, 0)}
|
info := bindata_file_info{name: "dist/font/fontello.svg.gz", size: 812, mode: os.FileMode(436), modTime: time.Unix(1430087402, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -287,7 +286,7 @@ func dist_font_fontello_ttf() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/font/fontello.ttf", size: 5120, mode: os.FileMode(436), modTime: time.Unix(1429742340, 0)}
|
info := bindata_file_info{name: "dist/font/fontello.ttf", size: 5120, mode: os.FileMode(436), modTime: time.Unix(1430087392, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -307,7 +306,7 @@ func dist_font_fontello_ttf_gz() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/font/fontello.ttf.gz", size: 2652, mode: os.FileMode(436), modTime: time.Unix(1429742349, 0)}
|
info := bindata_file_info{name: "dist/font/fontello.ttf.gz", size: 2652, mode: os.FileMode(436), modTime: time.Unix(1430087402, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -327,7 +326,7 @@ func dist_font_fontello_woff() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/font/fontello.woff", size: 2912, mode: os.FileMode(436), modTime: time.Unix(1429742341, 0)}
|
info := bindata_file_info{name: "dist/font/fontello.woff", size: 2912, mode: os.FileMode(436), modTime: time.Unix(1430087393, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -347,7 +346,7 @@ func dist_font_fontello_woff_gz() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/font/fontello.woff.gz", size: 2862, mode: os.FileMode(436), modTime: time.Unix(1429742349, 0)}
|
info := bindata_file_info{name: "dist/font/fontello.woff.gz", size: 2862, mode: os.FileMode(436), modTime: time.Unix(1430087402, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -367,7 +366,7 @@ func dist_index_html() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/index.html", size: 369, mode: os.FileMode(436), modTime: time.Unix(1429742340, 0)}
|
info := bindata_file_info{name: "dist/index.html", size: 369, mode: os.FileMode(436), modTime: time.Unix(1430087392, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -387,7 +386,7 @@ func dist_index_html_gz() (*asset, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info := bindata_file_info{name: "dist/index.html.gz", size: 248, mode: os.FileMode(436), modTime: time.Unix(1429742349, 0)}
|
info := bindata_file_info{name: "dist/index.html.gz", size: 248, mode: os.FileMode(436), modTime: time.Unix(1430087402, 0)}
|
||||||
a := &asset{bytes: bytes, info: info}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
@ -588,10 +587,3 @@ func _filePath(dir, name string) string {
|
|||||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func assetFS() *assetfs.AssetFS {
|
|
||||||
for k := range _bintree.Children {
|
|
||||||
return &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: k}
|
|
||||||
}
|
|
||||||
panic("unreachable")
|
|
||||||
}
|
|
||||||
|
37
bindata_fs.go
Normal file
37
bindata_fs.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
type BindataFileSystem struct{}
|
||||||
|
|
||||||
|
func (f BindataFileSystem) Open(name string) (http.File, error) {
|
||||||
|
path := "dist" + name
|
||||||
|
|
||||||
|
data, err := Asset(path)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &BindataFile{bytes.NewReader(data), path}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type BindataFile struct {
|
||||||
|
*bytes.Reader
|
||||||
|
path string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *BindataFile) Close() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *BindataFile) Readdir(count int) ([]os.FileInfo, error) {
|
||||||
|
return make([]os.FileInfo, 0), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *BindataFile) Stat() (os.FileInfo, error) {
|
||||||
|
return AssetInfo(f.path)
|
||||||
|
}
|
2
main.go
2
main.go
@ -94,7 +94,7 @@ func main() {
|
|||||||
|
|
||||||
channelStore = storage.NewChannelStore()
|
channelStore = storage.NewChannelStore()
|
||||||
sessions = make(map[string]*Session)
|
sessions = make(map[string]*Session)
|
||||||
fs = http.FileServer(assetFS())
|
fs = http.FileServer(BindataFileSystem{})
|
||||||
|
|
||||||
files = []File{
|
files = []File{
|
||||||
File{"/bundle.js", "text/javascript"},
|
File{"/bundle.js", "text/javascript"},
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"os/user"
|
"os/user"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
"github.com/boltdb/bolt"
|
"github.com/khlieng/name_pending/Godeps/_workspace/src/github.com/boltdb/bolt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var db *bolt.DB
|
var db *bolt.DB
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/boltdb/bolt"
|
"github.com/khlieng/name_pending/Godeps/_workspace/src/github.com/boltdb/bolt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user