updating github.com/go-bindata/go-bindata to v3.1.1
Change-Id: I66c047a4e5e72632042f43a9f4b33ab9f5bf7ef1
This commit is contained in:
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
|
@@ -9,13 +9,14 @@ go_library(
|
||||
"convert.go",
|
||||
"debug.go",
|
||||
"doc.go",
|
||||
"file.go",
|
||||
"release.go",
|
||||
"restore.go",
|
||||
"stringwriter.go",
|
||||
"toc.go",
|
||||
],
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata",
|
||||
importpath = "github.com/jteeuwen/go-bindata",
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/go-bindata/go-bindata",
|
||||
importpath = "github.com/go-bindata/go-bindata",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
@@ -30,7 +31,7 @@ filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [
|
||||
":package-srcs",
|
||||
"//vendor/github.com/jteeuwen/go-bindata/go-bindata:all-srcs",
|
||||
"//vendor/github.com/go-bindata/go-bindata/go-bindata:all-srcs",
|
||||
],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
@@ -1,5 +1,7 @@
|
||||
## 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
|
@@ -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, "// Package %s Code generated by go-bindata. (@generated) DO NOT EDIT.\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) }
|
@@ -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
|
@@ -7,10 +7,10 @@ go_library(
|
||||
"main.go",
|
||||
"version.go",
|
||||
],
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/jteeuwen/go-bindata/go-bindata",
|
||||
importpath = "github.com/jteeuwen/go-bindata/go-bindata",
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/go-bindata/go-bindata/go-bindata",
|
||||
importpath = "github.com/go-bindata/go-bindata/go-bindata",
|
||||
visibility = ["//visibility:private"],
|
||||
deps = ["//vendor/github.com/jteeuwen/go-bindata:go_default_library"],
|
||||
deps = ["//vendor/github.com/go-bindata/go-bindata:go_default_library"],
|
||||
)
|
||||
|
||||
go_binary(
|
@@ -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 = "1"
|
||||
}
|
||||
|
||||
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
|
||||
}
|
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user