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:
khlieng 2015-04-27 00:45:49 +02:00
parent 65229f7a9e
commit 6378131a9d
6 changed files with 59 additions and 31 deletions

View File

@ -18,6 +18,7 @@ name_pending
```bash
cd $GOPATH/src/github.com/khlieng/name_pending
go install
```
@ -29,13 +30,11 @@ go install
```bash
npm install -g gulp
go get github.com/jteeuwen/go-bindata/...
go get github.com/elazarl/go-bindata-assetfs/...
cd $GOPATH/src/github.com/khlieng/name_pending/client
npm install
gulp -p
go-bindata-assetfs -nomemcopy dist/...
mv bindata_assetfs.go ../bindata.go
go-bindata -nomemcopy -o ../bindata.go dist/...
# Rebuild the server :)
```

View File

@ -1,7 +1,6 @@
package main
import (
"github.com/elazarl/go-bindata-assetfs"
"bytes"
"compress/gzip"
"fmt"
@ -87,7 +86,7 @@ func dist_bundle_js() (*asset, error) {
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}
return a, nil
}
@ -107,7 +106,7 @@ func dist_bundle_js_gz() (*asset, error) {
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}
return a, nil
}
@ -127,7 +126,7 @@ func dist_css_fontello_css() (*asset, error) {
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}
return a, nil
}
@ -147,7 +146,7 @@ func dist_css_fontello_css_gz() (*asset, error) {
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}
return a, nil
}
@ -167,7 +166,7 @@ func dist_css_style_css() (*asset, error) {
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}
return a, nil
}
@ -187,7 +186,7 @@ func dist_css_style_css_gz() (*asset, error) {
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}
return a, nil
}
@ -207,7 +206,7 @@ func dist_font_fontello_eot() (*asset, error) {
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}
return a, nil
}
@ -227,7 +226,7 @@ func dist_font_fontello_eot_gz() (*asset, error) {
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}
return a, nil
}
@ -247,7 +246,7 @@ func dist_font_fontello_svg() (*asset, error) {
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}
return a, nil
}
@ -267,7 +266,7 @@ func dist_font_fontello_svg_gz() (*asset, error) {
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}
return a, nil
}
@ -287,7 +286,7 @@ func dist_font_fontello_ttf() (*asset, error) {
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}
return a, nil
}
@ -307,7 +306,7 @@ func dist_font_fontello_ttf_gz() (*asset, error) {
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}
return a, nil
}
@ -327,7 +326,7 @@ func dist_font_fontello_woff() (*asset, error) {
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}
return a, nil
}
@ -347,7 +346,7 @@ func dist_font_fontello_woff_gz() (*asset, error) {
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}
return a, nil
}
@ -367,7 +366,7 @@ func dist_index_html() (*asset, error) {
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}
return a, nil
}
@ -387,7 +386,7 @@ func dist_index_html_gz() (*asset, error) {
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}
return a, nil
}
@ -588,10 +587,3 @@ func _filePath(dir, name string) string {
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
View 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)
}

View File

@ -94,7 +94,7 @@ func main() {
channelStore = storage.NewChannelStore()
sessions = make(map[string]*Session)
fs = http.FileServer(assetFS())
fs = http.FileServer(BindataFileSystem{})
files = []File{
File{"/bundle.js", "text/javascript"},

View File

@ -6,7 +6,7 @@ import (
"os/user"
"path"
"github.com/boltdb/bolt"
"github.com/khlieng/name_pending/Godeps/_workspace/src/github.com/boltdb/bolt"
)
var db *bolt.DB

View File

@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"github.com/boltdb/bolt"
"github.com/khlieng/name_pending/Godeps/_workspace/src/github.com/boltdb/bolt"
)
type Server struct {