commit
eb01a153be
26
Makefile
26
Makefile
|
@ -1,24 +1,2 @@
|
||||||
all: regen check
|
all:
|
||||||
|
make -C testdata
|
||||||
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
|
|
||||||
|
|
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
|
// also compares against a known list of functions to
|
||||||
// prevent conflict based on name translation.
|
// prevent conflict based on name translation.
|
||||||
func safeFunctionName(name string, knownFuncs map[string]int) string {
|
func safeFunctionName(name string, knownFuncs map[string]int) string {
|
||||||
|
var inBytes, outBytes []byte
|
||||||
|
|
||||||
name = strings.ToLower(name)
|
name = strings.ToLower(name)
|
||||||
name = regFuncName.ReplaceAllString(name, "_")
|
inBytes = []byte(name)
|
||||||
|
|
||||||
// Get rid of "__" instances for niceness.
|
for i := 0; i < len(inBytes); i++ {
|
||||||
for strings.Index(name, "__") > -1 {
|
if regFuncName.Match([]byte{inBytes[i]}) {
|
||||||
name = strings.Replace(name, "__", "_", -1)
|
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)).
|
name = string(outBytes)
|
||||||
for len(name) > 1 && name[0] == '_' {
|
|
||||||
name = name[1:]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Identifier can't start with a digit.
|
// Identifier can't start with a digit.
|
||||||
if unicode.IsDigit(rune(name[0])) {
|
if unicode.IsDigit(rune(name[0])) {
|
||||||
|
|
6
debug.go
6
debug.go
|
@ -38,8 +38,8 @@ func writeDebugHeader(w io.Writer) error {
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// bindata_read reads the given file from disk. It returns an error on failure.
|
// bindataRead reads the given file from disk. It returns an error on failure.
|
||||||
func bindata_read(path, name string) ([]byte, error) {
|
func bindataRead(path, name string) ([]byte, error) {
|
||||||
buf, err := ioutil.ReadFile(path)
|
buf, err := ioutil.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("Error reading asset %%s at %%s: %%v", name, path, err)
|
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) {
|
func %s() (*asset, error) {
|
||||||
path := %s
|
path := %s
|
||||||
name := %q
|
name := %q
|
||||||
bytes, err := bindata_read(path, name)
|
bytes, err := bindataRead(path, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
38
release.go
38
release.go
|
@ -113,7 +113,7 @@ func header_compressed_nomemcopy(w io.Writer) error {
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func bindata_read(data, name string) ([]byte, error) {
|
func bindataRead(data, name string) ([]byte, error) {
|
||||||
var empty [0]byte
|
var empty [0]byte
|
||||||
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
||||||
b := empty[:]
|
b := empty[:]
|
||||||
|
@ -159,7 +159,7 @@ func header_compressed_memcopy(w io.Writer) error {
|
||||||
"path/filepath"
|
"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))
|
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Read %%q: %%v", name, err)
|
return nil, fmt.Errorf("Read %%q: %%v", name, err)
|
||||||
|
@ -196,7 +196,7 @@ func header_uncompressed_nomemcopy(w io.Writer) error {
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func bindata_read(data, name string) ([]byte, error) {
|
func bindataRead(data, name string) ([]byte, error) {
|
||||||
var empty [0]byte
|
var empty [0]byte
|
||||||
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
||||||
b := empty[:]
|
b := empty[:]
|
||||||
|
@ -231,29 +231,29 @@ func header_release_common(w io.Writer) error {
|
||||||
info os.FileInfo
|
info os.FileInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
type bindata_file_info struct {
|
type bindataFileInfo struct {
|
||||||
name string
|
name string
|
||||||
size int64
|
size int64
|
||||||
mode os.FileMode
|
mode os.FileMode
|
||||||
modTime time.Time
|
modTime time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fi bindata_file_info) Name() string {
|
func (fi bindataFileInfo) Name() string {
|
||||||
return fi.name
|
return fi.name
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Size() int64 {
|
func (fi bindataFileInfo) Size() int64 {
|
||||||
return fi.size
|
return fi.size
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Mode() os.FileMode {
|
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||||
return fi.mode
|
return fi.mode
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) ModTime() time.Time {
|
func (fi bindataFileInfo) ModTime() time.Time {
|
||||||
return fi.modTime
|
return fi.modTime
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) IsDir() bool {
|
func (fi bindataFileInfo) IsDir() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Sys() interface{} {
|
func (fi bindataFileInfo) Sys() interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,8 +277,8 @@ func compressed_nomemcopy(w io.Writer, asset *Asset, r io.Reader) error {
|
||||||
|
|
||||||
_, err = fmt.Fprintf(w, `"
|
_, err = fmt.Fprintf(w, `"
|
||||||
|
|
||||||
func %s_bytes() ([]byte, error) {
|
func %sBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_%s,
|
_%s,
|
||||||
%q,
|
%q,
|
||||||
)
|
)
|
||||||
|
@ -304,8 +304,8 @@ func compressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error {
|
||||||
|
|
||||||
_, err = fmt.Fprintf(w, `")
|
_, err = fmt.Fprintf(w, `")
|
||||||
|
|
||||||
func %s_bytes() ([]byte, error) {
|
func %sBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_%s,
|
_%s,
|
||||||
%q,
|
%q,
|
||||||
)
|
)
|
||||||
|
@ -328,8 +328,8 @@ func uncompressed_nomemcopy(w io.Writer, asset *Asset, r io.Reader) error {
|
||||||
|
|
||||||
_, err = fmt.Fprintf(w, `"
|
_, err = fmt.Fprintf(w, `"
|
||||||
|
|
||||||
func %s_bytes() ([]byte, error) {
|
func %sBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_%s,
|
_%s,
|
||||||
%q,
|
%q,
|
||||||
)
|
)
|
||||||
|
@ -357,7 +357,7 @@ func uncompressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error {
|
||||||
|
|
||||||
_, err = fmt.Fprintf(w, `)
|
_, err = fmt.Fprintf(w, `)
|
||||||
|
|
||||||
func %s_bytes() ([]byte, error) {
|
func %sBytes() ([]byte, error) {
|
||||||
return _%s, nil
|
return _%s, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,12 +381,12 @@ func asset_release_common(w io.Writer, c *Config, asset *Asset) error {
|
||||||
modTime = c.ModTime
|
modTime = c.ModTime
|
||||||
}
|
}
|
||||||
_, err = fmt.Fprintf(w, `func %s() (*asset, error) {
|
_, err = fmt.Fprintf(w, `func %s() (*asset, error) {
|
||||||
bytes, err := %s_bytes()
|
bytes, err := %sBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
11
restore.go
11
restore.go
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
func writeRestore(w io.Writer) error {
|
func writeRestore(w io.Writer) error {
|
||||||
_, err := fmt.Fprintf(w, `
|
_, 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 {
|
func RestoreAsset(dir, name string) error {
|
||||||
data, err := Asset(name)
|
data, err := Asset(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -36,19 +36,20 @@ func RestoreAsset(dir, name string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore assets under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
if err != nil { // File
|
// File
|
||||||
|
if err != nil {
|
||||||
return RestoreAsset(dir, name)
|
return RestoreAsset(dir, name)
|
||||||
} else { // Dir
|
}
|
||||||
|
// Dir
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
38
testdata/Makefile
vendored
38
testdata/Makefile
vendored
|
@ -1,6 +1,32 @@
|
||||||
regen:
|
.PHONY: check
|
||||||
go-bindata -o out/compress-memcopy.go in/...
|
check: out/compress-memcopy.go out/compress-nomemcopy.go out/debug.go out/nocompress-memcopy.go out/nocompress-nomemcopy.go errcheck go-nyet golint
|
||||||
go-bindata -nomemcopy -o out/compress-nomemcopy.go in/...
|
$(foreach file, $(wildcard out/*.go), errcheck $(file);)
|
||||||
go-bindata -debug -o out/debug.go in/...
|
$(foreach file, $(wildcard out/*.go), go-nyet $(file);)
|
||||||
go-bindata -nocompress -o out/nocompress-memcopy.go in/...
|
$(foreach file, $(wildcard out/*.go), golint $(file);)
|
||||||
go-bindata -nocompress -nomemcopy -o out/nocompress-nomemcopy.go in/...
|
|
||||||
|
$(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
|
||||||
|
|
113
testdata/out/compress-memcopy.go
vendored
113
testdata/out/compress-memcopy.go
vendored
|
@ -13,7 +13,7 @@ import (
|
||||||
"path/filepath"
|
"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))
|
gz, err := gzip.NewReader(bytes.NewBuffer(data))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Read %q: %v", name, err)
|
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||||||
|
@ -38,108 +38,108 @@ type asset struct {
|
||||||
info os.FileInfo
|
info os.FileInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
type bindata_file_info struct {
|
type bindataFileInfo struct {
|
||||||
name string
|
name string
|
||||||
size int64
|
size int64
|
||||||
mode os.FileMode
|
mode os.FileMode
|
||||||
modTime time.Time
|
modTime time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fi bindata_file_info) Name() string {
|
func (fi bindataFileInfo) Name() string {
|
||||||
return fi.name
|
return fi.name
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Size() int64 {
|
func (fi bindataFileInfo) Size() int64 {
|
||||||
return fi.size
|
return fi.size
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Mode() os.FileMode {
|
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||||
return fi.mode
|
return fi.mode
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) ModTime() time.Time {
|
func (fi bindataFileInfo) ModTime() time.Time {
|
||||||
return fi.modTime
|
return fi.modTime
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) IsDir() bool {
|
func (fi bindataFileInfo) IsDir() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Sys() interface{} {
|
func (fi bindataFileInfo) Sys() interface{} {
|
||||||
return nil
|
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) {
|
func inATestAssetBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_in_a_test_asset,
|
_inATestAsset,
|
||||||
"in/a/test.asset",
|
"in/a/test.asset",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_a_test_asset() (*asset, error) {
|
func inATestAsset() (*asset, error) {
|
||||||
bytes, err := in_a_test_asset_bytes()
|
bytes, err := inATestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
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) {
|
func inBTestAssetBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_in_b_test_asset,
|
_inBTestAsset,
|
||||||
"in/b/test.asset",
|
"in/b/test.asset",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_b_test_asset() (*asset, error) {
|
func inBTestAsset() (*asset, error) {
|
||||||
bytes, err := in_b_test_asset_bytes()
|
bytes, err := inBTestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
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) {
|
func inCTestAssetBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_in_c_test_asset,
|
_inCTestAsset,
|
||||||
"in/c/test.asset",
|
"in/c/test.asset",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_c_test_asset() (*asset, error) {
|
func inCTestAsset() (*asset, error) {
|
||||||
bytes, err := in_c_test_asset_bytes()
|
bytes, err := inCTestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
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) {
|
func inTestAssetBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_in_test_asset,
|
_inTestAsset,
|
||||||
"in/test.asset",
|
"in/test.asset",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_test_asset() (*asset, error) {
|
func inTestAsset() (*asset, error) {
|
||||||
bytes, err := in_test_asset_bytes()
|
bytes, err := inTestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
@ -196,10 +196,10 @@ func AssetNames() []string {
|
||||||
|
|
||||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||||
var _bindata = map[string]func() (*asset, error){
|
var _bindata = map[string]func() (*asset, error){
|
||||||
"in/a/test.asset": in_a_test_asset,
|
"in/a/test.asset": inATestAsset,
|
||||||
"in/b/test.asset": in_b_test_asset,
|
"in/b/test.asset": inBTestAsset,
|
||||||
"in/c/test.asset": in_c_test_asset,
|
"in/c/test.asset": inCTestAsset,
|
||||||
"in/test.asset": in_test_asset,
|
"in/test.asset": inTestAsset,
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssetDir returns the file names below a certain
|
// AssetDir returns the file names below a certain
|
||||||
|
@ -237,30 +237,30 @@ func AssetDir(name string) ([]string, error) {
|
||||||
return rv, nil
|
return rv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type _bintree_t struct {
|
type bintree struct {
|
||||||
Func func() (*asset, error)
|
Func func() (*asset, error)
|
||||||
Children map[string]*_bintree_t
|
Children map[string]*bintree
|
||||||
}
|
}
|
||||||
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
|
var _bintree = &bintree{nil, map[string]*bintree{
|
||||||
"in": &_bintree_t{nil, map[string]*_bintree_t{
|
"in": &bintree{nil, map[string]*bintree{
|
||||||
"a": &_bintree_t{nil, map[string]*_bintree_t{
|
"a": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_a_test_asset, map[string]*_bintree_t{
|
"test.asset": &bintree{inATestAsset, map[string]*bintree{
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
"b": &_bintree_t{nil, map[string]*_bintree_t{
|
"b": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_b_test_asset, map[string]*_bintree_t{
|
"test.asset": &bintree{inBTestAsset, map[string]*bintree{
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
"c": &_bintree_t{nil, map[string]*_bintree_t{
|
"c": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_c_test_asset, map[string]*_bintree_t{
|
"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 {
|
func RestoreAsset(dir, name string) error {
|
||||||
data, err := Asset(name)
|
data, err := Asset(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -285,19 +285,20 @@ func RestoreAsset(dir, name string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore assets under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
if err != nil { // File
|
// File
|
||||||
|
if err != nil {
|
||||||
return RestoreAsset(dir, name)
|
return RestoreAsset(dir, name)
|
||||||
} else { // Dir
|
}
|
||||||
|
// Dir
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
113
testdata/out/compress-nomemcopy.go
vendored
113
testdata/out/compress-nomemcopy.go
vendored
|
@ -15,7 +15,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func bindata_read(data, name string) ([]byte, error) {
|
func bindataRead(data, name string) ([]byte, error) {
|
||||||
var empty [0]byte
|
var empty [0]byte
|
||||||
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
||||||
b := empty[:]
|
b := empty[:]
|
||||||
|
@ -48,108 +48,108 @@ type asset struct {
|
||||||
info os.FileInfo
|
info os.FileInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
type bindata_file_info struct {
|
type bindataFileInfo struct {
|
||||||
name string
|
name string
|
||||||
size int64
|
size int64
|
||||||
mode os.FileMode
|
mode os.FileMode
|
||||||
modTime time.Time
|
modTime time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fi bindata_file_info) Name() string {
|
func (fi bindataFileInfo) Name() string {
|
||||||
return fi.name
|
return fi.name
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Size() int64 {
|
func (fi bindataFileInfo) Size() int64 {
|
||||||
return fi.size
|
return fi.size
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Mode() os.FileMode {
|
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||||
return fi.mode
|
return fi.mode
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) ModTime() time.Time {
|
func (fi bindataFileInfo) ModTime() time.Time {
|
||||||
return fi.modTime
|
return fi.modTime
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) IsDir() bool {
|
func (fi bindataFileInfo) IsDir() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Sys() interface{} {
|
func (fi bindataFileInfo) Sys() interface{} {
|
||||||
return nil
|
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) {
|
func inATestAssetBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_in_a_test_asset,
|
_inATestAsset,
|
||||||
"in/a/test.asset",
|
"in/a/test.asset",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_a_test_asset() (*asset, error) {
|
func inATestAsset() (*asset, error) {
|
||||||
bytes, err := in_a_test_asset_bytes()
|
bytes, err := inATestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
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) {
|
func inBTestAssetBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_in_b_test_asset,
|
_inBTestAsset,
|
||||||
"in/b/test.asset",
|
"in/b/test.asset",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_b_test_asset() (*asset, error) {
|
func inBTestAsset() (*asset, error) {
|
||||||
bytes, err := in_b_test_asset_bytes()
|
bytes, err := inBTestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
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) {
|
func inCTestAssetBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_in_c_test_asset,
|
_inCTestAsset,
|
||||||
"in/c/test.asset",
|
"in/c/test.asset",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_c_test_asset() (*asset, error) {
|
func inCTestAsset() (*asset, error) {
|
||||||
bytes, err := in_c_test_asset_bytes()
|
bytes, err := inCTestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
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) {
|
func inTestAssetBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_in_test_asset,
|
_inTestAsset,
|
||||||
"in/test.asset",
|
"in/test.asset",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_test_asset() (*asset, error) {
|
func inTestAsset() (*asset, error) {
|
||||||
bytes, err := in_test_asset_bytes()
|
bytes, err := inTestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
@ -206,10 +206,10 @@ func AssetNames() []string {
|
||||||
|
|
||||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||||
var _bindata = map[string]func() (*asset, error){
|
var _bindata = map[string]func() (*asset, error){
|
||||||
"in/a/test.asset": in_a_test_asset,
|
"in/a/test.asset": inATestAsset,
|
||||||
"in/b/test.asset": in_b_test_asset,
|
"in/b/test.asset": inBTestAsset,
|
||||||
"in/c/test.asset": in_c_test_asset,
|
"in/c/test.asset": inCTestAsset,
|
||||||
"in/test.asset": in_test_asset,
|
"in/test.asset": inTestAsset,
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssetDir returns the file names below a certain
|
// AssetDir returns the file names below a certain
|
||||||
|
@ -247,30 +247,30 @@ func AssetDir(name string) ([]string, error) {
|
||||||
return rv, nil
|
return rv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type _bintree_t struct {
|
type bintree struct {
|
||||||
Func func() (*asset, error)
|
Func func() (*asset, error)
|
||||||
Children map[string]*_bintree_t
|
Children map[string]*bintree
|
||||||
}
|
}
|
||||||
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
|
var _bintree = &bintree{nil, map[string]*bintree{
|
||||||
"in": &_bintree_t{nil, map[string]*_bintree_t{
|
"in": &bintree{nil, map[string]*bintree{
|
||||||
"a": &_bintree_t{nil, map[string]*_bintree_t{
|
"a": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_a_test_asset, map[string]*_bintree_t{
|
"test.asset": &bintree{inATestAsset, map[string]*bintree{
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
"b": &_bintree_t{nil, map[string]*_bintree_t{
|
"b": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_b_test_asset, map[string]*_bintree_t{
|
"test.asset": &bintree{inBTestAsset, map[string]*bintree{
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
"c": &_bintree_t{nil, map[string]*_bintree_t{
|
"c": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_c_test_asset, map[string]*_bintree_t{
|
"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 {
|
func RestoreAsset(dir, name string) error {
|
||||||
data, err := Asset(name)
|
data, err := Asset(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -295,19 +295,20 @@ func RestoreAsset(dir, name string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore assets under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
if err != nil { // File
|
// File
|
||||||
|
if err != nil {
|
||||||
return RestoreAsset(dir, name)
|
return RestoreAsset(dir, name)
|
||||||
} else { // Dir
|
}
|
||||||
|
// Dir
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
69
testdata/out/debug.go
vendored
69
testdata/out/debug.go
vendored
|
@ -9,8 +9,8 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// bindata_read reads the given file from disk. It returns an error on failure.
|
// bindataRead reads the given file from disk. It returns an error on failure.
|
||||||
func bindata_read(path, name string) ([]byte, error) {
|
func bindataRead(path, name string) ([]byte, error) {
|
||||||
buf, err := ioutil.ReadFile(path)
|
buf, err := ioutil.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("Error reading asset %s at %s: %v", name, path, err)
|
err = fmt.Errorf("Error reading asset %s at %s: %v", name, path, err)
|
||||||
|
@ -23,11 +23,11 @@ type asset struct {
|
||||||
info os.FileInfo
|
info os.FileInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// in_a_test_asset reads file data from disk. It returns an error on failure.
|
// inATestAsset reads file data from disk. It returns an error on failure.
|
||||||
func in_a_test_asset() (*asset, error) {
|
func inATestAsset() (*asset, error) {
|
||||||
path := "/Users/tamird/src/go/src/github.com/jteeuwen/go-bindata/testdata/in/a/test.asset"
|
path := "/Users/tamird/src/go/src/github.com/jteeuwen/go-bindata/testdata/in/a/test.asset"
|
||||||
name := "in/a/test.asset"
|
name := "in/a/test.asset"
|
||||||
bytes, err := bindata_read(path, name)
|
bytes, err := bindataRead(path, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -41,11 +41,11 @@ func in_a_test_asset() (*asset, error) {
|
||||||
return a, err
|
return a, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// in_b_test_asset reads file data from disk. It returns an error on failure.
|
// inBTestAsset reads file data from disk. It returns an error on failure.
|
||||||
func in_b_test_asset() (*asset, error) {
|
func inBTestAsset() (*asset, error) {
|
||||||
path := "/Users/tamird/src/go/src/github.com/jteeuwen/go-bindata/testdata/in/b/test.asset"
|
path := "/Users/tamird/src/go/src/github.com/jteeuwen/go-bindata/testdata/in/b/test.asset"
|
||||||
name := "in/b/test.asset"
|
name := "in/b/test.asset"
|
||||||
bytes, err := bindata_read(path, name)
|
bytes, err := bindataRead(path, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -59,11 +59,11 @@ func in_b_test_asset() (*asset, error) {
|
||||||
return a, err
|
return a, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// in_c_test_asset reads file data from disk. It returns an error on failure.
|
// inCTestAsset reads file data from disk. It returns an error on failure.
|
||||||
func in_c_test_asset() (*asset, error) {
|
func inCTestAsset() (*asset, error) {
|
||||||
path := "/Users/tamird/src/go/src/github.com/jteeuwen/go-bindata/testdata/in/c/test.asset"
|
path := "/Users/tamird/src/go/src/github.com/jteeuwen/go-bindata/testdata/in/c/test.asset"
|
||||||
name := "in/c/test.asset"
|
name := "in/c/test.asset"
|
||||||
bytes, err := bindata_read(path, name)
|
bytes, err := bindataRead(path, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -77,11 +77,11 @@ func in_c_test_asset() (*asset, error) {
|
||||||
return a, err
|
return a, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// in_test_asset reads file data from disk. It returns an error on failure.
|
// inTestAsset reads file data from disk. It returns an error on failure.
|
||||||
func in_test_asset() (*asset, error) {
|
func inTestAsset() (*asset, error) {
|
||||||
path := "/Users/tamird/src/go/src/github.com/jteeuwen/go-bindata/testdata/in/test.asset"
|
path := "/Users/tamird/src/go/src/github.com/jteeuwen/go-bindata/testdata/in/test.asset"
|
||||||
name := "in/test.asset"
|
name := "in/test.asset"
|
||||||
bytes, err := bindata_read(path, name)
|
bytes, err := bindataRead(path, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -147,10 +147,10 @@ func AssetNames() []string {
|
||||||
|
|
||||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||||
var _bindata = map[string]func() (*asset, error){
|
var _bindata = map[string]func() (*asset, error){
|
||||||
"in/a/test.asset": in_a_test_asset,
|
"in/a/test.asset": inATestAsset,
|
||||||
"in/b/test.asset": in_b_test_asset,
|
"in/b/test.asset": inBTestAsset,
|
||||||
"in/c/test.asset": in_c_test_asset,
|
"in/c/test.asset": inCTestAsset,
|
||||||
"in/test.asset": in_test_asset,
|
"in/test.asset": inTestAsset,
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssetDir returns the file names below a certain
|
// AssetDir returns the file names below a certain
|
||||||
|
@ -188,30 +188,30 @@ func AssetDir(name string) ([]string, error) {
|
||||||
return rv, nil
|
return rv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type _bintree_t struct {
|
type bintree struct {
|
||||||
Func func() (*asset, error)
|
Func func() (*asset, error)
|
||||||
Children map[string]*_bintree_t
|
Children map[string]*bintree
|
||||||
}
|
}
|
||||||
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
|
var _bintree = &bintree{nil, map[string]*bintree{
|
||||||
"in": &_bintree_t{nil, map[string]*_bintree_t{
|
"in": &bintree{nil, map[string]*bintree{
|
||||||
"a": &_bintree_t{nil, map[string]*_bintree_t{
|
"a": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_a_test_asset, map[string]*_bintree_t{
|
"test.asset": &bintree{inATestAsset, map[string]*bintree{
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
"b": &_bintree_t{nil, map[string]*_bintree_t{
|
"b": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_b_test_asset, map[string]*_bintree_t{
|
"test.asset": &bintree{inBTestAsset, map[string]*bintree{
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
"c": &_bintree_t{nil, map[string]*_bintree_t{
|
"c": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_c_test_asset, map[string]*_bintree_t{
|
"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 {
|
func RestoreAsset(dir, name string) error {
|
||||||
data, err := Asset(name)
|
data, err := Asset(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -236,19 +236,20 @@ func RestoreAsset(dir, name string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore assets under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
if err != nil { // File
|
// File
|
||||||
|
if err != nil {
|
||||||
return RestoreAsset(dir, name)
|
return RestoreAsset(dir, name)
|
||||||
} else { // Dir
|
}
|
||||||
|
// Dir
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
103
testdata/out/nocompress-memcopy.go
vendored
103
testdata/out/nocompress-memcopy.go
vendored
|
@ -14,100 +14,100 @@ type asset struct {
|
||||||
info os.FileInfo
|
info os.FileInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
type bindata_file_info struct {
|
type bindataFileInfo struct {
|
||||||
name string
|
name string
|
||||||
size int64
|
size int64
|
||||||
mode os.FileMode
|
mode os.FileMode
|
||||||
modTime time.Time
|
modTime time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fi bindata_file_info) Name() string {
|
func (fi bindataFileInfo) Name() string {
|
||||||
return fi.name
|
return fi.name
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Size() int64 {
|
func (fi bindataFileInfo) Size() int64 {
|
||||||
return fi.size
|
return fi.size
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Mode() os.FileMode {
|
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||||
return fi.mode
|
return fi.mode
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) ModTime() time.Time {
|
func (fi bindataFileInfo) ModTime() time.Time {
|
||||||
return fi.modTime
|
return fi.modTime
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) IsDir() bool {
|
func (fi bindataFileInfo) IsDir() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Sys() interface{} {
|
func (fi bindataFileInfo) Sys() interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _in_a_test_asset = []byte(`// sample file
|
var _inATestAsset = []byte(`// sample file
|
||||||
`)
|
`)
|
||||||
|
|
||||||
func in_a_test_asset_bytes() ([]byte, error) {
|
func inATestAssetBytes() ([]byte, error) {
|
||||||
return _in_a_test_asset, nil
|
return _inATestAsset, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_a_test_asset() (*asset, error) {
|
func inATestAsset() (*asset, error) {
|
||||||
bytes, err := in_a_test_asset_bytes()
|
bytes, err := inATestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _in_b_test_asset = []byte(`// sample file
|
var _inBTestAsset = []byte(`// sample file
|
||||||
`)
|
`)
|
||||||
|
|
||||||
func in_b_test_asset_bytes() ([]byte, error) {
|
func inBTestAssetBytes() ([]byte, error) {
|
||||||
return _in_b_test_asset, nil
|
return _inBTestAsset, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_b_test_asset() (*asset, error) {
|
func inBTestAsset() (*asset, error) {
|
||||||
bytes, err := in_b_test_asset_bytes()
|
bytes, err := inBTestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _in_c_test_asset = []byte(`// sample file
|
var _inCTestAsset = []byte(`// sample file
|
||||||
`)
|
`)
|
||||||
|
|
||||||
func in_c_test_asset_bytes() ([]byte, error) {
|
func inCTestAssetBytes() ([]byte, error) {
|
||||||
return _in_c_test_asset, nil
|
return _inCTestAsset, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_c_test_asset() (*asset, error) {
|
func inCTestAsset() (*asset, error) {
|
||||||
bytes, err := in_c_test_asset_bytes()
|
bytes, err := inCTestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _in_test_asset = []byte(`// sample file
|
var _inTestAsset = []byte(`// sample file
|
||||||
`)
|
`)
|
||||||
|
|
||||||
func in_test_asset_bytes() ([]byte, error) {
|
func inTestAssetBytes() ([]byte, error) {
|
||||||
return _in_test_asset, nil
|
return _inTestAsset, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_test_asset() (*asset, error) {
|
func inTestAsset() (*asset, error) {
|
||||||
bytes, err := in_test_asset_bytes()
|
bytes, err := inTestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
@ -164,10 +164,10 @@ func AssetNames() []string {
|
||||||
|
|
||||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||||
var _bindata = map[string]func() (*asset, error){
|
var _bindata = map[string]func() (*asset, error){
|
||||||
"in/a/test.asset": in_a_test_asset,
|
"in/a/test.asset": inATestAsset,
|
||||||
"in/b/test.asset": in_b_test_asset,
|
"in/b/test.asset": inBTestAsset,
|
||||||
"in/c/test.asset": in_c_test_asset,
|
"in/c/test.asset": inCTestAsset,
|
||||||
"in/test.asset": in_test_asset,
|
"in/test.asset": inTestAsset,
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssetDir returns the file names below a certain
|
// AssetDir returns the file names below a certain
|
||||||
|
@ -205,30 +205,30 @@ func AssetDir(name string) ([]string, error) {
|
||||||
return rv, nil
|
return rv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type _bintree_t struct {
|
type bintree struct {
|
||||||
Func func() (*asset, error)
|
Func func() (*asset, error)
|
||||||
Children map[string]*_bintree_t
|
Children map[string]*bintree
|
||||||
}
|
}
|
||||||
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
|
var _bintree = &bintree{nil, map[string]*bintree{
|
||||||
"in": &_bintree_t{nil, map[string]*_bintree_t{
|
"in": &bintree{nil, map[string]*bintree{
|
||||||
"a": &_bintree_t{nil, map[string]*_bintree_t{
|
"a": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_a_test_asset, map[string]*_bintree_t{
|
"test.asset": &bintree{inATestAsset, map[string]*bintree{
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
"b": &_bintree_t{nil, map[string]*_bintree_t{
|
"b": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_b_test_asset, map[string]*_bintree_t{
|
"test.asset": &bintree{inBTestAsset, map[string]*bintree{
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
"c": &_bintree_t{nil, map[string]*_bintree_t{
|
"c": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_c_test_asset, map[string]*_bintree_t{
|
"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 {
|
func RestoreAsset(dir, name string) error {
|
||||||
data, err := Asset(name)
|
data, err := Asset(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -253,19 +253,20 @@ func RestoreAsset(dir, name string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore assets under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
if err != nil { // File
|
// File
|
||||||
|
if err != nil {
|
||||||
return RestoreAsset(dir, name)
|
return RestoreAsset(dir, name)
|
||||||
} else { // Dir
|
}
|
||||||
|
// Dir
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
113
testdata/out/nocompress-nomemcopy.go
vendored
113
testdata/out/nocompress-nomemcopy.go
vendored
|
@ -12,7 +12,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func bindata_read(data, name string) ([]byte, error) {
|
func bindataRead(data, name string) ([]byte, error) {
|
||||||
var empty [0]byte
|
var empty [0]byte
|
||||||
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
||||||
b := empty[:]
|
b := empty[:]
|
||||||
|
@ -28,108 +28,108 @@ type asset struct {
|
||||||
info os.FileInfo
|
info os.FileInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
type bindata_file_info struct {
|
type bindataFileInfo struct {
|
||||||
name string
|
name string
|
||||||
size int64
|
size int64
|
||||||
mode os.FileMode
|
mode os.FileMode
|
||||||
modTime time.Time
|
modTime time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fi bindata_file_info) Name() string {
|
func (fi bindataFileInfo) Name() string {
|
||||||
return fi.name
|
return fi.name
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Size() int64 {
|
func (fi bindataFileInfo) Size() int64 {
|
||||||
return fi.size
|
return fi.size
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Mode() os.FileMode {
|
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||||
return fi.mode
|
return fi.mode
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) ModTime() time.Time {
|
func (fi bindataFileInfo) ModTime() time.Time {
|
||||||
return fi.modTime
|
return fi.modTime
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) IsDir() bool {
|
func (fi bindataFileInfo) IsDir() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
func (fi bindata_file_info) Sys() interface{} {
|
func (fi bindataFileInfo) Sys() interface{} {
|
||||||
return nil
|
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) {
|
func inATestAssetBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_in_a_test_asset,
|
_inATestAsset,
|
||||||
"in/a/test.asset",
|
"in/a/test.asset",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_a_test_asset() (*asset, error) {
|
func inATestAsset() (*asset, error) {
|
||||||
bytes, err := in_a_test_asset_bytes()
|
bytes, err := inATestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
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) {
|
func inBTestAssetBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_in_b_test_asset,
|
_inBTestAsset,
|
||||||
"in/b/test.asset",
|
"in/b/test.asset",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_b_test_asset() (*asset, error) {
|
func inBTestAsset() (*asset, error) {
|
||||||
bytes, err := in_b_test_asset_bytes()
|
bytes, err := inBTestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
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) {
|
func inCTestAssetBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_in_c_test_asset,
|
_inCTestAsset,
|
||||||
"in/c/test.asset",
|
"in/c/test.asset",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_c_test_asset() (*asset, error) {
|
func inCTestAsset() (*asset, error) {
|
||||||
bytes, err := in_c_test_asset_bytes()
|
bytes, err := inCTestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
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) {
|
func inTestAssetBytes() ([]byte, error) {
|
||||||
return bindata_read(
|
return bindataRead(
|
||||||
_in_test_asset,
|
_inTestAsset,
|
||||||
"in/test.asset",
|
"in/test.asset",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func in_test_asset() (*asset, error) {
|
func inTestAsset() (*asset, error) {
|
||||||
bytes, err := in_test_asset_bytes()
|
bytes, err := inTestAssetBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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}
|
a := &asset{bytes: bytes, info: info}
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
@ -186,10 +186,10 @@ func AssetNames() []string {
|
||||||
|
|
||||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||||
var _bindata = map[string]func() (*asset, error){
|
var _bindata = map[string]func() (*asset, error){
|
||||||
"in/a/test.asset": in_a_test_asset,
|
"in/a/test.asset": inATestAsset,
|
||||||
"in/b/test.asset": in_b_test_asset,
|
"in/b/test.asset": inBTestAsset,
|
||||||
"in/c/test.asset": in_c_test_asset,
|
"in/c/test.asset": inCTestAsset,
|
||||||
"in/test.asset": in_test_asset,
|
"in/test.asset": inTestAsset,
|
||||||
}
|
}
|
||||||
|
|
||||||
// AssetDir returns the file names below a certain
|
// AssetDir returns the file names below a certain
|
||||||
|
@ -227,30 +227,30 @@ func AssetDir(name string) ([]string, error) {
|
||||||
return rv, nil
|
return rv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type _bintree_t struct {
|
type bintree struct {
|
||||||
Func func() (*asset, error)
|
Func func() (*asset, error)
|
||||||
Children map[string]*_bintree_t
|
Children map[string]*bintree
|
||||||
}
|
}
|
||||||
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
|
var _bintree = &bintree{nil, map[string]*bintree{
|
||||||
"in": &_bintree_t{nil, map[string]*_bintree_t{
|
"in": &bintree{nil, map[string]*bintree{
|
||||||
"a": &_bintree_t{nil, map[string]*_bintree_t{
|
"a": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_a_test_asset, map[string]*_bintree_t{
|
"test.asset": &bintree{inATestAsset, map[string]*bintree{
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
"b": &_bintree_t{nil, map[string]*_bintree_t{
|
"b": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_b_test_asset, map[string]*_bintree_t{
|
"test.asset": &bintree{inBTestAsset, map[string]*bintree{
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
"c": &_bintree_t{nil, map[string]*_bintree_t{
|
"c": &bintree{nil, map[string]*bintree{
|
||||||
"test.asset": &_bintree_t{in_c_test_asset, map[string]*_bintree_t{
|
"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 {
|
func RestoreAsset(dir, name string) error {
|
||||||
data, err := Asset(name)
|
data, err := Asset(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -275,19 +275,20 @@ func RestoreAsset(dir, name string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore assets under the given directory recursively
|
// RestoreAssets restores an asset under the given directory recursively
|
||||||
func RestoreAssets(dir, name string) error {
|
func RestoreAssets(dir, name string) error {
|
||||||
children, err := AssetDir(name)
|
children, err := AssetDir(name)
|
||||||
if err != nil { // File
|
// File
|
||||||
|
if err != nil {
|
||||||
return RestoreAsset(dir, name)
|
return RestoreAsset(dir, name)
|
||||||
} else { // Dir
|
}
|
||||||
|
// Dir
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
err = RestoreAssets(dir, path.Join(name, child))
|
err = RestoreAssets(dir, path.Join(name, child))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return nil
|
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) {
|
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
|
// Sort to make output stable between invocations
|
||||||
filenames := make([]string, len(root.Children))
|
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 {
|
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)
|
Func func() (*asset, error)
|
||||||
Children map[string]*_bintree_t
|
Children map[string]*bintree
|
||||||
}
|
}
|
||||||
var _bintree = `)
|
var _bintree = `)
|
||||||
root.writeGoMap(w, 0)
|
root.writeGoMap(w, 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user