assets.go 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. // Code generated by go-bindata.
  2. // sources:
  3. // .DS_Store
  4. // BUILD
  5. // assets.go
  6. // client.tmpl
  7. // server.tmpl
  8. // service.tmpl
  9. // template.go
  10. // DO NOT EDIT!
  11. package templates
  12. import (
  13. "bytes"
  14. "compress/gzip"
  15. "fmt"
  16. "io"
  17. "io/ioutil"
  18. "os"
  19. "path/filepath"
  20. "strings"
  21. "time"
  22. )
  23. func bindataRead(data []byte, name string) ([]byte, error) {
  24. gz, err := gzip.NewReader(bytes.NewBuffer(data))
  25. if err != nil {
  26. return nil, fmt.Errorf("Read %q: %v", name, err)
  27. }
  28. var buf bytes.Buffer
  29. _, err = io.Copy(&buf, gz)
  30. clErr := gz.Close()
  31. if err != nil {
  32. return nil, fmt.Errorf("Read %q: %v", name, err)
  33. }
  34. if clErr != nil {
  35. return nil, err
  36. }
  37. return buf.Bytes(), nil
  38. }
  39. type asset struct {
  40. bytes []byte
  41. info os.FileInfo
  42. }
  43. type bindataFileInfo struct {
  44. name string
  45. size int64
  46. mode os.FileMode
  47. modTime time.Time
  48. }
  49. func (fi bindataFileInfo) Name() string {
  50. return fi.name
  51. }
  52. func (fi bindataFileInfo) Size() int64 {
  53. return fi.size
  54. }
  55. func (fi bindataFileInfo) Mode() os.FileMode {
  56. return fi.mode
  57. }
  58. func (fi bindataFileInfo) ModTime() time.Time {
  59. return fi.modTime
  60. }
  61. func (fi bindataFileInfo) IsDir() bool {
  62. return false
  63. }
  64. func (fi bindataFileInfo) Sys() interface{} {
  65. return nil
  66. }
  67. var _Ds_store = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xd8\x31\x0a\x02\x31\x10\x85\xe1\x37\x31\x45\xc0\x26\xa5\x65\x1a\x0f\xe0\x0d\xc2\xb2\x9e\xc0\x0b\x58\x78\x05\xfb\x1c\x5d\x96\x79\x60\x60\xd5\x4e\x8c\xcb\xfb\x40\xfe\x05\x37\x2a\x16\x31\x23\x00\x9b\xee\xb7\x13\x90\x01\x24\x78\x71\xc4\x4b\x89\x8f\x95\xd0\x5d\x1b\x5f\x43\x44\x44\x44\xc6\x66\x9e\xb4\xff\xf5\x07\x11\x91\xe1\x2c\xfb\x43\x61\x2b\xdb\xbc\xc6\xe7\x03\x1b\xbb\x35\x99\x2d\x6c\x65\x9b\xd7\x78\x5f\x60\x23\x9b\xd8\xcc\x16\xb6\xb2\xcd\xcb\x4d\xcb\x38\x7c\x18\xdf\xd9\x38\xa1\x18\xa7\x10\x2b\x6c\xfd\xce\x77\x23\xf2\xef\x76\x9e\xbc\xfc\xfe\x9f\xdf\xcf\xff\x22\xb2\x61\x16\xe7\xcb\x3c\x3d\x07\x82\xf5\x0d\x00\xae\xdd\xf5\xa7\x43\x40\xf0\x3f\x0b\x0f\xdd\x5a\x1d\x04\x44\x06\xf3\x08\x00\x00\xff\xff\x6a\x00\x88\x6d\x04\x18\x00\x00")
  68. func Ds_storeBytes() ([]byte, error) {
  69. return bindataRead(
  70. _Ds_store,
  71. ".DS_Store",
  72. )
  73. }
  74. func Ds_store() (*asset, error) {
  75. bytes, err := Ds_storeBytes()
  76. if err != nil {
  77. return nil, err
  78. }
  79. info := bindataFileInfo{name: ".DS_Store", size: 6148, mode: os.FileMode(420), modTime: time.Unix(1530586172, 0)}
  80. a := &asset{bytes: bytes, info: info}
  81. return a, nil
  82. }
  83. var _build = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x91\x41\x6b\xc3\x30\x0c\x85\xef\xf9\x15\xc6\xa7\xb6\xb4\xf5\xbd\x50\xd8\xff\x28\x21\xc8\x89\xea\x99\xc9\x91\xb1\x95\x8e\xf6\xd7\x8f\x38\x29\x21\x50\xb6\xc1\x76\x32\x7a\x3c\x9e\xbe\x27\x13\x43\xb7\xa9\x94\x52\x4a\xbf\x79\x6e\x2c\x3c\x90\x9a\x34\x10\xe6\xc6\xb1\x31\x31\xb1\xf0\xa9\xc3\xeb\xd1\x3e\x48\xef\x27\xa3\xe3\xa6\xe8\x0d\x79\x9b\x20\xdd\xf5\xbe\xda\x56\x55\x84\xf6\x03\x1c\x6e\x3a\xbc\xc2\x40\xd2\xdc\x7c\xf6\xd6\x93\x97\xbb\x3a\xab\x8b\x36\x66\x11\x4e\x71\xb0\xe4\x5b\x5d\x6f\xab\xea\x07\x00\xf7\x6a\xfb\x6a\xef\x32\x4f\x31\x3d\x04\x54\xe7\xe2\x7b\xa2\x2c\xfe\xd1\x90\x53\x9b\x47\xa4\x32\x94\x48\xc8\x19\x25\x1f\x1d\xcf\x8e\x22\x0a\x86\x48\x20\xb8\xc8\xf5\xf4\xf8\x10\x39\x49\x04\x79\x9f\xd6\x1c\x5a\x0e\x81\x7b\x03\x31\x1a\x61\x26\xf3\x09\xa9\xc3\xde\x38\xec\x31\x81\x70\x32\xcf\xa8\x3c\x07\x09\xb8\x42\xa0\x61\x10\x0e\xd0\x83\xc3\x4e\xcf\xe9\xbf\x39\x5b\xe9\x7d\xf5\x84\x2e\xf1\x10\xd7\xb5\xe7\x6f\x38\x8c\x2d\xd7\x85\x1d\xb1\xdd\x5c\xf4\x6e\xa7\xeb\xed\x1f\x39\x92\xbf\x81\xe0\xf7\x20\x40\xf4\x02\xe2\xa2\x4f\x2b\xc2\xfa\xff\x2e\xf2\x15\x00\x00\xff\xff\xe0\x55\x93\x84\xcb\x02\x00\x00")
  84. func buildBytes() ([]byte, error) {
  85. return bindataRead(
  86. _build,
  87. "BUILD",
  88. )
  89. }
  90. func build() (*asset, error) {
  91. bytes, err := buildBytes()
  92. if err != nil {
  93. return nil, err
  94. }
  95. info := bindataFileInfo{name: "BUILD", size: 715, mode: os.FileMode(420), modTime: time.Unix(1534390180, 0)}
  96. a := &asset{bytes: bytes, info: info}
  97. return a, nil
  98. }
  99. var _assetsGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00")
  100. func assetsGoBytes() ([]byte, error) {
  101. return bindataRead(
  102. _assetsGo,
  103. "assets.go",
  104. )
  105. }
  106. func assetsGo() (*asset, error) {
  107. bytes, err := assetsGoBytes()
  108. if err != nil {
  109. return nil, err
  110. }
  111. info := bindataFileInfo{name: "assets.go", size: 4096, mode: os.FileMode(420), modTime: time.Unix(1535625546, 0)}
  112. a := &asset{bytes: bytes, info: info}
  113. return a, nil
  114. }
  115. var _clientTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x52\x4b\x6b\xdc\x30\x10\x3e\xaf\x7e\xc5\xd4\xa4\xc5\x0a\x5b\x09\x92\x5b\x20\x97\x24\x97\x1c\x9a\x84\xb6\xd0\x63\x91\xe5\xb1\x22\x62\x4b\x62\x56\x1b\x77\x11\xfa\xef\x45\x7e\x85\xa6\x94\x5e\x8c\x3c\xaf\xef\x31\x23\x25\x3c\x29\xfd\xa2\x0c\x82\xee\x2d\xba\x08\x06\x1d\x92\x8a\x08\xcd\x09\x46\x45\x2d\xba\x9f\x06\x1d\x0b\x7f\x54\x31\x66\x87\xe0\x29\x42\xcd\x00\x00\xaa\x6e\x88\xd5\xf4\x4a\x89\x94\x33\x08\x67\x2f\x78\xda\xc3\xd9\xab\xea\x8f\x08\x57\xd7\x20\xee\xa7\xfa\x43\xce\x55\x4a\x25\x99\xf3\xda\x80\xae\xcd\xf9\x9f\x7d\xb7\x13\xde\x7f\xba\xa7\x77\x68\xa0\x4a\x49\x3c\x35\x8b\xa0\xb5\xa6\x32\xfe\xb3\xf6\xc3\xe0\x9d\x74\x18\x25\x05\x2d\x67\x5d\x7f\xa5\x55\x08\x4b\x4a\x36\xaa\x57\x4e\x23\xc9\x91\x68\xab\xf3\xa6\x47\x61\x7c\xaf\x9c\x11\x9e\x8c\x34\x14\x74\xc5\x38\x63\xda\xbb\xc3\xea\x45\x24\xc4\xfb\x3b\xb8\x86\x8b\x8b\xcb\xcb\x92\x94\x12\x1e\x70\x84\x94\xc4\x83\x1a\x30\x67\x38\x20\xbd\x5a\xbd\x59\xd9\x1d\x9d\x2e\x15\xb5\xf6\xae\x83\xf3\x99\xc0\xa2\xfb\xd6\xbb\xce\x1a\x0e\xe7\xf3\x2f\x24\xb6\x8b\x8a\x0c\xc6\xe2\x4d\x37\x44\xf1\x2d\x90\x75\xb1\xab\xab\xd6\x1e\xb4\x7f\x45\x3a\x5d\x49\xd9\x62\xa7\x8e\x7d\x94\x1f\xdb\x6a\xbf\xf0\xe1\x6c\x37\xea\xd2\xb4\x8c\x7f\xc0\x71\x1e\x39\xa1\xee\xa1\x48\x11\x3f\x6c\x7c\xbe\x59\x84\x17\xae\xf5\x48\x34\x91\xe6\x9c\xed\xb4\x77\x6e\x0f\x48\x34\x4d\xd1\xe2\xce\xaa\xbe\x34\x47\xfc\x15\xc5\xf7\xc7\xbb\xc7\x9a\xef\x61\x26\xc7\xd9\xce\x76\x53\xe9\x87\x6b\x70\xb6\x2f\xb4\x77\x41\x39\xab\x6b\x24\xe2\x6c\x37\x2f\x8c\x30\x1e\xc9\xc1\xa7\x99\x48\x0a\x4d\x61\xb5\xd9\xf4\x46\xcf\xf1\xcc\x32\x9b\x8c\x5c\x6c\x78\xe7\x60\x3c\x05\xdc\x52\x91\x8e\xba\x18\x55\x10\x8a\xaa\x25\x1e\x1a\xf1\x6e\x74\x99\xb9\x9e\x9d\xf8\x82\xf1\xd9\xb7\x87\x9c\x0b\xca\x16\xbd\xf5\xc3\x80\xae\xdc\x5d\x4a\xa2\x7c\xe6\x6b\x9b\x36\x56\xeb\x75\x2b\xfc\x6d\xb7\x75\x39\x40\x45\x6a\xb8\xe9\xbd\x7e\xc9\x99\x43\x89\x7c\x9d\x84\x6e\xa1\x99\xdb\xec\x47\xe5\x7c\x04\x3b\x84\x1e\x0b\x10\xb6\x15\x67\x99\xad\x38\xbf\x03\x00\x00\xff\xff\x3e\xef\xaf\x37\x9d\x03\x00\x00")
  116. func clientTmplBytes() ([]byte, error) {
  117. return bindataRead(
  118. _clientTmpl,
  119. "client.tmpl",
  120. )
  121. }
  122. func clientTmpl() (*asset, error) {
  123. bytes, err := clientTmplBytes()
  124. if err != nil {
  125. return nil, err
  126. }
  127. info := bindataFileInfo{name: "client.tmpl", size: 925, mode: os.FileMode(420), modTime: time.Unix(1535625483, 0)}
  128. a := &asset{bytes: bytes, info: info}
  129. return a, nil
  130. }
  131. var _serverTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x92\xcf\x8a\xdb\x30\x10\xc6\xcf\x99\xa7\x18\xcc\x52\xec\x90\xca\xf7\xc2\x9e\x72\xea\xa1\x61\x49\x1f\x60\x91\x95\x59\xd7\x6c\x2c\x69\x47\x8a\xbd\x46\xe8\xdd\x8b\x24\xc7\x34\x0b\xbd\x24\x66\xbe\xf9\xf3\x9b\x6f\xd4\xb6\xf8\x22\xd5\xbb\xec\x09\x1d\xf1\x44\x8c\x3d\x69\x62\xe9\x09\xbb\x05\x67\xc9\x17\xd2\xaf\x3d\x69\xb0\x0f\x59\x00\xc3\x68\x0d\x7b\xac\x01\x11\x31\x04\x96\xba\x27\x7c\x7a\xa7\xe5\x80\x4f\x93\xbc\xde\x08\x7f\x3c\xa3\xf8\x99\xb3\x5c\x8c\x55\x08\x49\xcc\x1f\xa4\x2f\x31\x42\x2e\x4c\xdd\x06\x45\x58\x85\x20\xce\xa4\xa6\x95\x25\xc6\x2a\xcb\xb6\xcb\xca\x4b\xf7\x25\x5e\xf5\xe6\xbb\x32\xe3\x68\x74\x7b\x1d\x3a\x96\xbc\xb4\x9a\x7c\xcb\x56\xb5\x05\xb9\x82\x06\xa0\x6d\xf1\x44\x33\x86\x20\x4e\x72\xa4\x18\xd7\x75\x90\xad\xba\xaf\xf1\x76\xd3\x2a\x25\xd5\x0a\xf7\x45\x15\xbf\xb3\x72\x34\xfa\x6d\xe8\x0f\xe8\x26\xc6\xfd\x4a\x29\x56\xc8\xd2\xad\xc1\xfa\xb1\xa4\xc1\x00\xbb\xd9\xa5\xbd\xd7\xf8\x89\xe6\x22\xd5\xaa\x81\x9d\xed\xc4\x99\xfa\xc1\x79\xe2\x0d\x69\x95\x67\xb7\xf6\xa8\x9b\x03\x7e\x2b\x6c\xc1\x4d\x1c\x1b\xd8\x31\xf9\x1b\x6b\x9c\x1d\x44\x00\xbf\xd8\xed\x50\xce\xf3\x4d\x79\x0c\xc5\xc8\xff\x72\xa6\xb2\x49\x32\xbe\xa2\xed\xc4\x97\xc1\xf8\xbc\x4d\x8b\x00\xf7\x2b\x8a\x5f\xe4\xff\x98\x8b\x8b\x31\x59\xb8\x45\x8f\x66\x1c\x49\xa7\x63\x86\x20\xd2\x4f\xb9\x63\xb2\xb0\x76\x65\x78\x36\xe1\x3e\xa2\x56\xfe\x13\x95\xd1\x9e\x3e\xbd\x38\x96\xff\x03\x32\x7d\xe0\xfe\x5f\x92\x33\x7d\x24\x2b\x1f\x43\xf6\xba\x1c\x90\x98\x4d\x76\x35\x3f\x05\xa9\x07\x55\x57\xda\x78\x1c\x46\x7b\xa5\x84\x42\x97\xaa\x81\x08\xdb\x8b\xfa\x1b\x00\x00\xff\xff\xb2\x36\x1e\x59\xcd\x02\x00\x00")
  132. func serverTmplBytes() ([]byte, error) {
  133. return bindataRead(
  134. _serverTmpl,
  135. "server.tmpl",
  136. )
  137. }
  138. func serverTmpl() (*asset, error) {
  139. bytes, err := serverTmplBytes()
  140. if err != nil {
  141. return nil, err
  142. }
  143. info := bindataFileInfo{name: "server.tmpl", size: 717, mode: os.FileMode(420), modTime: time.Unix(1531821454, 0)}
  144. a := &asset{bytes: bytes, info: info}
  145. return a, nil
  146. }
  147. var _serviceTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x8f\xcd\x4a\xc4\x40\x10\x84\xef\xf3\x14\xcd\xb0\x07\x17\x24\x8b\x78\x33\xe4\xa4\x08\x7b\x58\x11\xf1\x2e\x43\xb6\x89\x61\x33\x3f\xce\xcc\x06\x43\xd3\xef\x2e\x9d\x5f\x2f\x7b\xab\x29\xbe\xae\xaa\x49\x83\xcb\xe6\x17\x2a\xd0\x21\xfa\xec\x1f\x75\xa9\x54\x30\xf5\xc5\x34\x08\x44\xc5\xfb\x24\x99\x4b\x45\x14\x8d\x6b\x10\x76\x17\x1c\xee\x61\xd7\x9b\xee\x8a\xf0\x54\x41\x71\xb4\xc1\xc7\x9c\x98\x55\x3b\x2a\xd0\x44\x02\x31\xeb\x92\x08\xdd\x99\x59\x29\x1f\x72\xeb\x1d\x34\xfe\x6b\x49\xaf\x40\xf7\x0f\x7a\xcb\x2d\x4e\x98\x92\x69\x50\x82\xec\x24\x65\xc1\x9b\xb1\xc8\x0c\x04\x2b\xf7\xda\x62\x77\x16\x0a\x00\x84\x18\xdf\x9f\x43\x18\xb1\xf9\x39\x5f\x55\xab\x71\x7c\x61\x5e\xd7\xb0\x5a\x54\xc2\xd8\xb7\xf5\x8d\xa2\x13\xe6\x6f\xff\xaf\x69\xb6\x9f\xbd\xb5\xe8\xe4\xc3\x87\x83\x1c\x8e\xb5\x53\x9c\x70\x31\xd4\x5b\xdc\x1d\x51\xf1\x81\x3f\xcc\x7b\x88\x98\xaf\xd1\xa5\xc9\x09\xdd\xc0\xbc\x2f\x61\x5b\xf4\x17\x00\x00\xff\xff\x1d\xec\x9c\x6a\x89\x01\x00\x00")
  148. func serviceTmplBytes() ([]byte, error) {
  149. return bindataRead(
  150. _serviceTmpl,
  151. "service.tmpl",
  152. )
  153. }
  154. func serviceTmpl() (*asset, error) {
  155. bytes, err := serviceTmplBytes()
  156. if err != nil {
  157. return nil, err
  158. }
  159. info := bindataFileInfo{name: "service.tmpl", size: 393, mode: os.FileMode(420), modTime: time.Unix(1535599707, 0)}
  160. a := &asset{bytes: bytes, info: info}
  161. return a, nil
  162. }
  163. var _templateGo = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x2a\x48\x4c\xce\x4e\x4c\x4f\x55\x28\x49\xcd\x2d\xc8\x49\x2c\x49\x2d\xe6\xe2\xd2\xd7\x4f\xcf\xb7\x4a\x4f\xcd\x4b\x2d\x4a\x2c\x49\x55\x48\xcf\xd7\x4d\xca\xcc\x4b\x49\x2c\x49\x54\xd0\x2d\xc8\x4e\x57\x50\xa9\x76\xf7\x0f\x70\x74\xf6\x76\x74\x77\xad\x55\xd0\xcd\x57\x48\x2c\x2e\x4e\x2d\x29\xd6\x4b\xcf\x57\xd0\xe3\x02\x04\x00\x00\xff\xff\x21\xf2\x14\xd7\x4d\x00\x00\x00")
  164. func templateGoBytes() ([]byte, error) {
  165. return bindataRead(
  166. _templateGo,
  167. "template.go",
  168. )
  169. }
  170. func templateGo() (*asset, error) {
  171. bytes, err := templateGoBytes()
  172. if err != nil {
  173. return nil, err
  174. }
  175. info := bindataFileInfo{name: "template.go", size: 77, mode: os.FileMode(420), modTime: time.Unix(1531821454, 0)}
  176. a := &asset{bytes: bytes, info: info}
  177. return a, nil
  178. }
  179. // Asset loads and returns the asset for the given name.
  180. // It returns an error if the asset could not be found or
  181. // could not be loaded.
  182. func Asset(name string) ([]byte, error) {
  183. cannonicalName := strings.Replace(name, "\\", "/", -1)
  184. if f, ok := _bindata[cannonicalName]; ok {
  185. a, err := f()
  186. if err != nil {
  187. return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
  188. }
  189. return a.bytes, nil
  190. }
  191. return nil, fmt.Errorf("Asset %s not found", name)
  192. }
  193. // MustAsset is like Asset but panics when Asset would return an error.
  194. // It simplifies safe initialization of global variables.
  195. func MustAsset(name string) []byte {
  196. a, err := Asset(name)
  197. if err != nil {
  198. panic("asset: Asset(" + name + "): " + err.Error())
  199. }
  200. return a
  201. }
  202. // AssetInfo loads and returns the asset info for the given name.
  203. // It returns an error if the asset could not be found or
  204. // could not be loaded.
  205. func AssetInfo(name string) (os.FileInfo, error) {
  206. cannonicalName := strings.Replace(name, "\\", "/", -1)
  207. if f, ok := _bindata[cannonicalName]; ok {
  208. a, err := f()
  209. if err != nil {
  210. return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
  211. }
  212. return a.info, nil
  213. }
  214. return nil, fmt.Errorf("AssetInfo %s not found", name)
  215. }
  216. // AssetNames returns the names of the assets.
  217. func AssetNames() []string {
  218. names := make([]string, 0, len(_bindata))
  219. for name := range _bindata {
  220. names = append(names, name)
  221. }
  222. return names
  223. }
  224. // _bindata is a table, holding each asset generator, mapped to its name.
  225. var _bindata = map[string]func() (*asset, error){
  226. ".DS_Store": Ds_store,
  227. "BUILD": build,
  228. "assets.go": assetsGo,
  229. "client.tmpl": clientTmpl,
  230. "server.tmpl": serverTmpl,
  231. "service.tmpl": serviceTmpl,
  232. "template.go": templateGo,
  233. }
  234. // AssetDir returns the file names below a certain
  235. // directory embedded in the file by go-bindata.
  236. // For example if you run go-bindata on data/... and data contains the
  237. // following hierarchy:
  238. // data/
  239. // foo.txt
  240. // img/
  241. // a.png
  242. // b.png
  243. // then AssetDir("data") would return []string{"foo.txt", "img"}
  244. // AssetDir("data/img") would return []string{"a.png", "b.png"}
  245. // AssetDir("foo.txt") and AssetDir("notexist") would return an error
  246. // AssetDir("") will return []string{"data"}.
  247. func AssetDir(name string) ([]string, error) {
  248. node := _bintree
  249. if len(name) != 0 {
  250. cannonicalName := strings.Replace(name, "\\", "/", -1)
  251. pathList := strings.Split(cannonicalName, "/")
  252. for _, p := range pathList {
  253. node = node.Children[p]
  254. if node == nil {
  255. return nil, fmt.Errorf("Asset %s not found", name)
  256. }
  257. }
  258. }
  259. if node.Func != nil {
  260. return nil, fmt.Errorf("Asset %s not found", name)
  261. }
  262. rv := make([]string, 0, len(node.Children))
  263. for childName := range node.Children {
  264. rv = append(rv, childName)
  265. }
  266. return rv, nil
  267. }
  268. type bintree struct {
  269. Func func() (*asset, error)
  270. Children map[string]*bintree
  271. }
  272. var _bintree = &bintree{nil, map[string]*bintree{
  273. ".DS_Store": &bintree{Ds_store, map[string]*bintree{}},
  274. "BUILD": &bintree{build, map[string]*bintree{}},
  275. "assets.go": &bintree{assetsGo, map[string]*bintree{}},
  276. "client.tmpl": &bintree{clientTmpl, map[string]*bintree{}},
  277. "server.tmpl": &bintree{serverTmpl, map[string]*bintree{}},
  278. "service.tmpl": &bintree{serviceTmpl, map[string]*bintree{}},
  279. "template.go": &bintree{templateGo, map[string]*bintree{}},
  280. }}
  281. // RestoreAsset restores an asset under the given directory
  282. func RestoreAsset(dir, name string) error {
  283. data, err := Asset(name)
  284. if err != nil {
  285. return err
  286. }
  287. info, err := AssetInfo(name)
  288. if err != nil {
  289. return err
  290. }
  291. err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
  292. if err != nil {
  293. return err
  294. }
  295. err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
  296. if err != nil {
  297. return err
  298. }
  299. err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
  300. if err != nil {
  301. return err
  302. }
  303. return nil
  304. }
  305. // RestoreAssets restores an asset under the given directory recursively
  306. func RestoreAssets(dir, name string) error {
  307. children, err := AssetDir(name)
  308. // File
  309. if err != nil {
  310. return RestoreAsset(dir, name)
  311. }
  312. // Dir
  313. for _, child := range children {
  314. err = RestoreAssets(dir, filepath.Join(name, child))
  315. if err != nil {
  316. return err
  317. }
  318. }
  319. return nil
  320. }
  321. func _filePath(dir, name string) string {
  322. cannonicalName := strings.Replace(name, "\\", "/", -1)
  323. return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
  324. }