mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
🔧 jteeuwen/go-bindata --> go-bindata/go-bindata
Signed-off-by: William Zhang <warmchang@outlook.com>
This commit is contained in:
parent
c849525a27
commit
bdb8550638
@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"os"
|
||||
|
||||
bindata "github.com/jteeuwen/go-bindata"
|
||||
bindata "github.com/go-bindata/go-bindata"
|
||||
v1 "github.com/rancher/k3s/pkg/apis/k3s.cattle.io/v1"
|
||||
controllergen "github.com/rancher/wrangler/pkg/controller-gen"
|
||||
"github.com/rancher/wrangler/pkg/controller-gen/args"
|
||||
|
@ -1,10 +1,8 @@
|
||||
// Code generated by go-bindata.
|
||||
// Code generated for package deploy by go-bindata DO NOT EDIT. (@generated)
|
||||
// sources:
|
||||
// manifests/coredns.yaml
|
||||
// manifests/rolebindings.yaml
|
||||
// manifests/traefik.yaml
|
||||
// DO NOT EDIT!
|
||||
|
||||
package deploy
|
||||
|
||||
import (
|
||||
@ -51,21 +49,32 @@ type bindataFileInfo struct {
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
// Name return file name
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
|
||||
// Size return file size
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
|
||||
// Mode return file mode
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
|
||||
// Mode return file modify time
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
|
||||
// IsDir return file whether a directory
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
return fi.mode&os.ModeDir != 0
|
||||
}
|
||||
|
||||
// Sys return file is sys mode
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
// Code generated by go-bindata.
|
||||
// Code generated for package openapi by go-bindata DO NOT EDIT. (@generated)
|
||||
// sources:
|
||||
// vendor/k8s.io/kubernetes/openapi.json
|
||||
// vendor/k8s.io/kubernetes/openapi.pb
|
||||
// DO NOT EDIT!
|
||||
|
||||
package openapi
|
||||
|
||||
import (
|
||||
@ -50,21 +48,32 @@ type bindataFileInfo struct {
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
// Name return file name
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
|
||||
// Size return file size
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
|
||||
// Mode return file mode
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
|
||||
// Mode return file modify time
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
|
||||
// IsDir return file whether a directory
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
return fi.mode&os.ModeDir != 0
|
||||
}
|
||||
|
||||
// Sys return file is sys mode
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
// Code generated by go-bindata.
|
||||
// Code generated for package static by go-bindata DO NOT EDIT. (@generated)
|
||||
// sources:
|
||||
// build/static/charts/traefik-1.64.0.tgz
|
||||
// DO NOT EDIT!
|
||||
|
||||
package static
|
||||
|
||||
import (
|
||||
@ -49,21 +47,32 @@ type bindataFileInfo struct {
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
// Name return file name
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
|
||||
// Size return file size
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
|
||||
// Mode return file mode
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
|
||||
// Mode return file modify time
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
|
||||
// IsDir return file whether a directory
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
return fi.mode&os.ModeDir != 0
|
||||
}
|
||||
|
||||
// Sys return file is sys mode
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
@ -156,8 +156,8 @@ import:
|
||||
version: 72f9bd7c4e0c2a40055ab3d0f09654f730cce982
|
||||
- package: github.com/json-iterator/go
|
||||
version: 1.1.5
|
||||
- package: github.com/jteeuwen/go-bindata
|
||||
version: v3.0.7-72-ga0ff2567cfb709
|
||||
- package: github.com/go-bindata/go-bindata
|
||||
version: v3.1.2
|
||||
- package: github.com/karrick/godirwalk
|
||||
version: v1.7.5
|
||||
- package: github.com/kubernetes-sigs/cri-tools
|
||||
|
@ -1,6 +1,6 @@
|
||||
package=github.com/rancher/k3s
|
||||
package=github.com/jteeuwen/go-bindata
|
||||
package=github.com/jteeuwen/go-bindata/go-bindata
|
||||
package=github.com/go-bindata/go-bindata
|
||||
package=github.com/go-bindata/go-bindata/go-bindata
|
||||
package=github.com/containerd/containerd/cmd/containerd-shim
|
||||
package=k8s.io/kubernetes/cmd/hyperkube
|
||||
package=github.com/opencontainers/runc
|
||||
|
16
vendor/github.com/go-bindata/go-bindata/.gitignore
generated
vendored
Normal file
16
vendor/github.com/go-bindata/go-bindata/.gitignore
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, build with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
# Goland project files
|
||||
.idea/
|
||||
*.iml
|
@ -1,5 +1,7 @@
|
||||
## bindata
|
||||
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/go-bindata/bindata)](https://goreportcard.com/report/github.com/go-bindata/bindata)
|
||||
|
||||
This package converts any file into managable Go source code. Useful for
|
||||
embedding binary data into a go program. The file data is optionally gzip
|
||||
compressed before being converted to a raw byte slice.
|
||||
@ -13,7 +15,7 @@ output being generated.
|
||||
|
||||
To install the library and command line program, use the following:
|
||||
|
||||
go get -u github.com/jteeuwen/go-bindata/...
|
||||
go get -u github.com/go-bindata/go-bindata/...
|
||||
|
||||
|
||||
### Usage
|
||||
@ -182,8 +184,16 @@ format is specified at build time with the appropriate tags.
|
||||
The tags are appended to a `// +build` line in the beginning of the output file
|
||||
and must follow the build tags syntax specified by the go tool.
|
||||
|
||||
### Related projects
|
||||
### Serve assets with `net/http`
|
||||
|
||||
[go-bindata-assetfs](https://github.com/elazarl/go-bindata-assetfs#readme) -
|
||||
implements `http.FileSystem` interface. Allows you to serve assets with `net/http`.
|
||||
With the `-fs` flag, `go-bindata` will add an `AssetFile()` method returning an `http.FileSystem` interface:
|
||||
|
||||
$ go-bindata -fs -prefix "static/" static/
|
||||
|
||||
Use `-prefix` flag to strip first level dir, then in your `net/http` router, you can use `AssetFile()` with `http.FileServer()` like:
|
||||
|
||||
```go
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("/static", http.FileServer(AssetFile()))
|
||||
http.ListenAndServe(":8080", mux)
|
||||
```
|
1
vendor/github.com/go-bindata/go-bindata/_config.yml
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/_config.yml
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
theme: jekyll-theme-cayman
|
@ -106,6 +106,10 @@ type Config struct {
|
||||
// the file data when called. Defaults to false.
|
||||
NoCompress bool
|
||||
|
||||
// HttpFileSystem means whether generate return http.FileSystem interface
|
||||
// instance's function.When true,will generate relate code.
|
||||
HttpFileSystem bool
|
||||
|
||||
// Perform a debug build. This generates an asset file, which
|
||||
// loads the asset contents directly from disk at their original
|
||||
// location, instead of embedding the contents in the code.
|
||||
@ -148,6 +152,7 @@ func NewConfig() *Config {
|
||||
c.Package = "main"
|
||||
c.NoMemCopy = false
|
||||
c.NoCompress = false
|
||||
c.HttpFileSystem = false
|
||||
c.Debug = false
|
||||
c.Output = "./bindata.go"
|
||||
c.Ignore = make([]*regexp.Regexp, 0)
|
@ -50,7 +50,7 @@ func Translate(c *Config) error {
|
||||
defer bfd.Flush()
|
||||
|
||||
// Write the header. This makes e.g. Github ignore diffs in generated files.
|
||||
if _, err = fmt.Fprint(bfd, "// Code generated by go-bindata.\n"); err != nil {
|
||||
if _, err = fmt.Fprintf(bfd, "// Code generated for package %s by go-bindata DO NOT EDIT. (@generated)\n", c.Package); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err = fmt.Fprint(bfd, "// sources:\n"); err != nil {
|
||||
@ -68,9 +68,9 @@ func Translate(c *Config) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if _, err = fmt.Fprint(bfd, "// DO NOT EDIT!\n\n"); err != nil {
|
||||
return err
|
||||
}
|
||||
//if _, err = fmt.Fprint(bfd, "// DO NOT EDIT!\n\n"); err != nil {
|
||||
// return err
|
||||
//}
|
||||
|
||||
// Write build tags, if applicable.
|
||||
if len(c.Tags) > 0 {
|
||||
@ -109,7 +109,7 @@ func Translate(c *Config) error {
|
||||
return writeRestore(bfd)
|
||||
}
|
||||
|
||||
// Implement sort.Interface for []os.FileInfo based on Name()
|
||||
// ByName implements sort.Interface for []os.FileInfo based on Name()
|
||||
type ByName []os.FileInfo
|
||||
|
||||
func (v ByName) Len() int { return len(v) }
|
90
vendor/github.com/go-bindata/go-bindata/convert_test.go
generated
vendored
Normal file
90
vendor/github.com/go-bindata/go-bindata/convert_test.go
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
package bindata
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSafeFunctionName(t *testing.T) {
|
||||
var knownFuncs = make(map[string]int)
|
||||
name1 := safeFunctionName("foo/bar", knownFuncs)
|
||||
name2 := safeFunctionName("foo_bar", knownFuncs)
|
||||
if name1 == name2 {
|
||||
t.Errorf("name collision")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFindFiles(t *testing.T) {
|
||||
var toc []Asset
|
||||
var knownFuncs = make(map[string]int)
|
||||
var visitedPaths = make(map[string]bool)
|
||||
err := findFiles("testdata/dupname", "testdata/dupname", true, &toc, []*regexp.Regexp{}, knownFuncs, visitedPaths)
|
||||
if err != nil {
|
||||
t.Errorf("expected to be no error: %+v", err)
|
||||
}
|
||||
if toc[0].Func == toc[1].Func {
|
||||
t.Errorf("name collision")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFindFilesWithSymlinks(t *testing.T) {
|
||||
var tocSrc []Asset
|
||||
var tocTarget []Asset
|
||||
|
||||
var knownFuncs = make(map[string]int)
|
||||
var visitedPaths = make(map[string]bool)
|
||||
err := findFiles("testdata/symlinkSrc", "testdata/symlinkSrc", true, &tocSrc, []*regexp.Regexp{}, knownFuncs, visitedPaths)
|
||||
if err != nil {
|
||||
t.Errorf("expected to be no error: %+v", err)
|
||||
}
|
||||
|
||||
knownFuncs = make(map[string]int)
|
||||
visitedPaths = make(map[string]bool)
|
||||
err = findFiles("testdata/symlinkParent", "testdata/symlinkParent", true, &tocTarget, []*regexp.Regexp{}, knownFuncs, visitedPaths)
|
||||
if err != nil {
|
||||
t.Errorf("expected to be no error: %+v", err)
|
||||
}
|
||||
|
||||
if len(tocSrc) != len(tocTarget) {
|
||||
t.Errorf("Symlink source and target should have the same number of assets. Expected %d got %d", len(tocTarget), len(tocSrc))
|
||||
} else {
|
||||
for i, _ := range tocSrc {
|
||||
targetFunc := strings.TrimPrefix(tocTarget[i].Func, "symlinktarget")
|
||||
targetFunc = strings.ToLower(targetFunc[:1]) + targetFunc[1:]
|
||||
if tocSrc[i].Func != targetFunc {
|
||||
t.Errorf("Symlink source and target produced different function lists. Expected %s to be %s", targetFunc, tocSrc[i].Func)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestFindFilesWithRecursiveSymlinks(t *testing.T) {
|
||||
var toc []Asset
|
||||
|
||||
var knownFuncs = make(map[string]int)
|
||||
var visitedPaths = make(map[string]bool)
|
||||
err := findFiles("testdata/symlinkRecursiveParent", "testdata/symlinkRecursiveParent", true, &toc, []*regexp.Regexp{}, knownFuncs, visitedPaths)
|
||||
if err != nil {
|
||||
t.Errorf("expected to be no error: %+v", err)
|
||||
}
|
||||
|
||||
if len(toc) != 1 {
|
||||
t.Errorf("Only one asset should have been found. Got %d: %v", len(toc), toc)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFindFilesWithSymlinkedFile(t *testing.T) {
|
||||
var toc []Asset
|
||||
|
||||
var knownFuncs = make(map[string]int)
|
||||
var visitedPaths = make(map[string]bool)
|
||||
err := findFiles("testdata/symlinkFile", "testdata/symlinkFile", true, &toc, []*regexp.Regexp{}, knownFuncs, visitedPaths)
|
||||
if err != nil {
|
||||
t.Errorf("expected to be no error: %+v", err)
|
||||
}
|
||||
|
||||
if len(toc) != 1 {
|
||||
t.Errorf("Only one asset should have been found. Got %d: %v", len(toc), toc)
|
||||
}
|
||||
}
|
@ -11,7 +11,12 @@ import (
|
||||
|
||||
// writeDebug writes the debug code file.
|
||||
func writeDebug(w io.Writer, c *Config, toc []Asset) error {
|
||||
err := writeDebugHeader(w)
|
||||
err := writeDebugHeader(w, c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = writeAssetFS(w, c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -28,13 +33,29 @@ func writeDebug(w io.Writer, c *Config, toc []Asset) error {
|
||||
|
||||
// writeDebugHeader writes output file headers.
|
||||
// This targets debug builds.
|
||||
func writeDebugHeader(w io.Writer) error {
|
||||
_, err := fmt.Fprintf(w, `import (
|
||||
func writeDebugHeader(w io.Writer, c *Config) error {
|
||||
var header string
|
||||
|
||||
if c.HttpFileSystem {
|
||||
header = `import (
|
||||
"bytes"
|
||||
"net/http"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"`
|
||||
} else {
|
||||
header = `import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"`
|
||||
}
|
||||
|
||||
_, err := fmt.Fprintf(w, `%s
|
||||
)
|
||||
|
||||
// bindataRead reads the given file from disk. It returns an error on failure.
|
||||
@ -51,7 +72,7 @@ type asset struct {
|
||||
info os.FileInfo
|
||||
}
|
||||
|
||||
`)
|
||||
`, header)
|
||||
return err
|
||||
}
|
||||
|
102
vendor/github.com/go-bindata/go-bindata/file.go
generated
vendored
Normal file
102
vendor/github.com/go-bindata/go-bindata/file.go
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
package bindata
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
func writeAssetFS(w io.Writer, c *Config) error {
|
||||
if !c.HttpFileSystem {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err := fmt.Fprintf(w, `
|
||||
type assetFile struct {
|
||||
*bytes.Reader
|
||||
name string
|
||||
childInfos []os.FileInfo
|
||||
childInfoOffset int
|
||||
}
|
||||
|
||||
type assetOperator struct{}
|
||||
|
||||
// Open implement http.FileSystem interface
|
||||
func (f *assetOperator) Open(name string) (http.File, error) {
|
||||
var err error
|
||||
if len(name) > 0 && name[0] == '/' {
|
||||
name = name[1:]
|
||||
}
|
||||
content, err := Asset(name)
|
||||
if err == nil {
|
||||
return &assetFile{name: name, Reader: bytes.NewReader(content)}, nil
|
||||
}
|
||||
children, err := AssetDir(name)
|
||||
if err == nil {
|
||||
childInfos := make([]os.FileInfo, 0, len(children))
|
||||
for _, child := range children {
|
||||
childPath := filepath.Join(name, child)
|
||||
info, errInfo := AssetInfo(filepath.Join(name, child))
|
||||
if errInfo == nil {
|
||||
childInfos = append(childInfos, info)
|
||||
} else {
|
||||
childInfos = append(childInfos, newDirFileInfo(childPath))
|
||||
}
|
||||
}
|
||||
return &assetFile{name: name, childInfos: childInfos}, nil
|
||||
} else {
|
||||
// If the error is not found, return an error that will
|
||||
// result in a 404 error. Otherwise the server returns
|
||||
// a 500 error for files not found.
|
||||
if strings.Contains(err.Error(), "not found") {
|
||||
return nil, os.ErrNotExist
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Close no need do anything
|
||||
func (f *assetFile) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Readdir read dir's children file info
|
||||
func (f *assetFile) Readdir(count int) ([]os.FileInfo, error) {
|
||||
if len(f.childInfos) == 0 {
|
||||
return nil, os.ErrNotExist
|
||||
}
|
||||
if count <= 0 {
|
||||
return f.childInfos, nil
|
||||
}
|
||||
if f.childInfoOffset+count > len(f.childInfos) {
|
||||
count = len(f.childInfos) - f.childInfoOffset
|
||||
}
|
||||
offset := f.childInfoOffset
|
||||
f.childInfoOffset += count
|
||||
return f.childInfos[offset : offset+count], nil
|
||||
}
|
||||
|
||||
// Stat read file info from asset item
|
||||
func (f *assetFile) Stat() (os.FileInfo, error) {
|
||||
if len(f.childInfos) != 0 {
|
||||
return newDirFileInfo(f.name), nil
|
||||
}
|
||||
return AssetInfo(f.name)
|
||||
}
|
||||
|
||||
// newDirFileInfo return default dir file info
|
||||
func newDirFileInfo(name string) os.FileInfo {
|
||||
return &bindataFileInfo{
|
||||
name: name,
|
||||
size: 0,
|
||||
mode: os.FileMode(2147484068), // equal os.FileMode(0644)|os.ModeDir
|
||||
modTime: time.Time{}}
|
||||
}
|
||||
|
||||
// AssetFile return a http.FileSystem instance that data backend by asset
|
||||
func AssetFile() http.FileSystem {
|
||||
return &assetOperator{}
|
||||
}
|
||||
|
||||
`)
|
||||
return err
|
||||
}
|
1
vendor/github.com/go-bindata/go-bindata/go-bindata/.gitignore
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/go-bindata/.gitignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
go-bindata
|
@ -12,7 +12,7 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/jteeuwen/go-bindata"
|
||||
"github.com/go-bindata/go-bindata"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -48,6 +48,7 @@ func parseArgs() *bindata.Config {
|
||||
flag.BoolVar(&c.NoMemCopy, "nomemcopy", c.NoMemCopy, "Use a .rodata hack to get rid of unnecessary memcopies. Refer to the documentation to see what implications this carries.")
|
||||
flag.BoolVar(&c.NoCompress, "nocompress", c.NoCompress, "Assets will *not* be GZIP compressed when this flag is specified.")
|
||||
flag.BoolVar(&c.NoMetadata, "nometadata", c.NoMetadata, "Assets will not preserve size, mode, and modtime info.")
|
||||
flag.BoolVar(&c.HttpFileSystem, "fs", c.HttpFileSystem, "Whether generate instance http.FileSystem interface code.")
|
||||
flag.UintVar(&c.Mode, "mode", c.Mode, "Optional file mode override for all files.")
|
||||
flag.Int64Var(&c.ModTime, "modtime", c.ModTime, "Optional modification unix timestamp override for all files.")
|
||||
flag.StringVar(&c.Output, "o", c.Output, "Optional name of the output file to be generated.")
|
@ -23,7 +23,7 @@ var AppVersionRev string
|
||||
|
||||
func Version() string {
|
||||
if len(AppVersionRev) == 0 {
|
||||
AppVersionRev = "0"
|
||||
AppVersionRev = "2"
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s %d.%d.%s (Go runtime %s).\nCopyright (c) 2010-2013, Jim Teeuwen.",
|
@ -21,6 +21,11 @@ func writeRelease(w io.Writer, c *Config, toc []Asset) error {
|
||||
return err
|
||||
}
|
||||
|
||||
err = writeAssetFS(w, c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := range toc {
|
||||
err = writeReleaseAsset(w, c, &toc[i])
|
||||
if err != nil {
|
||||
@ -37,15 +42,15 @@ func writeReleaseHeader(w io.Writer, c *Config) error {
|
||||
var err error
|
||||
if c.NoCompress {
|
||||
if c.NoMemCopy {
|
||||
err = header_uncompressed_nomemcopy(w)
|
||||
err = header_uncompressed_nomemcopy(w, c)
|
||||
} else {
|
||||
err = header_uncompressed_memcopy(w)
|
||||
err = header_uncompressed_memcopy(w, c)
|
||||
}
|
||||
} else {
|
||||
if c.NoMemCopy {
|
||||
err = header_compressed_nomemcopy(w)
|
||||
err = header_compressed_nomemcopy(w, c)
|
||||
} else {
|
||||
err = header_compressed_memcopy(w)
|
||||
err = header_compressed_memcopy(w, c)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
@ -97,8 +102,23 @@ func sanitize(b []byte) []byte {
|
||||
return bytes.Replace(b, []byte("\xEF\xBB\xBF"), []byte("`+\"\\xEF\\xBB\\xBF\"+`"), -1)
|
||||
}
|
||||
|
||||
func header_compressed_nomemcopy(w io.Writer) error {
|
||||
_, err := fmt.Fprintf(w, `import (
|
||||
func header_compressed_nomemcopy(w io.Writer, c *Config) error {
|
||||
var header string
|
||||
|
||||
if c.HttpFileSystem {
|
||||
header = `import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"`
|
||||
} else {
|
||||
header = `import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
@ -107,7 +127,10 @@ func header_compressed_nomemcopy(w io.Writer) error {
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
"time"`
|
||||
}
|
||||
|
||||
_, err := fmt.Fprintf(w, `%s
|
||||
)
|
||||
|
||||
func bindataRead(data, name string) ([]byte, error) {
|
||||
@ -130,12 +153,27 @@ func bindataRead(data, name string) ([]byte, error) {
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
`)
|
||||
`, header)
|
||||
return err
|
||||
}
|
||||
|
||||
func header_compressed_memcopy(w io.Writer) error {
|
||||
_, err := fmt.Fprintf(w, `import (
|
||||
func header_compressed_memcopy(w io.Writer, c *Config) error {
|
||||
var header string
|
||||
|
||||
if c.HttpFileSystem {
|
||||
header = `import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"`
|
||||
} else {
|
||||
header = `import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
@ -144,7 +182,10 @@ func header_compressed_memcopy(w io.Writer) error {
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
"time"`
|
||||
}
|
||||
|
||||
_, err := fmt.Fprintf(w, `%s
|
||||
)
|
||||
|
||||
func bindataRead(data []byte, name string) ([]byte, error) {
|
||||
@ -167,12 +208,27 @@ func bindataRead(data []byte, name string) ([]byte, error) {
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
`)
|
||||
`, header)
|
||||
return err
|
||||
}
|
||||
|
||||
func header_uncompressed_nomemcopy(w io.Writer) error {
|
||||
_, err := fmt.Fprintf(w, `import (
|
||||
func header_uncompressed_nomemcopy(w io.Writer, c *Config) error {
|
||||
var header string
|
||||
|
||||
if c.HttpFileSystem {
|
||||
header = `import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
"unsafe"`
|
||||
} else {
|
||||
header = `import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@ -180,7 +236,10 @@ func header_uncompressed_nomemcopy(w io.Writer) error {
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
"unsafe"
|
||||
"unsafe"`
|
||||
}
|
||||
|
||||
_, err := fmt.Fprintf(w, `%s
|
||||
)
|
||||
|
||||
func bindataRead(data, name string) ([]byte, error) {
|
||||
@ -194,20 +253,36 @@ func bindataRead(data, name string) ([]byte, error) {
|
||||
return b, nil
|
||||
}
|
||||
|
||||
`)
|
||||
`, header)
|
||||
return err
|
||||
}
|
||||
|
||||
func header_uncompressed_memcopy(w io.Writer) error {
|
||||
_, err := fmt.Fprintf(w, `import (
|
||||
func header_uncompressed_memcopy(w io.Writer, c *Config) error {
|
||||
var header string
|
||||
|
||||
if c.HttpFileSystem {
|
||||
header = `import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"`
|
||||
} else {
|
||||
header = `import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
"time"`
|
||||
}
|
||||
|
||||
_, err := fmt.Fprintf(w, `%s
|
||||
)
|
||||
`)
|
||||
`, header)
|
||||
return err
|
||||
}
|
||||
|
||||
@ -224,21 +299,32 @@ type bindataFileInfo struct {
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
// Name return file name
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
|
||||
// Size return file size
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
|
||||
// Mode return file mode
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
|
||||
// Mode return file modify time
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
|
||||
// IsDir return file whether a directory
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
return fi.mode&os.ModeDir != 0
|
||||
}
|
||||
|
||||
// Sys return file is sys mode
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
@ -57,7 +57,6 @@ func _filePath(dir, name string) string {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||||
}
|
||||
|
||||
`)
|
||||
return err
|
||||
}
|
33
vendor/github.com/go-bindata/go-bindata/testdata/Makefile
generated
vendored
Normal file
33
vendor/github.com/go-bindata/go-bindata/testdata/Makefile
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
FILES:=$(wildcard out/*.go)
|
||||
|
||||
.PHONY: check
|
||||
check: errcheck golint $(FILES:.go=.checked)
|
||||
|
||||
out/%.checked: out/%.go
|
||||
errcheck $<
|
||||
go vet --all $<
|
||||
golint $<
|
||||
|
||||
$(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
|
||||
|
||||
golint:
|
||||
go get golang.org/x/lint/golint
|
1
vendor/github.com/go-bindata/go-bindata/testdata/dupname/foo/bar
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/testdata/dupname/foo/bar
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
// sample file
|
1
vendor/github.com/go-bindata/go-bindata/testdata/dupname/foo_bar
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/testdata/dupname/foo_bar
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
// sample file
|
1
vendor/github.com/go-bindata/go-bindata/testdata/in/a/test.asset
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/testdata/in/a/test.asset
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
// sample file
|
1
vendor/github.com/go-bindata/go-bindata/testdata/in/b/test.asset
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/testdata/in/b/test.asset
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
// sample file
|
1
vendor/github.com/go-bindata/go-bindata/testdata/in/c/test.asset
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/testdata/in/c/test.asset
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
// sample file
|
1
vendor/github.com/go-bindata/go-bindata/testdata/in/test.asset
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/testdata/in/test.asset
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
// sample file
|
311
vendor/github.com/go-bindata/go-bindata/testdata/out/compress-memcopy.go
generated
vendored
Normal file
311
vendor/github.com/go-bindata/go-bindata/testdata/out/compress-memcopy.go
generated
vendored
Normal file
@ -0,0 +1,311 @@
|
||||
// Code generated for package main by go-bindata DO NOT EDIT.
|
||||
// sources:
|
||||
// in/a/test.asset
|
||||
// in/b/test.asset
|
||||
// in/c/test.asset
|
||||
// in/test.asset
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
_, err = io.Copy(&buf, gz)
|
||||
clErr := gz.Close()
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||||
}
|
||||
if clErr != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
type asset struct {
|
||||
bytes []byte
|
||||
info os.FileInfo
|
||||
}
|
||||
|
||||
type bindataFileInfo struct {
|
||||
name string
|
||||
size int64
|
||||
mode os.FileMode
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
}
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
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 inATestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inATestAsset,
|
||||
"in/a/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func inATestAsset() (*asset, error) {
|
||||
bytes, err := inATestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
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 inBTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inBTestAsset,
|
||||
"in/b/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func inBTestAsset() (*asset, error) {
|
||||
bytes, err := inBTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/b/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
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 inCTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inCTestAsset,
|
||||
"in/c/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func inCTestAsset() (*asset, error) {
|
||||
bytes, err := inCTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/c/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
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 inTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inTestAsset,
|
||||
"in/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func inTestAsset() (*asset, error) {
|
||||
bytes, err := inTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
// Asset loads and returns the asset for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
func Asset(name string) ([]byte, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.bytes, nil
|
||||
}
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
|
||||
// MustAsset is like Asset but panics when Asset would return an error.
|
||||
// It simplifies safe initialization of global variables.
|
||||
func MustAsset(name string) []byte {
|
||||
a, err := Asset(name)
|
||||
if err != nil {
|
||||
panic("asset: Asset(" + name + "): " + err.Error())
|
||||
}
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
// AssetInfo loads and returns the asset info for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
func AssetInfo(name string) (os.FileInfo, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.info, nil
|
||||
}
|
||||
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||||
}
|
||||
|
||||
// AssetNames returns the names of the assets.
|
||||
func AssetNames() []string {
|
||||
names := make([]string, 0, len(_bindata))
|
||||
for name := range _bindata {
|
||||
names = append(names, name)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"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
|
||||
// directory embedded in the file by go-bindata.
|
||||
// For example if you run go-bindata on data/... and data contains the
|
||||
// following hierarchy:
|
||||
// data/
|
||||
// foo.txt
|
||||
// img/
|
||||
// a.png
|
||||
// b.png
|
||||
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
||||
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||||
// AssetDir("") will return []string{"data"}.
|
||||
func AssetDir(name string) ([]string, error) {
|
||||
node := _bintree
|
||||
if len(name) != 0 {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
pathList := strings.Split(cannonicalName, "/")
|
||||
for _, p := range pathList {
|
||||
node = node.Children[p]
|
||||
if node == nil {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
if node.Func != nil {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
rv := make([]string, 0, len(node.Children))
|
||||
for childName := range node.Children {
|
||||
rv = append(rv, childName)
|
||||
}
|
||||
return rv, nil
|
||||
}
|
||||
|
||||
type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*bintree
|
||||
}
|
||||
|
||||
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{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inBTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
"c": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inCTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
"test.asset": &bintree{inTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
info, err := AssetInfo(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
// File
|
||||
if err != nil {
|
||||
return RestoreAsset(dir, name)
|
||||
}
|
||||
// Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, filepath.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _filePath(dir, name string) string {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||||
}
|
311
vendor/github.com/go-bindata/go-bindata/testdata/out/compress-nomemcopy.go
generated
vendored
Normal file
311
vendor/github.com/go-bindata/go-bindata/testdata/out/compress-nomemcopy.go
generated
vendored
Normal file
@ -0,0 +1,311 @@
|
||||
// Code generated for package main by go-bindata DO NOT EDIT.
|
||||
// sources:
|
||||
// in/a/test.asset
|
||||
// in/b/test.asset
|
||||
// in/c/test.asset
|
||||
// in/test.asset
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func bindataRead(data, name string) ([]byte, error) {
|
||||
gz, err := gzip.NewReader(strings.NewReader(data))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
_, err = io.Copy(&buf, gz)
|
||||
clErr := gz.Close()
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Read %q: %v", name, err)
|
||||
}
|
||||
if clErr != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
type asset struct {
|
||||
bytes []byte
|
||||
info os.FileInfo
|
||||
}
|
||||
|
||||
type bindataFileInfo struct {
|
||||
name string
|
||||
size int64
|
||||
mode os.FileMode
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
}
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
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 inATestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inATestAsset,
|
||||
"in/a/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func inATestAsset() (*asset, error) {
|
||||
bytes, err := inATestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
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 inBTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inBTestAsset,
|
||||
"in/b/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func inBTestAsset() (*asset, error) {
|
||||
bytes, err := inBTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/b/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
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 inCTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inCTestAsset,
|
||||
"in/c/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func inCTestAsset() (*asset, error) {
|
||||
bytes, err := inCTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/c/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
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 inTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inTestAsset,
|
||||
"in/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func inTestAsset() (*asset, error) {
|
||||
bytes, err := inTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
// Asset loads and returns the asset for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
func Asset(name string) ([]byte, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.bytes, nil
|
||||
}
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
|
||||
// MustAsset is like Asset but panics when Asset would return an error.
|
||||
// It simplifies safe initialization of global variables.
|
||||
func MustAsset(name string) []byte {
|
||||
a, err := Asset(name)
|
||||
if err != nil {
|
||||
panic("asset: Asset(" + name + "): " + err.Error())
|
||||
}
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
// AssetInfo loads and returns the asset info for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
func AssetInfo(name string) (os.FileInfo, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.info, nil
|
||||
}
|
||||
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||||
}
|
||||
|
||||
// AssetNames returns the names of the assets.
|
||||
func AssetNames() []string {
|
||||
names := make([]string, 0, len(_bindata))
|
||||
for name := range _bindata {
|
||||
names = append(names, name)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"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
|
||||
// directory embedded in the file by go-bindata.
|
||||
// For example if you run go-bindata on data/... and data contains the
|
||||
// following hierarchy:
|
||||
// data/
|
||||
// foo.txt
|
||||
// img/
|
||||
// a.png
|
||||
// b.png
|
||||
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
||||
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||||
// AssetDir("") will return []string{"data"}.
|
||||
func AssetDir(name string) ([]string, error) {
|
||||
node := _bintree
|
||||
if len(name) != 0 {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
pathList := strings.Split(cannonicalName, "/")
|
||||
for _, p := range pathList {
|
||||
node = node.Children[p]
|
||||
if node == nil {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
if node.Func != nil {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
rv := make([]string, 0, len(node.Children))
|
||||
for childName := range node.Children {
|
||||
rv = append(rv, childName)
|
||||
}
|
||||
return rv, nil
|
||||
}
|
||||
|
||||
type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*bintree
|
||||
}
|
||||
|
||||
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{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inBTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
"c": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inCTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
"test.asset": &bintree{inTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
info, err := AssetInfo(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
// File
|
||||
if err != nil {
|
||||
return RestoreAsset(dir, name)
|
||||
}
|
||||
// Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, filepath.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _filePath(dir, name string) string {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||||
}
|
262
vendor/github.com/go-bindata/go-bindata/testdata/out/debug.go
generated
vendored
Normal file
262
vendor/github.com/go-bindata/go-bindata/testdata/out/debug.go
generated
vendored
Normal file
@ -0,0 +1,262 @@
|
||||
// Code generated for package main by go-bindata DO NOT EDIT.
|
||||
// sources:
|
||||
// in/a/test.asset
|
||||
// in/b/test.asset
|
||||
// in/c/test.asset
|
||||
// in/test.asset
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 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)
|
||||
}
|
||||
return buf, err
|
||||
}
|
||||
|
||||
type asset struct {
|
||||
bytes []byte
|
||||
info os.FileInfo
|
||||
}
|
||||
|
||||
// inATestAsset reads file data from disk. It returns an error on failure.
|
||||
func inATestAsset() (*asset, error) {
|
||||
path := "/home/ts/code/go/src/github.com/jteeuwen/go-bindata/testdata/in/a/test.asset"
|
||||
name := "in/a/test.asset"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// inBTestAsset reads file data from disk. It returns an error on failure.
|
||||
func inBTestAsset() (*asset, error) {
|
||||
path := "/home/ts/code/go/src/github.com/jteeuwen/go-bindata/testdata/in/b/test.asset"
|
||||
name := "in/b/test.asset"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// inCTestAsset reads file data from disk. It returns an error on failure.
|
||||
func inCTestAsset() (*asset, error) {
|
||||
path := "/home/ts/code/go/src/github.com/jteeuwen/go-bindata/testdata/in/c/test.asset"
|
||||
name := "in/c/test.asset"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// inTestAsset reads file data from disk. It returns an error on failure.
|
||||
func inTestAsset() (*asset, error) {
|
||||
path := "/home/ts/code/go/src/github.com/jteeuwen/go-bindata/testdata/in/test.asset"
|
||||
name := "in/test.asset"
|
||||
bytes, err := bindataRead(path, name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// Asset loads and returns the asset for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
func Asset(name string) ([]byte, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.bytes, nil
|
||||
}
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
|
||||
// MustAsset is like Asset but panics when Asset would return an error.
|
||||
// It simplifies safe initialization of global variables.
|
||||
func MustAsset(name string) []byte {
|
||||
a, err := Asset(name)
|
||||
if err != nil {
|
||||
panic("asset: Asset(" + name + "): " + err.Error())
|
||||
}
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
// AssetInfo loads and returns the asset info for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
func AssetInfo(name string) (os.FileInfo, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.info, nil
|
||||
}
|
||||
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||||
}
|
||||
|
||||
// AssetNames returns the names of the assets.
|
||||
func AssetNames() []string {
|
||||
names := make([]string, 0, len(_bindata))
|
||||
for name := range _bindata {
|
||||
names = append(names, name)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"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
|
||||
// directory embedded in the file by go-bindata.
|
||||
// For example if you run go-bindata on data/... and data contains the
|
||||
// following hierarchy:
|
||||
// data/
|
||||
// foo.txt
|
||||
// img/
|
||||
// a.png
|
||||
// b.png
|
||||
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
||||
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||||
// AssetDir("") will return []string{"data"}.
|
||||
func AssetDir(name string) ([]string, error) {
|
||||
node := _bintree
|
||||
if len(name) != 0 {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
pathList := strings.Split(cannonicalName, "/")
|
||||
for _, p := range pathList {
|
||||
node = node.Children[p]
|
||||
if node == nil {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
if node.Func != nil {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
rv := make([]string, 0, len(node.Children))
|
||||
for childName := range node.Children {
|
||||
rv = append(rv, childName)
|
||||
}
|
||||
return rv, nil
|
||||
}
|
||||
|
||||
type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*bintree
|
||||
}
|
||||
|
||||
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{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inBTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
"c": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inCTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
"test.asset": &bintree{inTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
info, err := AssetInfo(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
// File
|
||||
if err != nil {
|
||||
return RestoreAsset(dir, name)
|
||||
}
|
||||
// Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, filepath.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _filePath(dir, name string) string {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||||
}
|
259
vendor/github.com/go-bindata/go-bindata/testdata/out/debug.go-bindata
generated
vendored
Normal file
259
vendor/github.com/go-bindata/go-bindata/testdata/out/debug.go-bindata
generated
vendored
Normal file
@ -0,0 +1,259 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// bindata_read reads the given file from disk. It returns an error on failure.
|
||||
func bindata_read(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)
|
||||
}
|
||||
return buf, err
|
||||
}
|
||||
|
||||
type asset struct {
|
||||
bytes []byte
|
||||
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) {
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
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) {
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
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) {
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// in_test_asset reads file data from disk. It returns an error on failure.
|
||||
func in_test_asset() (*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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi, err := os.Stat(path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("Error reading asset info %s at %s: %v", name, path, err)
|
||||
}
|
||||
|
||||
a := &asset{bytes: bytes, info: fi}
|
||||
return a, err
|
||||
}
|
||||
|
||||
// Asset loads and returns the asset for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
func Asset(name string) ([]byte, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.bytes, nil
|
||||
}
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
|
||||
// MustAsset is like Asset but panics when Asset would return an error.
|
||||
// It simplifies safe initialization of global variables.
|
||||
func MustAsset(name string) []byte {
|
||||
a, err := Asset(name)
|
||||
if (err != nil) {
|
||||
panic("asset: Asset(" + name + "): " + err.Error())
|
||||
}
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
// AssetInfo loads and returns the asset info for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
func AssetInfo(name string) (os.FileInfo, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.info, nil
|
||||
}
|
||||
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||||
}
|
||||
|
||||
// AssetNames returns the names of the assets.
|
||||
func AssetNames() []string {
|
||||
names := make([]string, 0, len(_bindata))
|
||||
for name := range _bindata {
|
||||
names = append(names, name)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
// _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,
|
||||
}
|
||||
|
||||
// AssetDir returns the file names below a certain
|
||||
// directory embedded in the file by go-bindata.
|
||||
// For example if you run go-bindata on data/... and data contains the
|
||||
// following hierarchy:
|
||||
// data/
|
||||
// foo.txt
|
||||
// img/
|
||||
// a.png
|
||||
// b.png
|
||||
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
||||
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||||
// AssetDir("") will return []string{"data"}.
|
||||
func AssetDir(name string) ([]string, error) {
|
||||
node := _bintree
|
||||
if len(name) != 0 {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
pathList := strings.Split(cannonicalName, "/")
|
||||
for _, p := range pathList {
|
||||
node = node.Children[p]
|
||||
if node == nil {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
if node.Func != nil {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
rv := make([]string, 0, len(node.Children))
|
||||
for name := range node.Children {
|
||||
rv = append(rv, name)
|
||||
}
|
||||
return rv, nil
|
||||
}
|
||||
|
||||
type _bintree_t struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*_bintree_t
|
||||
}
|
||||
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{
|
||||
}},
|
||||
}},
|
||||
"b": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_b_test_asset, map[string]*_bintree_t{
|
||||
}},
|
||||
}},
|
||||
"c": &_bintree_t{nil, map[string]*_bintree_t{
|
||||
"test.asset": &_bintree_t{in_c_test_asset, map[string]*_bintree_t{
|
||||
}},
|
||||
}},
|
||||
"test.asset": &_bintree_t{in_test_asset, map[string]*_bintree_t{
|
||||
}},
|
||||
}},
|
||||
}}
|
||||
|
||||
// Restore an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
info, err := AssetInfo(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.MkdirAll(_filePath(dir, path.Dir(name)), os.FileMode(0755))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Restore assets under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
if err != nil { // File
|
||||
return RestoreAsset(dir, name)
|
||||
} else { // Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, path.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _filePath(dir, name string) string {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||||
}
|
||||
|
280
vendor/github.com/go-bindata/go-bindata/testdata/out/nocompress-memcopy.go
generated
vendored
Normal file
280
vendor/github.com/go-bindata/go-bindata/testdata/out/nocompress-memcopy.go
generated
vendored
Normal file
@ -0,0 +1,280 @@
|
||||
// Code generated for package main by go-bindata DO NOT EDIT.
|
||||
// sources:
|
||||
// in/a/test.asset
|
||||
// in/b/test.asset
|
||||
// in/c/test.asset
|
||||
// in/test.asset
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type asset struct {
|
||||
bytes []byte
|
||||
info os.FileInfo
|
||||
}
|
||||
|
||||
type bindataFileInfo struct {
|
||||
name string
|
||||
size int64
|
||||
mode os.FileMode
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
}
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
var _inATestAsset = []byte(`// sample file
|
||||
`)
|
||||
|
||||
func inATestAssetBytes() ([]byte, error) {
|
||||
return _inATestAsset, nil
|
||||
}
|
||||
|
||||
func inATestAsset() (*asset, error) {
|
||||
bytes, err := inATestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _inBTestAsset = []byte(`// sample file
|
||||
`)
|
||||
|
||||
func inBTestAssetBytes() ([]byte, error) {
|
||||
return _inBTestAsset, nil
|
||||
}
|
||||
|
||||
func inBTestAsset() (*asset, error) {
|
||||
bytes, err := inBTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/b/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _inCTestAsset = []byte(`// sample file
|
||||
`)
|
||||
|
||||
func inCTestAssetBytes() ([]byte, error) {
|
||||
return _inCTestAsset, nil
|
||||
}
|
||||
|
||||
func inCTestAsset() (*asset, error) {
|
||||
bytes, err := inCTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/c/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _inTestAsset = []byte(`// sample file
|
||||
`)
|
||||
|
||||
func inTestAssetBytes() ([]byte, error) {
|
||||
return _inTestAsset, nil
|
||||
}
|
||||
|
||||
func inTestAsset() (*asset, error) {
|
||||
bytes, err := inTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
// Asset loads and returns the asset for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
func Asset(name string) ([]byte, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.bytes, nil
|
||||
}
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
|
||||
// MustAsset is like Asset but panics when Asset would return an error.
|
||||
// It simplifies safe initialization of global variables.
|
||||
func MustAsset(name string) []byte {
|
||||
a, err := Asset(name)
|
||||
if err != nil {
|
||||
panic("asset: Asset(" + name + "): " + err.Error())
|
||||
}
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
// AssetInfo loads and returns the asset info for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
func AssetInfo(name string) (os.FileInfo, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.info, nil
|
||||
}
|
||||
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||||
}
|
||||
|
||||
// AssetNames returns the names of the assets.
|
||||
func AssetNames() []string {
|
||||
names := make([]string, 0, len(_bindata))
|
||||
for name := range _bindata {
|
||||
names = append(names, name)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"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
|
||||
// directory embedded in the file by go-bindata.
|
||||
// For example if you run go-bindata on data/... and data contains the
|
||||
// following hierarchy:
|
||||
// data/
|
||||
// foo.txt
|
||||
// img/
|
||||
// a.png
|
||||
// b.png
|
||||
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
||||
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||||
// AssetDir("") will return []string{"data"}.
|
||||
func AssetDir(name string) ([]string, error) {
|
||||
node := _bintree
|
||||
if len(name) != 0 {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
pathList := strings.Split(cannonicalName, "/")
|
||||
for _, p := range pathList {
|
||||
node = node.Children[p]
|
||||
if node == nil {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
if node.Func != nil {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
rv := make([]string, 0, len(node.Children))
|
||||
for childName := range node.Children {
|
||||
rv = append(rv, childName)
|
||||
}
|
||||
return rv, nil
|
||||
}
|
||||
|
||||
type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*bintree
|
||||
}
|
||||
|
||||
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{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inBTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
"c": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inCTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
"test.asset": &bintree{inTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
info, err := AssetInfo(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
// File
|
||||
if err != nil {
|
||||
return RestoreAsset(dir, name)
|
||||
}
|
||||
// Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, filepath.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _filePath(dir, name string) string {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||||
}
|
301
vendor/github.com/go-bindata/go-bindata/testdata/out/nocompress-nomemcopy.go
generated
vendored
Normal file
301
vendor/github.com/go-bindata/go-bindata/testdata/out/nocompress-nomemcopy.go
generated
vendored
Normal file
@ -0,0 +1,301 @@
|
||||
// Code generated by go-bindata DO NOT EDIT.
|
||||
// sources:
|
||||
// in/a/test.asset
|
||||
// in/b/test.asset
|
||||
// in/c/test.asset
|
||||
// in/test.asset
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func bindataRead(data, name string) ([]byte, error) {
|
||||
var empty [0]byte
|
||||
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
||||
b := empty[:]
|
||||
bx := (*reflect.SliceHeader)(unsafe.Pointer(&b))
|
||||
bx.Data = sx.Data
|
||||
bx.Len = len(data)
|
||||
bx.Cap = bx.Len
|
||||
return b, nil
|
||||
}
|
||||
|
||||
type asset struct {
|
||||
bytes []byte
|
||||
info os.FileInfo
|
||||
}
|
||||
|
||||
type bindataFileInfo struct {
|
||||
name string
|
||||
size int64
|
||||
mode os.FileMode
|
||||
modTime time.Time
|
||||
}
|
||||
|
||||
func (fi bindataFileInfo) Name() string {
|
||||
return fi.name
|
||||
}
|
||||
func (fi bindataFileInfo) Size() int64 {
|
||||
return fi.size
|
||||
}
|
||||
func (fi bindataFileInfo) Mode() os.FileMode {
|
||||
return fi.mode
|
||||
}
|
||||
func (fi bindataFileInfo) ModTime() time.Time {
|
||||
return fi.modTime
|
||||
}
|
||||
func (fi bindataFileInfo) IsDir() bool {
|
||||
return false
|
||||
}
|
||||
func (fi bindataFileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
var _inATestAsset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a"
|
||||
|
||||
func inATestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inATestAsset,
|
||||
"in/a/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func inATestAsset() (*asset, error) {
|
||||
bytes, err := inATestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _inBTestAsset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a"
|
||||
|
||||
func inBTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inBTestAsset,
|
||||
"in/b/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func inBTestAsset() (*asset, error) {
|
||||
bytes, err := inBTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/b/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _inCTestAsset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a"
|
||||
|
||||
func inCTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inCTestAsset,
|
||||
"in/c/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func inCTestAsset() (*asset, error) {
|
||||
bytes, err := inCTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/c/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _inTestAsset = "\x2f\x2f\x20\x73\x61\x6d\x70\x6c\x65\x20\x66\x69\x6c\x65\x0a"
|
||||
|
||||
func inTestAssetBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_inTestAsset,
|
||||
"in/test.asset",
|
||||
)
|
||||
}
|
||||
|
||||
func inTestAsset() (*asset, error) {
|
||||
bytes, err := inTestAssetBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "in/test.asset", size: 15, mode: os.FileMode(436), modTime: time.Unix(1445582844, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
// Asset loads and returns the asset for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
func Asset(name string) ([]byte, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.bytes, nil
|
||||
}
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
|
||||
// MustAsset is like Asset but panics when Asset would return an error.
|
||||
// It simplifies safe initialization of global variables.
|
||||
func MustAsset(name string) []byte {
|
||||
a, err := Asset(name)
|
||||
if err != nil {
|
||||
panic("asset: Asset(" + name + "): " + err.Error())
|
||||
}
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
// AssetInfo loads and returns the asset info for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
func AssetInfo(name string) (os.FileInfo, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
a, err := f()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
|
||||
}
|
||||
return a.info, nil
|
||||
}
|
||||
return nil, fmt.Errorf("AssetInfo %s not found", name)
|
||||
}
|
||||
|
||||
// AssetNames returns the names of the assets.
|
||||
func AssetNames() []string {
|
||||
names := make([]string, 0, len(_bindata))
|
||||
for name := range _bindata {
|
||||
names = append(names, name)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"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
|
||||
// directory embedded in the file by go-bindata.
|
||||
// For example if you run go-bindata on data/... and data contains the
|
||||
// following hierarchy:
|
||||
// data/
|
||||
// foo.txt
|
||||
// img/
|
||||
// a.png
|
||||
// b.png
|
||||
// then AssetDir("data") would return []string{"foo.txt", "img"}
|
||||
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||||
// AssetDir("") will return []string{"data"}.
|
||||
func AssetDir(name string) ([]string, error) {
|
||||
node := _bintree
|
||||
if len(name) != 0 {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
pathList := strings.Split(cannonicalName, "/")
|
||||
for _, p := range pathList {
|
||||
node = node.Children[p]
|
||||
if node == nil {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
if node.Func != nil {
|
||||
return nil, fmt.Errorf("Asset %s not found", name)
|
||||
}
|
||||
rv := make([]string, 0, len(node.Children))
|
||||
for childName := range node.Children {
|
||||
rv = append(rv, childName)
|
||||
}
|
||||
return rv, nil
|
||||
}
|
||||
|
||||
type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*bintree
|
||||
}
|
||||
|
||||
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{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inBTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
"c": &bintree{nil, map[string]*bintree{
|
||||
"test.asset": &bintree{inCTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
"test.asset": &bintree{inTestAsset, map[string]*bintree{}},
|
||||
}},
|
||||
}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
data, err := Asset(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
info, err := AssetInfo(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RestoreAssets restores an asset under the given directory recursively
|
||||
func RestoreAssets(dir, name string) error {
|
||||
children, err := AssetDir(name)
|
||||
// File
|
||||
if err != nil {
|
||||
return RestoreAsset(dir, name)
|
||||
}
|
||||
// Dir
|
||||
for _, child := range children {
|
||||
err = RestoreAssets(dir, filepath.Join(name, child))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _filePath(dir, name string) string {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
|
||||
}
|
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkFile/file1
generated
vendored
Symbolic link
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkFile/file1
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../symlinkSrc/file1
|
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkParent/symlinkTarget
generated
vendored
Symbolic link
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkParent/symlinkTarget
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../symlinkSrc/
|
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkRecursiveParent/file1
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkRecursiveParent/file1
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
// test file 1
|
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkRecursiveParent/symlinkTarget
generated
vendored
Symbolic link
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkRecursiveParent/symlinkTarget
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../symlinkRecursiveParent/
|
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkSrc/file1
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkSrc/file1
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
// symlink file 1
|
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkSrc/file2
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkSrc/file2
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
// symlink file 2
|
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkSrc/file3
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkSrc/file3
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
// symlink file 3
|
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkSrc/file4
generated
vendored
Normal file
1
vendor/github.com/go-bindata/go-bindata/testdata/symlinkSrc/file4
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
// symlink file 4
|
@ -52,6 +52,40 @@ func (root *assetTree) funcOrNil() string {
|
||||
}
|
||||
}
|
||||
|
||||
func getFillerSize(tokenIndex int, lengths []int, nident int) int {
|
||||
var (
|
||||
curlen int = lengths[tokenIndex]
|
||||
maxlen int = 0
|
||||
substart int = 0
|
||||
subend int = 0
|
||||
spacediff int = 0
|
||||
)
|
||||
|
||||
if curlen > 0 {
|
||||
substart = tokenIndex
|
||||
for (substart-1) >= 0 && lengths[substart-1] > 0 {
|
||||
substart -= 1
|
||||
}
|
||||
|
||||
subend = tokenIndex
|
||||
for (subend+1) < len(lengths) && lengths[subend+1] > 0 {
|
||||
subend += 1
|
||||
}
|
||||
|
||||
var candidate int
|
||||
for j := substart; j <= subend; j += 1 {
|
||||
candidate = lengths[j]
|
||||
if candidate > maxlen {
|
||||
maxlen = candidate
|
||||
}
|
||||
}
|
||||
|
||||
spacediff = maxlen - curlen
|
||||
}
|
||||
|
||||
return spacediff
|
||||
}
|
||||
|
||||
func (root *assetTree) writeGoMap(w io.Writer, nident int) {
|
||||
fmt.Fprintf(w, "&bintree{%s, map[string]*bintree{", root.funcOrNil())
|
||||
|
||||
@ -60,16 +94,28 @@ func (root *assetTree) writeGoMap(w io.Writer, nident int) {
|
||||
|
||||
// Sort to make output stable between invocations
|
||||
filenames := make([]string, len(root.Children))
|
||||
hasChildren := make(map[string]bool)
|
||||
i := 0
|
||||
for filename, _ := range root.Children {
|
||||
for filename, node := range root.Children {
|
||||
filenames[i] = filename
|
||||
hasChildren[filename] = len(node.Children) > 0
|
||||
i++
|
||||
}
|
||||
sort.Strings(filenames)
|
||||
|
||||
for _, p := range filenames {
|
||||
lengths := make([]int, len(root.Children))
|
||||
for i, filename := range filenames {
|
||||
if hasChildren[filename] {
|
||||
lengths[i] = 0
|
||||
} else {
|
||||
lengths[i] = len(filename)
|
||||
}
|
||||
}
|
||||
|
||||
for i, p := range filenames {
|
||||
ident(w, nident+1)
|
||||
fmt.Fprintf(w, `"%s": `, p)
|
||||
filler := strings.Repeat(" ", getFillerSize(i, lengths, nident))
|
||||
fmt.Fprintf(w, `"%s": %s`, p, filler)
|
||||
root.Children[p].writeGoMap(w, nident+1)
|
||||
}
|
||||
ident(w, nident)
|
||||
@ -87,6 +133,7 @@ func (root *assetTree) WriteAsGoMap(w io.Writer) error {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*bintree
|
||||
}
|
||||
|
||||
var _bintree = `)
|
||||
root.writeGoMap(w, 0)
|
||||
return err
|
||||
@ -147,8 +194,16 @@ func writeTOC(w io.Writer, toc []Asset) error {
|
||||
return err
|
||||
}
|
||||
|
||||
var maxlen = 0
|
||||
for i := range toc {
|
||||
err = writeTOCAsset(w, &toc[i])
|
||||
l := len(toc[i].Name)
|
||||
if l > maxlen {
|
||||
maxlen = l
|
||||
}
|
||||
}
|
||||
|
||||
for i := range toc {
|
||||
err = writeTOCAsset(w, &toc[i], maxlen)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -216,8 +271,11 @@ var _bindata = map[string]func() (*asset, error){
|
||||
}
|
||||
|
||||
// writeTOCAsset write a TOC entry for the given asset.
|
||||
func writeTOCAsset(w io.Writer, asset *Asset) error {
|
||||
_, err := fmt.Fprintf(w, "\t%q: %s,\n", asset.Name, asset.Func)
|
||||
func writeTOCAsset(w io.Writer, asset *Asset, maxlen int) error {
|
||||
spacediff := maxlen - len(asset.Name)
|
||||
filler := strings.Repeat(" ", spacediff)
|
||||
|
||||
_, err := fmt.Fprintf(w, "\t%q: %s%s,\n", asset.Name, filler, asset.Func)
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user