Do not replace fmt.Errorf in generated file

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2017-03-27 18:33:41 -07:00
parent d26a23ceb8
commit 96e610e67a
1 changed files with 10 additions and 11 deletions

View File

@ -10,20 +10,19 @@ package schema
import ( import (
"bytes" "bytes"
"compress/gzip" "compress/gzip"
"fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
"github.com/pkg/errors"
) )
func bindataRead(data []byte, name string) ([]byte, error) { func bindataRead(data []byte, name string) ([]byte, error) {
gz, err := gzip.NewReader(bytes.NewBuffer(data)) gz, err := gzip.NewReader(bytes.NewBuffer(data))
if err != nil { if err != nil {
return nil, errors.Errorf("Read %q: %v", name, err) return nil, fmt.Errorf("Read %q: %v", name, err)
} }
var buf bytes.Buffer var buf bytes.Buffer
@ -31,7 +30,7 @@ func bindataRead(data []byte, name string) ([]byte, error) {
clErr := gz.Close() clErr := gz.Close()
if err != nil { if err != nil {
return nil, errors.Errorf("Read %q: %v", name, err) return nil, fmt.Errorf("Read %q: %v", name, err)
} }
if clErr != nil { if clErr != nil {
return nil, err return nil, err
@ -139,11 +138,11 @@ func Asset(name string) ([]byte, error) {
if f, ok := _bindata[cannonicalName]; ok { if f, ok := _bindata[cannonicalName]; ok {
a, err := f() a, err := f()
if err != nil { if err != nil {
return nil, errors.Errorf("Asset %s can't read by error: %v", name, err) return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
} }
return a.bytes, nil return a.bytes, nil
} }
return nil, errors.Errorf("Asset %s not found", name) return nil, fmt.Errorf("Asset %s not found", name)
} }
// MustAsset is like Asset but panics when Asset would return an error. // MustAsset is like Asset but panics when Asset would return an error.
@ -165,11 +164,11 @@ func AssetInfo(name string) (os.FileInfo, error) {
if f, ok := _bindata[cannonicalName]; ok { if f, ok := _bindata[cannonicalName]; ok {
a, err := f() a, err := f()
if err != nil { if err != nil {
return nil, errors.Errorf("AssetInfo %s can't read by error: %v", name, err) return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
} }
return a.info, nil return a.info, nil
} }
return nil, errors.Errorf("AssetInfo %s not found", name) return nil, fmt.Errorf("AssetInfo %s not found", name)
} }
// AssetNames returns the names of the assets. // AssetNames returns the names of the assets.
@ -209,12 +208,12 @@ func AssetDir(name string) ([]string, error) {
for _, p := range pathList { for _, p := range pathList {
node = node.Children[p] node = node.Children[p]
if node == nil { if node == nil {
return nil, errors.Errorf("Asset %s not found", name) return nil, fmt.Errorf("Asset %s not found", name)
} }
} }
} }
if node.Func != nil { if node.Func != nil {
return nil, errors.Errorf("Asset %s not found", name) return nil, fmt.Errorf("Asset %s not found", name)
} }
rv := make([]string, 0, len(node.Children)) rv := make([]string, 0, len(node.Children))
for childName := range node.Children { for childName := range node.Children {
@ -227,7 +226,6 @@ type bintree struct {
Func func() (*asset, error) Func func() (*asset, error)
Children map[string]*bintree Children map[string]*bintree
} }
var _bintree = &bintree{nil, map[string]*bintree{ var _bintree = &bintree{nil, map[string]*bintree{
"data": &bintree{nil, map[string]*bintree{ "data": &bintree{nil, map[string]*bintree{
"config_schema_v3.0.json": &bintree{dataConfig_schema_v30Json, map[string]*bintree{}}, "config_schema_v3.0.json": &bintree{dataConfig_schema_v30Json, map[string]*bintree{}},
@ -282,3 +280,4 @@ func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1) cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
} }