/
fixtures.go
292 lines (254 loc) · 7.79 KB
/
fixtures.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
// Code generated by "esc -o fixtures.go -pkg client -private _fixtures/m1.yml _fixtures/m2.yml _fixtures/m3.yml _fixtures/m4.yml _fixtures/final.yml _fixtures/eval.yml"; DO NOT EDIT.
package client
import (
"bytes"
"compress/gzip"
"encoding/base64"
"io/ioutil"
"net/http"
"os"
"path"
"sync"
"time"
)
type _escLocalFS struct{}
var _escLocal _escLocalFS
type _escStaticFS struct{}
var _escStatic _escStaticFS
type _escDirectory struct {
fs http.FileSystem
name string
}
type _escFile struct {
compressed string
size int64
modtime int64
local string
isDir bool
once sync.Once
data []byte
name string
}
func (_escLocalFS) Open(name string) (http.File, error) {
f, present := _escData[path.Clean(name)]
if !present {
return nil, os.ErrNotExist
}
return os.Open(f.local)
}
func (_escStaticFS) prepare(name string) (*_escFile, error) {
f, present := _escData[path.Clean(name)]
if !present {
return nil, os.ErrNotExist
}
var err error
f.once.Do(func() {
f.name = path.Base(name)
if f.size == 0 {
return
}
var gr *gzip.Reader
b64 := base64.NewDecoder(base64.StdEncoding, bytes.NewBufferString(f.compressed))
gr, err = gzip.NewReader(b64)
if err != nil {
return
}
f.data, err = ioutil.ReadAll(gr)
})
if err != nil {
return nil, err
}
return f, nil
}
func (fs _escStaticFS) Open(name string) (http.File, error) {
f, err := fs.prepare(name)
if err != nil {
return nil, err
}
return f.File()
}
func (dir _escDirectory) Open(name string) (http.File, error) {
return dir.fs.Open(dir.name + name)
}
func (f *_escFile) File() (http.File, error) {
type httpFile struct {
*bytes.Reader
*_escFile
}
return &httpFile{
Reader: bytes.NewReader(f.data),
_escFile: f,
}, nil
}
func (f *_escFile) Close() error {
return nil
}
func (f *_escFile) Readdir(count int) ([]os.FileInfo, error) {
return nil, nil
}
func (f *_escFile) Stat() (os.FileInfo, error) {
return f, nil
}
func (f *_escFile) Name() string {
return f.name
}
func (f *_escFile) Size() int64 {
return f.size
}
func (f *_escFile) Mode() os.FileMode {
return 0
}
func (f *_escFile) ModTime() time.Time {
return time.Unix(f.modtime, 0)
}
func (f *_escFile) IsDir() bool {
return f.isDir
}
func (f *_escFile) Sys() interface{} {
return f
}
// _escFS returns a http.Filesystem for the embedded assets. If useLocal is true,
// the filesystem's contents are instead used.
func _escFS(useLocal bool) http.FileSystem {
if useLocal {
return _escLocal
}
return _escStatic
}
// _escDir returns a http.Filesystem for the embedded assets on a given prefix dir.
// If useLocal is true, the filesystem's contents are instead used.
func _escDir(useLocal bool, name string) http.FileSystem {
if useLocal {
return _escDirectory{fs: _escLocal, name: name}
}
return _escDirectory{fs: _escStatic, name: name}
}
// _escFSByte returns the named file from the embedded assets. If useLocal is
// true, the filesystem's contents are instead used.
func _escFSByte(useLocal bool, name string) ([]byte, error) {
if useLocal {
f, err := _escLocal.Open(name)
if err != nil {
return nil, err
}
b, err := ioutil.ReadAll(f)
_ = f.Close()
return b, err
}
f, err := _escStatic.prepare(name)
if err != nil {
return nil, err
}
return f.data, nil
}
// _escFSMustByte is the same as _escFSByte, but panics if name is not present.
func _escFSMustByte(useLocal bool, name string) []byte {
b, err := _escFSByte(useLocal, name)
if err != nil {
panic(err)
}
return b
}
// _escFSString is the string version of _escFSByte.
func _escFSString(useLocal bool, name string) (string, error) {
b, err := _escFSByte(useLocal, name)
return string(b), err
}
// _escFSMustString is the string version of _escFSMustByte.
func _escFSMustString(useLocal bool, name string) string {
return string(_escFSMustByte(useLocal, name))
}
var _escData = map[string]*_escFile{
"/_fixtures/eval.yml": {
local: "_fixtures/eval.yml",
size: 1058,
modtime: 1540673585,
compressed: `
H4sIAAAAAAAC/+yRzYrbQBCE736Kwo4vgbEcs4SgHPMIIedlPGrLnZ0/untE/PZB8g9L2OSU456Euqu+
rmLEc78CJhLlknvsd4cVwMmP1INj5FxYOVUfrKNAT/svz+lXJnseSngh6X0aPj+5sTYXvZHaSkhLk0A6
Y0Nt8wfwEs5sFKwJ9VhMK2B8ez2VaH6Zh9Ky9fi0CiUln4cFemwch6vPoTty7o5ez3AB61DhZMI9qUro
PqJbAnfzT6kk3op0oamVtMYGodQLxhIHyjhxJIUVLA5ci8CE6J/XbmeWXA+knQlVyk8KhtOMlxl8FUEL
aCK52JnzCF8reVFwXlytxuKHNy+eikAlzMrXFb9iKJjTTPgwr//euNvN2kyPmLeOfzR/VTlzILh82CP5
F4L7dqNjc32Iq+MmrlwP4KzmY4RzTUng6J6nXuxcMjYPxW1w5DxwHvVeuakstY0TwZ2w3v5YSNvvelGj
hC1R9FVpWN8RHU0+Og3C1bQ7cfZxVy/vwP8A/B0AAP//TcksICIEAAA=
`,
},
"/_fixtures/final.yml": {
local: "_fixtures/final.yml",
size: 734,
modtime: 1540673592,
compressed: `
H4sIAAAAAAAC/3yRzYrbThDE73qKwv778oexHLOEoBzzCCHnZTxqy52dL7p7RPz2QfIHS9jkJNRdVV0/
RjwPHTCTKJc84LA/dgAnP9EAjpFzYeVUfbCeAr0cvrymX5nsdSzhjWTwafz84qbaXPRGap2QliaBdIkN
tS0fwEu4sFGwJjRgNXXA9PF6LtH8Og+lZRvwqQslJZ/HNfTUOI43n0N/4tyfvF7gAjahwsmMR1OV0P+P
fi3cLz+lkngr0oemVtIGW4RSr5hKHCnjzJEUVrA6cAOBCdE/r93PrL2ekXYhVCk/KRjOS7wswTcRtIBm
kqtdOE/wtZIXBefV1Wosfvzw4rkIVMKifI/4FWPB0mbGf8v678T9ftFmeta8M/5B/g45cyC4fDwg+TeC
+3ZPx/b2EDfHXVy5HsFZzccI55qSwNGjT73apWRsn4r74MR55DzpA7mprNjGieDO2Ox+rEm773pVo4Qd
UfRVadw8InqafXQahKtpf+bs475eu98BAAD//wyS8czeAgAA
`,
},
"/_fixtures/m1.yml": {
local: "_fixtures/m1.yml",
size: 813,
modtime: 1540677330,
compressed: `
H4sIAAAAAAAC/6yRzYrbThDE736Kwv778oexbLOEoBzzCCHnZTxqy52dL7pbIn77MPIHS9jklJNQd9Wv
qxjx3K+AmUS55B773XEFcPIj9eAYORdWTtUH6yjQy/7za/qZyV6HEt5Iep+GTy9urJOL3khtJaRlkkDa
sKFO7QN4CRc2CjYJ9VhMK2D8eD2XaH6ZhzJl63FYhZKSz8MCPU0ch5vPoTtx7k5eL3AB61DhZMYjqUro
/ke3BO7aT6kk3op0YVIraY0NQqlXjCUOlHHmSAorWBy4FYEJ0V+v3c8suZ5IuxCqlB8UDOeGlwa+iaAF
NJNc7cJ5hK+VvCg4L66pxuKHDy+ei0AlNOX7il8wFLQ0M/5r6z837nZNm+kZ897xt+bvKmcOBJePeyT/
RnBf73Rsbg9xc9zFlesRnNV8jHBuUhI4euSpV7uUjM1TcR+cOA+cR31UnlSW2saJ4M5Yb78vpO03vapR
wpYo+qo0rB+IjmYfnQbhatqlw+6wq9d/yTs23q8AAAD//3jwFNotAwAA
`,
},
"/_fixtures/m2.yml": {
local: "_fixtures/m2.yml",
size: 733,
modtime: 1540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86B35FFlwTZOBHfGZvdrSdr91KsaJeyI
oq9K/eYe0dLko9MgXE3b9GX/tK/X5m8AAAD//1OO+lDdAgAA
`,
},
"/_fixtures/m4.yml": {
local: "_fixtures/m4.yml",
size: 733,
modtime: 1540673609,
compressed: `
H4sIAAAAAAAC/3yRzYrbQBCE73qKwo4vgbG8xoSgHPMIIedlPGrLnZ0/ulsifvsgWTZL2OQk1F1VXR8j
nrsGmEiUS+5w2B8bgJMfqAPHyLmwcqo+WEuBToevr+l3JnvtS3gj6Xzqv5zcUEcXvZFaI6RllEA6x4Y6
zh/AS7iyUbBRqMNiaoDh4/VUovllHsqYrcNLE0pKPvdL6Hnk2N99Du2Zc3v2eoUL2IQKJxMeTVVC+xnt
Uridf0ol8VakDaNaSRtsEUq9YSixp4wLR1JYweLAHQQmRP+9tp5Zej0j7UqoUn5RMFzmeJmD7yJoAU0k
N7tyHuBrJS8KzotrrLH4/sOLlyJQCbPyPeI39AVzmwmf5vW/idv9rM30rLky/kX+DjlzILh8PCD5N4L7
vqZje3+Iu2MVV65HcFbzMcK5UUng6NGn3uxaMrZPxTo4c+45D/pAHlUWbONEcBdsdj+XpN0PvalRwo4o
+qrUbx4RLU0+Og3C1bRNp/3Lvt6aPwEAAP//3bBdld0CAAA=
`,
},
"/": {
isDir: true,
local: "",
},
"/_fixtures": {
isDir: true,
local: "_fixtures",
},
}