github.com/core-coin/go-core/v2@v2.1.9/signer/fourbyte/4byte.go (about) 1 // Code generated by go-bindata. DO NOT EDIT. 2 // sources: 3 // 4byte.json (3B) 4 5 package fourbyte 6 7 import ( 8 "crypto/sha256" 9 "fmt" 10 "io/ioutil" 11 "os" 12 "path/filepath" 13 "strings" 14 "time" 15 ) 16 17 type asset struct { 18 bytes []byte 19 info os.FileInfo 20 digest [sha256.Size]byte 21 } 22 23 type bindataFileInfo struct { 24 name string 25 size int64 26 mode os.FileMode 27 modTime time.Time 28 } 29 30 func (fi bindataFileInfo) Name() string { 31 return fi.name 32 } 33 func (fi bindataFileInfo) Size() int64 { 34 return fi.size 35 } 36 func (fi bindataFileInfo) Mode() os.FileMode { 37 return fi.mode 38 } 39 func (fi bindataFileInfo) ModTime() time.Time { 40 return fi.modTime 41 } 42 func (fi bindataFileInfo) IsDir() bool { 43 return false 44 } 45 func (fi bindataFileInfo) Sys() interface{} { 46 return nil 47 } 48 49 //nolint:misspell 50 var __4byteJson = []byte(`{ 51 }`) 52 53 func _4byteJsonBytes() ([]byte, error) { 54 return __4byteJson, nil 55 } 56 57 func _4byteJson() (*asset, error) { 58 bytes, err := _4byteJsonBytes() 59 if err != nil { 60 return nil, err 61 } 62 63 info := bindataFileInfo{name: "4byte.json", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 64 a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x8e, 0xb9, 0x5b, 0xcb, 0xc1, 0x54, 0x53, 0x9, 0x31, 0xe1, 0x5f, 0xc4, 0x18, 0xc8, 0xb1, 0xfe, 0x99, 0x10, 0x95, 0x67, 0x14, 0x9, 0x55, 0x20, 0x99, 0xea, 0x1a, 0xa5, 0x96, 0x99, 0x9e, 0xde}} 65 return a, nil 66 } 67 68 // Asset loads and returns the asset for the given name. 69 // It returns an error if the asset could not be found or 70 // could not be loaded. 71 func Asset(name string) ([]byte, error) { 72 canonicalName := strings.Replace(name, "\\", "/", -1) 73 if f, ok := _bindata[canonicalName]; ok { 74 a, err := f() 75 if err != nil { 76 return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) 77 } 78 return a.bytes, nil 79 } 80 return nil, fmt.Errorf("Asset %s not found", name) 81 } 82 83 // AssetString returns the asset contents as a string (instead of a []byte). 84 func AssetString(name string) (string, error) { 85 data, err := Asset(name) 86 return string(data), err 87 } 88 89 // MustAsset is like Asset but panics when Asset would return an error. 90 // It simplifies safe initialization of global variables. 91 func MustAsset(name string) []byte { 92 a, err := Asset(name) 93 if err != nil { 94 panic("asset: Asset(" + name + "): " + err.Error()) 95 } 96 97 return a 98 } 99 100 // MustAssetString is like AssetString but panics when Asset would return an 101 // error. It simplifies safe initialization of global variables. 102 func MustAssetString(name string) string { 103 return string(MustAsset(name)) 104 } 105 106 // AssetInfo loads and returns the asset info for the given name. 107 // It returns an error if the asset could not be found or 108 // could not be loaded. 109 func AssetInfo(name string) (os.FileInfo, error) { 110 canonicalName := strings.Replace(name, "\\", "/", -1) 111 if f, ok := _bindata[canonicalName]; ok { 112 a, err := f() 113 if err != nil { 114 return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) 115 } 116 return a.info, nil 117 } 118 return nil, fmt.Errorf("AssetInfo %s not found", name) 119 } 120 121 // AssetDigest returns the digest of the file with the given name. It returns an 122 // error if the asset could not be found or the digest could not be loaded. 123 func AssetDigest(name string) ([sha256.Size]byte, error) { 124 canonicalName := strings.Replace(name, "\\", "/", -1) 125 if f, ok := _bindata[canonicalName]; ok { 126 a, err := f() 127 if err != nil { 128 return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) 129 } 130 return a.digest, nil 131 } 132 return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) 133 } 134 135 // Digests returns a map of all known files and their checksums. 136 func Digests() (map[string][sha256.Size]byte, error) { 137 mp := make(map[string][sha256.Size]byte, len(_bindata)) 138 for name := range _bindata { 139 a, err := _bindata[name]() 140 if err != nil { 141 return nil, err 142 } 143 mp[name] = a.digest 144 } 145 return mp, nil 146 } 147 148 // AssetNames returns the names of the assets. 149 func AssetNames() []string { 150 names := make([]string, 0, len(_bindata)) 151 for name := range _bindata { 152 names = append(names, name) 153 } 154 return names 155 } 156 157 // _bindata is a table, holding each asset generator, mapped to its name. 158 var _bindata = map[string]func() (*asset, error){ 159 "4byte.json": _4byteJson, 160 } 161 162 // AssetDebug is true if the assets were built with the debug flag enabled. 163 const AssetDebug = false 164 165 // AssetDir returns the file names below a certain 166 // directory embedded in the file by go-bindata. 167 // For example if you run go-bindata on data/... and data contains the 168 // following hierarchy: 169 // 170 // data/ 171 // foo.txt 172 // img/ 173 // a.png 174 // b.png 175 // 176 // then AssetDir("data") would return []string{"foo.txt", "img"}, 177 // AssetDir("data/img") would return []string{"a.png", "b.png"}, 178 // AssetDir("foo.txt") and AssetDir("notexist") would return an error, and 179 // AssetDir("") will return []string{"data"}. 180 func AssetDir(name string) ([]string, error) { 181 node := _bintree 182 if len(name) != 0 { 183 canonicalName := strings.Replace(name, "\\", "/", -1) 184 pathList := strings.Split(canonicalName, "/") 185 for _, p := range pathList { 186 node = node.Children[p] 187 if node == nil { 188 return nil, fmt.Errorf("Asset %s not found", name) 189 } 190 } 191 } 192 if node.Func != nil { 193 return nil, fmt.Errorf("Asset %s not found", name) 194 } 195 rv := make([]string, 0, len(node.Children)) 196 for childName := range node.Children { 197 rv = append(rv, childName) 198 } 199 return rv, nil 200 } 201 202 type bintree struct { 203 Func func() (*asset, error) 204 Children map[string]*bintree 205 } 206 207 var _bintree = &bintree{nil, map[string]*bintree{ 208 "4byte.json": {_4byteJson, map[string]*bintree{}}, 209 }} 210 211 // RestoreAsset restores an asset under the given directory. 212 func RestoreAsset(dir, name string) error { 213 data, err := Asset(name) 214 if err != nil { 215 return err 216 } 217 info, err := AssetInfo(name) 218 if err != nil { 219 return err 220 } 221 err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) 222 if err != nil { 223 return err 224 } 225 err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) 226 if err != nil { 227 return err 228 } 229 return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) 230 } 231 232 // RestoreAssets restores an asset under the given directory recursively. 233 func RestoreAssets(dir, name string) error { 234 children, err := AssetDir(name) 235 // File 236 if err != nil { 237 return RestoreAsset(dir, name) 238 } 239 // Dir 240 for _, child := range children { 241 err = RestoreAssets(dir, filepath.Join(name, child)) 242 if err != nil { 243 return err 244 } 245 } 246 return nil 247 } 248 249 func _filePath(dir, name string) string { 250 canonicalName := strings.Replace(name, "\\", "/", -1) 251 return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) 252 }