commit
eb01a153be
26
Makefile
26
Makefile
|
@ -1,24 +1,2 @@
|
|||
all: regen check
|
||||
|
||||
regen:
|
||||
go install ./...
|
||||
make -C testdata regen
|
||||
|
||||
.PHONY: check
|
||||
check: errcheck go-nyet
|
||||
errcheck testdata/out/compress-memcopy.go
|
||||
errcheck testdata/out/compress-nomemcopy.go
|
||||
errcheck testdata/out/debug.go
|
||||
errcheck testdata/out/nocompress-memcopy.go
|
||||
errcheck testdata/out/nocompress-nomemcopy.go
|
||||
go-nyet testdata/out/compress-memcopy.go
|
||||
go-nyet testdata/out/compress-nomemcopy.go
|
||||
go-nyet testdata/out/debug.go
|
||||
go-nyet testdata/out/nocompress-memcopy.go
|
||||
go-nyet testdata/out/nocompress-nomemcopy.go
|
||||
|
||||
errcheck:
|
||||
go get github.com/kisielk/errcheck
|
||||
|
||||
go-nyet:
|
||||
go get github.com/barakmich/go-nyet
|
||||
all:
|
||||
make -C testdata
|
||||
|
|
20
convert.go
20
convert.go
|
@ -200,18 +200,22 @@ var regFuncName = regexp.MustCompile(`[^a-zA-Z0-9_]`)
|
|||
// also compares against a known list of functions to
|
||||
// prevent conflict based on name translation.
|
||||
func safeFunctionName(name string, knownFuncs map[string]int) string {
|
||||
var inBytes, outBytes []byte
|
||||
|
||||
name = strings.ToLower(name)
|
||||
name = regFuncName.ReplaceAllString(name, "_")
|
||||
inBytes = []byte(name)
|
||||
|
||||
// Get rid of "__" instances for niceness.
|
||||
for strings.Index(name, "__") > -1 {
|
||||
name = strings.Replace(name, "__", "_", -1)
|
||||
for i := 0; i < len(inBytes); i++ {
|
||||
if regFuncName.Match([]byte{inBytes[i]}) {
|
||||
i++
|
||||
outBytes = append(outBytes, []byte(strings.ToUpper(string(inBytes[i])))...)
|
||||
// bytes[i] = strings.ToUpper(string(byte))
|
||||
} else {
|
||||
outBytes = append(outBytes, inBytes[i])
|
||||
}
|
||||
}
|
||||
|
||||
// Leading underscores are silly (unless they prefix a digit (see below)).
|
||||
for len(name) > 1 && name[0] == '_' {
|
||||
name = name[1:]
|
||||
}
|
||||
name = string(outBytes)
|
||||
|
||||
// Identifier can't start with a digit.
|
||||
if unicode.IsDigit(rune(name[0])) {
|
||||
|
|
6
debug.go
6
debug.go
|
@ -38,8 +38,8 @@ func writeDebugHeader(w io.Writer) error {
|
|||
"path/filepath"
|
||||
)
|
||||
|
||||
// bindata_read reads the given file from disk. It returns an error on failure.
|
||||
func bindata_read(path, name string) ([]byte, error) {
|
||||
// bindataRead reads the given file from disk. It returns an error on failure.
|
||||
func bindataRead(path, name string) ([]byte, error) {
|
||||
buf, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset %%s at %%s: %%v", name, path, err)
|
||||
|
@ -69,7 +69,7 @@ func writeDebugAsset(w io.Writer, c *Config, asset *Asset) error {
|
|||
func %s() (*asset, error) {
|
||||
path := %s
|
||||
name := %q
|
||||
bytes, err := bindata_read(path, name)
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
38
release.go
38
release.go
|
@ -113,7 +113,7 @@ func header_compressed_nomemcopy(w io.Writer) error {
|
|||
"path/filepath"
|
||||
)
|
||||
|
||||
func bindata_read(data, name string) ([]byte, error) {
|
||||
func bindataRead(data, name string) ([]byte, error) {
|
||||
var empty [0]byte
|
||||
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
||||
b := empty[:]
|
||||
|
@ -159,7 +159,7 @@ func header_compressed_memcopy(w io.Writer) error {
|
|||
"path/filepath"
|
||||
)
|
||||
|
||||
func bindata_read(data []byte, name string) ([]byte, error) {
|
||||
func bindataRead(data []byte, name string) ([]byte, error) {
|
||||
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Read %%q: %%v", name, err)
|
||||
|
@ -196,7 +196,7 @@ func header_uncompressed_nomemcopy(w io.Writer) error {
|
|||
"path/filepath"
|
||||
)
|
||||
|
||||
func bindata_read(data, name string) ([]byte, error) {
|
||||
func bindataRead(data, name string) ([]byte, error) {
|
||||
var empty [0]byte
|
||||
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
||||
b := empty[:]
|
||||
|
@ -231,29 +231,29 @@ func header_release_common(w io.Writer) error {
|
|||
info os.FileInfo
|
||||
}
|
||||
|
||||
type bindata_file_info struct {
|
||||
type bindataFileInfo struct {
|
||||
name string
|
||||
size int64
|
||||
mode os.FileMode
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
func (fi bindata_file_info) Name() string {
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
func (fi bindata_file_info) Size() int64 {
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
func (fi bindata_file_info) Mode() os.FileMode {
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
func (fi bindata_file_info) ModTime() time.Time {
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
func (fi bindata_file_info) IsDir() bool {
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
}
|
||||
func (fi bindata_file_info) Sys() interface{} {
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -277,8 +277,8 @@ func compressed_nomemcopy(w io.Writer, asset *Asset, r io.Reader) error {
|
|||
|
||||
_, err = fmt.Fprintf(w, `"
|
||||
|
||||
func %s_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
func %sBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_%s,
|
||||
%q,
|
||||
)
|
||||
|
@ -304,8 +304,8 @@ func compressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error {
|
|||
|
||||
_, err = fmt.Fprintf(w, `")
|
||||
|
||||
func %s_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
func %sBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_%s,
|
||||
%q,
|
||||
)
|
||||
|
@ -328,8 +328,8 @@ func uncompressed_nomemcopy(w io.Writer, asset *Asset, r io.Reader) error {
|
|||
|
||||
_, err = fmt.Fprintf(w, `"
|
||||
|
||||
func %s_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
func %sBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_%s,
|
||||
%q,
|
||||
)
|
||||
|
@ -357,7 +357,7 @@ func uncompressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error {
|
|||
|
||||
_, err = fmt.Fprintf(w, `)
|
||||
|
||||
func %s_bytes() ([]byte, error) {
|
||||
func %sBytes() ([]byte, error) {
|
||||
return _%s, nil
|
||||
}
|
||||
|
||||
|
@ -381,12 +381,12 @@ func asset_release_common(w io.Writer, c *Config, asset *Asset) error {
|
|||
modTime = c.ModTime
|
||||
}
|
||||
_, err = fmt.Fprintf(w, `func %s() (*asset, error) {
|
||||
bytes, err := %s_bytes()
|
||||
bytes, err := %sBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: %q, size: %d, mode: os.FileMode(%d), modTime: time.Unix(%d, 0)}
|
||||
info := bindataFileInfo{name: %q, size: %d, mode: os.FileMode(%d), modTime: time.Unix(%d, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
|
19
restore.go
19
restore.go
|
@ -11,7 +11,7 @@ import (
|
|||
|
||||
func writeRestore(w io.Writer) error {
|
||||
_, err := fmt.Fprintf(w, `
|
||||
// Restore an asset under the given directory
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
|
@ -36,17 +36,18 @@ func RestoreAsset(dir, name string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Restore assets under the given directory recursively
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
if err != nil { // File
|
||||
// File
|
||||
if err != nil {
|
||||
return RestoreAsset(dir, name)
|
||||
} else { // Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
38
testdata/Makefile
vendored
38
testdata/Makefile
vendored
|
@ -1,6 +1,32 @@
|
|||
regen:
|
||||
go-bindata -o out/compress-memcopy.go in/...
|
||||
go-bindata -nomemcopy -o out/compress-nomemcopy.go in/...
|
||||
go-bindata -debug -o out/debug.go in/...
|
||||
go-bindata -nocompress -o out/nocompress-memcopy.go in/...
|
||||
go-bindata -nocompress -nomemcopy -o out/nocompress-nomemcopy.go in/...
|
||||
.PHONY: check
|
||||
check: out/compress-memcopy.go out/compress-nomemcopy.go out/debug.go out/nocompress-memcopy.go out/nocompress-nomemcopy.go errcheck go-nyet golint
|
||||
$(foreach file, $(wildcard out/*.go), errcheck $(file);)
|
||||
$(foreach file, $(wildcard out/*.go), go-nyet $(file);)
|
||||
$(foreach file, $(wildcard out/*.go), golint $(file);)
|
||||
|
||||
$(GOPATH)/bin/go-bindata: $(wildcard ../*.go) $(wildcard ../**/*.go)
|
||||
go install ../...
|
||||
|
||||
out/compress-memcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
|
||||
$(GOPATH)/bin/go-bindata -o $@ in/...
|
||||
|
||||
out/compress-nomemcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
|
||||
$(GOPATH)/bin/go-bindata -nomemcopy -o $@ in/...
|
||||
|
||||
out/debug.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
|
||||
$(GOPATH)/bin/go-bindata -debug -o $@ in/...
|
||||
|
||||
out/nocompress-memcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
|
||||
$(GOPATH)/bin/go-bindata -nocompress -o $@ in/...
|
||||
|
||||
out/nocompress-nomemcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
|
||||
$(GOPATH)/bin/go-bindata -nocompress -nomemcopy -o $@ in/...
|
||||
|
||||
errcheck:
|
||||
go get github.com/kisielk/errcheck
|
||||
|
||||
go-nyet:
|
||||
go get github.com/barakmich/go-nyet
|
||||
|
||||
golint:
|
||||
go get github.com/golang/lint/golint
|
||||
|
|
121
testdata/out/compress-memcopy.go
vendored
121
testdata/out/compress-memcopy.go
vendored
|
@ -13,7 +13,7 @@ import (
|
|||
"path/filepath"
|
||||
)
|
||||
|
||||
func bindata_read(data []byte, name string) ([]byte, error) {
|
||||
func bindataRead(data []byte, name string) ([]byte, error) {
|
||||
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||||
|
@ -38,108 +38,108 @@ type asset struct {
|
|||
info os.FileInfo
|
||||
}
|
||||
|
||||
type bindata_file_info struct {
|
||||
type bindataFileInfo struct {
|
||||
name string
|
||||
size int64
|
||||
mode os.FileMode
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
func (fi bindata_file_info) Name() string {
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
func (fi bindata_file_info) Size() int64 {
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
func (fi bindata_file_info) Mode() os.FileMode {
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
func (fi bindata_file_info) ModTime() time.Time {
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
func (fi bindata_file_info) IsDir() bool {
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
}
|
||||
func (fi bindata_file_info) Sys() interface{} {
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
var _in_a_test_asset = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00")
|
||||
var _inATestAsset = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00")
|
||||
|
||||
func in_a_test_asset_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
_in_a_test_asset,
|
||||
func inATestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inATestAsset,
|
||||
"in/a/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func in_a_test_asset() (*asset, error) {
|
||||
bytes, err := in_a_test_asset_bytes()
|
||||
func inATestAsset() (*asset, error) {
|
||||
bytes, err := inATestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1431385279, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _in_b_test_asset = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00")
|
||||
var _inBTestAsset = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00")
|
||||
|
||||
func in_b_test_asset_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
_in_b_test_asset,
|
||||
func inBTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inBTestAsset,
|
||||
"in/b/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func in_b_test_asset() (*asset, error) {
|
||||
bytes, err := in_b_test_asset_bytes()
|
||||
func inBTestAsset() (*asset, error) {
|
||||
bytes, err := inBTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/b/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/b/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _in_c_test_asset = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00")
|
||||
var _inCTestAsset = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00")
|
||||
|
||||
func in_c_test_asset_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
_in_c_test_asset,
|
||||
func inCTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inCTestAsset,
|
||||
"in/c/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func in_c_test_asset() (*asset, error) {
|
||||
bytes, err := in_c_test_asset_bytes()
|
||||
func inCTestAsset() (*asset, error) {
|
||||
bytes, err := inCTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/c/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/c/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _in_test_asset = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00")
|
||||
var _inTestAsset = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00")
|
||||
|
||||
func in_test_asset_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
_in_test_asset,
|
||||
func inTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inTestAsset,
|
||||
"in/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func in_test_asset() (*asset, error) {
|
||||
bytes, err := in_test_asset_bytes()
|
||||
func inTestAsset() (*asset, error) {
|
||||
bytes, err := inTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -196,10 +196,10 @@ func AssetNames() []string {
|
|||
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"in/a/test.asset": in_a_test_asset,
|
||||
"in/b/test.asset": in_b_test_asset,
|
||||
"in/c/test.asset": in_c_test_asset,
|
||||
"in/test.asset": in_test_asset,
|
||||
"in/a/test.asset": inATestAsset,
|
||||
"in/b/test.asset": inBTestAsset,
|
||||
"in/c/test.asset": inCTestAsset,
|
||||
"in/test.asset": inTestAsset,
|
||||
}
|
||||
|
||||
// AssetDir returns the file names below a certain
|
||||
|
@ -237,30 +237,30 @@ func AssetDir(name string) ([]string, error) {
|
|||
return rv, nil
|
||||
}
|
||||
|
||||
type _bintree_t struct {
|
||||
type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*_bintree_t
|
||||
Children map[string]*bintree
|
||||
}
|
||||
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"in": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"a": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_a_test_asset, map[string]*_bintree_t{
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"in": &bintree{nil, map[string]*bintree{
|
||||
"a": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inATestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"b": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_b_test_asset, map[string]*_bintree_t{
|
||||
"b": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inBTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"c": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_c_test_asset, map[string]*_bintree_t{
|
||||
"c": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inCTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"test.asset": &_bintree_t{in_test_asset, map[string]*_bintree_t{
|
||||
"test.asset": &bintree{inTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
}}
|
||||
|
||||
// Restore an asset under the given directory
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
|
@ -285,17 +285,18 @@ func RestoreAsset(dir, name string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Restore assets under the given directory recursively
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
if err != nil { // File
|
||||
// File
|
||||
if err != nil {
|
||||
return RestoreAsset(dir, name)
|
||||
} else { // Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
121
testdata/out/compress-nomemcopy.go
vendored
121
testdata/out/compress-nomemcopy.go
vendored
|
@ -15,7 +15,7 @@ import (
|
|||
"path/filepath"
|
||||
)
|
||||
|
||||
func bindata_read(data, name string) ([]byte, error) {
|
||||
func bindataRead(data, name string) ([]byte, error) {
|
||||
var empty [0]byte
|
||||
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
||||
b := empty[:]
|
||||
|
@ -48,108 +48,108 @@ type asset struct {
|
|||
info os.FileInfo
|
||||
}
|
||||
|
||||
type bindata_file_info struct {
|
||||
type bindataFileInfo struct {
|
||||
name string
|
||||
size int64
|
||||
mode os.FileMode
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
func (fi bindata_file_info) Name() string {
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
func (fi bindata_file_info) Size() int64 {
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
func (fi bindata_file_info) Mode() os.FileMode {
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
func (fi bindata_file_info) ModTime() time.Time {
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
func (fi bindata_file_info) IsDir() bool {
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
}
|
||||
func (fi bindata_file_info) Sys() interface{} {
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
var _in_a_test_asset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00"
|
||||
var _inATestAsset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00"
|
||||
|
||||
func in_a_test_asset_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
_in_a_test_asset,
|
||||
func inATestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inATestAsset,
|
||||
"in/a/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func in_a_test_asset() (*asset, error) {
|
||||
bytes, err := in_a_test_asset_bytes()
|
||||
func inATestAsset() (*asset, error) {
|
||||
bytes, err := inATestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1431385279, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _in_b_test_asset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00"
|
||||
var _inBTestAsset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00"
|
||||
|
||||
func in_b_test_asset_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
_in_b_test_asset,
|
||||
func inBTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inBTestAsset,
|
||||
"in/b/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func in_b_test_asset() (*asset, error) {
|
||||
bytes, err := in_b_test_asset_bytes()
|
||||
func inBTestAsset() (*asset, error) {
|
||||
bytes, err := inBTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/b/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/b/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _in_c_test_asset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00"
|
||||
var _inCTestAsset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00"
|
||||
|
||||
func in_c_test_asset_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
_in_c_test_asset,
|
||||
func inCTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inCTestAsset,
|
||||
"in/c/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func in_c_test_asset() (*asset, error) {
|
||||
bytes, err := in_c_test_asset_bytes()
|
||||
func inCTestAsset() (*asset, error) {
|
||||
bytes, err := inCTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/c/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/c/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _in_test_asset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00"
|
||||
var _inTestAsset = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd7\x57\x28\x4e\xcc\x2d\xc8\x49\x55\x48\xcb\xcc\x49\xe5\x02\x04\x00\x00\xff\xff\x8a\x82\x8c\x85\x0f\x00\x00\x00"
|
||||
|
||||
func in_test_asset_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
_in_test_asset,
|
||||
func inTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inTestAsset,
|
||||
"in/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func in_test_asset() (*asset, error) {
|
||||
bytes, err := in_test_asset_bytes()
|
||||
func inTestAsset() (*asset, error) {
|
||||
bytes, err := inTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -206,10 +206,10 @@ func AssetNames() []string {
|
|||
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"in/a/test.asset": in_a_test_asset,
|
||||
"in/b/test.asset": in_b_test_asset,
|
||||
"in/c/test.asset": in_c_test_asset,
|
||||
"in/test.asset": in_test_asset,
|
||||
"in/a/test.asset": inATestAsset,
|
||||
"in/b/test.asset": inBTestAsset,
|
||||
"in/c/test.asset": inCTestAsset,
|
||||
"in/test.asset": inTestAsset,
|
||||
}
|
||||
|
||||
// AssetDir returns the file names below a certain
|
||||
|
@ -247,30 +247,30 @@ func AssetDir(name string) ([]string, error) {
|
|||
return rv, nil
|
||||
}
|
||||
|
||||
type _bintree_t struct {
|
||||
type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*_bintree_t
|
||||
Children map[string]*bintree
|
||||
}
|
||||
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"in": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"a": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_a_test_asset, map[string]*_bintree_t{
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"in": &bintree{nil, map[string]*bintree{
|
||||
"a": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inATestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"b": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_b_test_asset, map[string]*_bintree_t{
|
||||
"b": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inBTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"c": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_c_test_asset, map[string]*_bintree_t{
|
||||
"c": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inCTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"test.asset": &_bintree_t{in_test_asset, map[string]*_bintree_t{
|
||||
"test.asset": &bintree{inTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
}}
|
||||
|
||||
// Restore an asset under the given directory
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
|
@ -295,17 +295,18 @@ func RestoreAsset(dir, name string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Restore assets under the given directory recursively
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
if err != nil { // File
|
||||
// File
|
||||
if err != nil {
|
||||
return RestoreAsset(dir, name)
|
||||
} else { // Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
77
testdata/out/debug.go
vendored
77
testdata/out/debug.go
vendored
|
@ -9,8 +9,8 @@ import (
|
|||
"path/filepath"
|
||||
)
|
||||
|
||||
// bindata_read reads the given file from disk. It returns an error on failure.
|
||||
func bindata_read(path, name string) ([]byte, error) {
|
||||
// bindataRead reads the given file from disk. It returns an error on failure.
|
||||
func bindataRead(path, name string) ([]byte, error) {
|
||||
buf, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset %s at %s: %v", name, path, err)
|
||||
|
@ -23,11 +23,11 @@ type asset struct {
|
|||
info os.FileInfo
|
||||
}
|
||||
|
||||
// in_a_test_asset reads file data from disk. It returns an error on failure.
|
||||
func in_a_test_asset() (*asset, error) {
|
||||
// inATestAsset reads file data from disk. It returns an error on failure.
|
||||
func inATestAsset() (*asset, error) {
|
||||
path := "/Users/tamird/src/go/src/github.com/jteeuwen/go-bindata/testdata/in/a/test.asset"
|
||||
name := "in/a/test.asset"
|
||||
bytes, err := bindata_read(path, name)
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -41,11 +41,11 @@ func in_a_test_asset() (*asset, error) {
|
|||
return a, err
|
||||
}
|
||||
|
||||
// in_b_test_asset reads file data from disk. It returns an error on failure.
|
||||
func in_b_test_asset() (*asset, error) {
|
||||
// inBTestAsset reads file data from disk. It returns an error on failure.
|
||||
func inBTestAsset() (*asset, error) {
|
||||
path := "/Users/tamird/src/go/src/github.com/jteeuwen/go-bindata/testdata/in/b/test.asset"
|
||||
name := "in/b/test.asset"
|
||||
bytes, err := bindata_read(path, name)
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -59,11 +59,11 @@ func in_b_test_asset() (*asset, error) {
|
|||
return a, err
|
||||
}
|
||||
|
||||
// in_c_test_asset reads file data from disk. It returns an error on failure.
|
||||
func in_c_test_asset() (*asset, error) {
|
||||
// inCTestAsset reads file data from disk. It returns an error on failure.
|
||||
func inCTestAsset() (*asset, error) {
|
||||
path := "/Users/tamird/src/go/src/github.com/jteeuwen/go-bindata/testdata/in/c/test.asset"
|
||||
name := "in/c/test.asset"
|
||||
bytes, err := bindata_read(path, name)
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -77,11 +77,11 @@ func in_c_test_asset() (*asset, error) {
|
|||
return a, err
|
||||
}
|
||||
|
||||
// in_test_asset reads file data from disk. It returns an error on failure.
|
||||
func in_test_asset() (*asset, error) {
|
||||
// inTestAsset reads file data from disk. It returns an error on failure.
|
||||
func inTestAsset() (*asset, error) {
|
||||
path := "/Users/tamird/src/go/src/github.com/jteeuwen/go-bindata/testdata/in/test.asset"
|
||||
name := "in/test.asset"
|
||||
bytes, err := bindata_read(path, name)
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -147,10 +147,10 @@ func AssetNames() []string {
|
|||
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"in/a/test.asset": in_a_test_asset,
|
||||
"in/b/test.asset": in_b_test_asset,
|
||||
"in/c/test.asset": in_c_test_asset,
|
||||
"in/test.asset": in_test_asset,
|
||||
"in/a/test.asset": inATestAsset,
|
||||
"in/b/test.asset": inBTestAsset,
|
||||
"in/c/test.asset": inCTestAsset,
|
||||
"in/test.asset": inTestAsset,
|
||||
}
|
||||
|
||||
// AssetDir returns the file names below a certain
|
||||
|
@ -188,30 +188,30 @@ func AssetDir(name string) ([]string, error) {
|
|||
return rv, nil
|
||||
}
|
||||
|
||||
type _bintree_t struct {
|
||||
type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*_bintree_t
|
||||
Children map[string]*bintree
|
||||
}
|
||||
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"in": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"a": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_a_test_asset, map[string]*_bintree_t{
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"in": &bintree{nil, map[string]*bintree{
|
||||
"a": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inATestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"b": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_b_test_asset, map[string]*_bintree_t{
|
||||
"b": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inBTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"c": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_c_test_asset, map[string]*_bintree_t{
|
||||
"c": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inCTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"test.asset": &_bintree_t{in_test_asset, map[string]*_bintree_t{
|
||||
"test.asset": &bintree{inTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
}}
|
||||
|
||||
// Restore an asset under the given directory
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
|
@ -236,17 +236,18 @@ func RestoreAsset(dir, name string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Restore assets under the given directory recursively
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
if err != nil { // File
|
||||
// File
|
||||
if err != nil {
|
||||
return RestoreAsset(dir, name)
|
||||
} else { // Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
111
testdata/out/nocompress-memcopy.go
vendored
111
testdata/out/nocompress-memcopy.go
vendored
|
@ -14,100 +14,100 @@ type asset struct {
|
|||
info os.FileInfo
|
||||
}
|
||||
|
||||
type bindata_file_info struct {
|
||||
type bindataFileInfo struct {
|
||||
name string
|
||||
size int64
|
||||
mode os.FileMode
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
func (fi bindata_file_info) Name() string {
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
func (fi bindata_file_info) Size() int64 {
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
func (fi bindata_file_info) Mode() os.FileMode {
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
func (fi bindata_file_info) ModTime() time.Time {
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
func (fi bindata_file_info) IsDir() bool {
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
}
|
||||
func (fi bindata_file_info) Sys() interface{} {
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
var _in_a_test_asset = []byte(`// sample file
|
||||
var _inATestAsset = []byte(`// sample file
|
||||
`)
|
||||
|
||||
func in_a_test_asset_bytes() ([]byte, error) {
|
||||
return _in_a_test_asset, nil
|
||||
func inATestAssetBytes() ([]byte, error) {
|
||||
return _inATestAsset, nil
|
||||
}
|
||||
|
||||
func in_a_test_asset() (*asset, error) {
|
||||
bytes, err := in_a_test_asset_bytes()
|
||||
func inATestAsset() (*asset, error) {
|
||||
bytes, err := inATestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1431385279, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _in_b_test_asset = []byte(`// sample file
|
||||
var _inBTestAsset = []byte(`// sample file
|
||||
`)
|
||||
|
||||
func in_b_test_asset_bytes() ([]byte, error) {
|
||||
return _in_b_test_asset, nil
|
||||
func inBTestAssetBytes() ([]byte, error) {
|
||||
return _inBTestAsset, nil
|
||||
}
|
||||
|
||||
func in_b_test_asset() (*asset, error) {
|
||||
bytes, err := in_b_test_asset_bytes()
|
||||
func inBTestAsset() (*asset, error) {
|
||||
bytes, err := inBTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/b/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/b/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _in_c_test_asset = []byte(`// sample file
|
||||
var _inCTestAsset = []byte(`// sample file
|
||||
`)
|
||||
|
||||
func in_c_test_asset_bytes() ([]byte, error) {
|
||||
return _in_c_test_asset, nil
|
||||
func inCTestAssetBytes() ([]byte, error) {
|
||||
return _inCTestAsset, nil
|
||||
}
|
||||
|
||||
func in_c_test_asset() (*asset, error) {
|
||||
bytes, err := in_c_test_asset_bytes()
|
||||
func inCTestAsset() (*asset, error) {
|
||||
bytes, err := inCTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/c/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/c/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _in_test_asset = []byte(`// sample file
|
||||
var _inTestAsset = []byte(`// sample file
|
||||
`)
|
||||
|
||||
func in_test_asset_bytes() ([]byte, error) {
|
||||
return _in_test_asset, nil
|
||||
func inTestAssetBytes() ([]byte, error) {
|
||||
return _inTestAsset, nil
|
||||
}
|
||||
|
||||
func in_test_asset() (*asset, error) {
|
||||
bytes, err := in_test_asset_bytes()
|
||||
func inTestAsset() (*asset, error) {
|
||||
bytes, err := inTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -164,10 +164,10 @@ func AssetNames() []string {
|
|||
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"in/a/test.asset": in_a_test_asset,
|
||||
"in/b/test.asset": in_b_test_asset,
|
||||
"in/c/test.asset": in_c_test_asset,
|
||||
"in/test.asset": in_test_asset,
|
||||
"in/a/test.asset": inATestAsset,
|
||||
"in/b/test.asset": inBTestAsset,
|
||||
"in/c/test.asset": inCTestAsset,
|
||||
"in/test.asset": inTestAsset,
|
||||
}
|
||||
|
||||
// AssetDir returns the file names below a certain
|
||||
|
@ -205,30 +205,30 @@ func AssetDir(name string) ([]string, error) {
|
|||
return rv, nil
|
||||
}
|
||||
|
||||
type _bintree_t struct {
|
||||
type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*_bintree_t
|
||||
Children map[string]*bintree
|
||||
}
|
||||
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"in": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"a": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_a_test_asset, map[string]*_bintree_t{
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"in": &bintree{nil, map[string]*bintree{
|
||||
"a": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inATestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"b": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_b_test_asset, map[string]*_bintree_t{
|
||||
"b": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inBTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"c": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_c_test_asset, map[string]*_bintree_t{
|
||||
"c": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inCTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"test.asset": &_bintree_t{in_test_asset, map[string]*_bintree_t{
|
||||
"test.asset": &bintree{inTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
}}
|
||||
|
||||
// Restore an asset under the given directory
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
|
@ -253,17 +253,18 @@ func RestoreAsset(dir, name string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Restore assets under the given directory recursively
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
if err != nil { // File
|
||||
// File
|
||||
if err != nil {
|
||||
return RestoreAsset(dir, name)
|
||||
} else { // Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
121
testdata/out/nocompress-nomemcopy.go
vendored
121
testdata/out/nocompress-nomemcopy.go
vendored
|
@ -12,7 +12,7 @@ import (
|
|||
"path/filepath"
|
||||
)
|
||||
|
||||
func bindata_read(data, name string) ([]byte, error) {
|
||||
func bindataRead(data, name string) ([]byte, error) {
|
||||
var empty [0]byte
|
||||
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
||||
b := empty[:]
|
||||
|
@ -28,108 +28,108 @@ type asset struct {
|
|||
info os.FileInfo
|
||||
}
|
||||
|
||||
type bindata_file_info struct {
|
||||
type bindataFileInfo struct {
|
||||
name string
|
||||
size int64
|
||||
mode os.FileMode
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
func (fi bindata_file_info) Name() string {
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
func (fi bindata_file_info) Size() int64 {
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
func (fi bindata_file_info) Mode() os.FileMode {
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
func (fi bindata_file_info) ModTime() time.Time {
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
func (fi bindata_file_info) IsDir() bool {
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
}
|
||||
func (fi bindata_file_info) Sys() interface{} {
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
var _in_a_test_asset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a"
|
||||
var _inATestAsset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a"
|
||||
|
||||
func in_a_test_asset_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
_in_a_test_asset,
|
||||
func inATestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inATestAsset,
|
||||
"in/a/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func in_a_test_asset() (*asset, error) {
|
||||
bytes, err := in_a_test_asset_bytes()
|
||||
func inATestAsset() (*asset, error) {
|
||||
bytes, err := inATestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1431385279, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _in_b_test_asset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a"
|
||||
var _inBTestAsset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a"
|
||||
|
||||
func in_b_test_asset_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
_in_b_test_asset,
|
||||
func inBTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inBTestAsset,
|
||||
"in/b/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func in_b_test_asset() (*asset, error) {
|
||||
bytes, err := in_b_test_asset_bytes()
|
||||
func inBTestAsset() (*asset, error) {
|
||||
bytes, err := inBTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/b/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/b/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _in_c_test_asset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a"
|
||||
var _inCTestAsset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a"
|
||||
|
||||
func in_c_test_asset_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
_in_c_test_asset,
|
||||
func inCTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inCTestAsset,
|
||||
"in/c/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func in_c_test_asset() (*asset, error) {
|
||||
bytes, err := in_c_test_asset_bytes()
|
||||
func inCTestAsset() (*asset, error) {
|
||||
bytes, err := inCTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/c/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/c/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _in_test_asset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a"
|
||||
var _inTestAsset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a"
|
||||
|
||||
func in_test_asset_bytes() ([]byte, error) {
|
||||
return bindata_read(
|
||||
_in_test_asset,
|
||||
func inTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inTestAsset,
|
||||
"in/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func in_test_asset() (*asset, error) {
|
||||
bytes, err := in_test_asset_bytes()
|
||||
func inTestAsset() (*asset, error) {
|
||||
bytes, err := inTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindata_file_info{name: "in/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
info := bindataFileInfo{name: "in/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
@ -186,10 +186,10 @@ func AssetNames() []string {
|
|||
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"in/a/test.asset": in_a_test_asset,
|
||||
"in/b/test.asset": in_b_test_asset,
|
||||
"in/c/test.asset": in_c_test_asset,
|
||||
"in/test.asset": in_test_asset,
|
||||
"in/a/test.asset": inATestAsset,
|
||||
"in/b/test.asset": inBTestAsset,
|
||||
"in/c/test.asset": inCTestAsset,
|
||||
"in/test.asset": inTestAsset,
|
||||
}
|
||||
|
||||
// AssetDir returns the file names below a certain
|
||||
|
@ -227,30 +227,30 @@ func AssetDir(name string) ([]string, error) {
|
|||
return rv, nil
|
||||
}
|
||||
|
||||
type _bintree_t struct {
|
||||
type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*_bintree_t
|
||||
Children map[string]*bintree
|
||||
}
|
||||
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"in": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"a": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_a_test_asset, map[string]*_bintree_t{
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"in": &bintree{nil, map[string]*bintree{
|
||||
"a": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inATestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"b": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_b_test_asset, map[string]*_bintree_t{
|
||||
"b": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inBTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"c": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_c_test_asset, map[string]*_bintree_t{
|
||||
"c": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inCTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
"test.asset": &_bintree_t{in_test_asset, map[string]*_bintree_t{
|
||||
"test.asset": &bintree{inTestAsset, map[string]*bintree{
|
||||
}},
|
||||
}},
|
||||
}}
|
||||
|
||||
// Restore an asset under the given directory
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
|
@ -275,17 +275,18 @@ func RestoreAsset(dir, name string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Restore assets under the given directory recursively
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
if err != nil { // File
|
||||
// File
|
||||
if err != nil {
|
||||
return RestoreAsset(dir, name)
|
||||
} else { // Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
6
toc.go
6
toc.go
|
@ -53,7 +53,7 @@ func (root *assetTree) funcOrNil() string {
|
|||
}
|
||||
|
||||
func (root *assetTree) writeGoMap(w io.Writer, nident int) {
|
||||
fmt.Fprintf(w, "&_bintree_t{%s, map[string]*_bintree_t{\n", root.funcOrNil())
|
||||
fmt.Fprintf(w, "&bintree{%s, map[string]*bintree{\n", root.funcOrNil())
|
||||
|
||||
// Sort to make output stable between invocations
|
||||
filenames := make([]string, len(root.Children))
|
||||
|
@ -78,9 +78,9 @@ func (root *assetTree) writeGoMap(w io.Writer, nident int) {
|
|||
}
|
||||
|
||||
func (root *assetTree) WriteAsGoMap(w io.Writer) error {
|
||||
_, err := fmt.Fprint(w, `type _bintree_t struct {
|
||||
_, err := fmt.Fprint(w, `type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*_bintree_t
|
||||
Children map[string]*bintree
|
||||
}
|
||||
var _bintree = `)
|
||||
root.writeGoMap(w, 0)
|
||||
|
|
Loading…
Reference in New Issue
Block a user