diff --git a/.goreleaser.yml b/.goreleaser.yml index 91aa878..9f88ad5 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -8,8 +8,9 @@ builds: hooks: pre: go generate -archive: - format: binary +archives: + - id: binary + format: binary release: draft: true diff --git a/bindata/bindata.go b/bindata/bindata.go deleted file mode 100644 index ad50bf1..0000000 --- a/bindata/bindata.go +++ /dev/null @@ -1,268 +0,0 @@ -// Code generated by vfsgen; DO NOT EDIT. - -// +build !dev - -package bindata - -import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "net/http" - "os" - pathpkg "path" - "time" -) - -// Assets statically implements the virtual filesystem provided to vfsgen. -var Assets = func() http.FileSystem { - fs := vfsgen۰FS{ - "/": &vfsgen۰DirInfo{ - name: "/", - modTime: time.Date(2019, 11, 1, 8, 43, 30, 496971914, time.UTC), - }, - "/completion.sh": &vfsgen۰CompressedFileInfo{ - name: "completion.sh", - modTime: time.Date(2019, 10, 30, 14, 57, 19, 471490855, time.UTC), - uncompressedSize: 2359, - - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xdc\x55\xcd\x6f\x9c\x46\x14\x3f\xc3\x5f\xf1\x34\xa5\x02\x5a\xb3\xbb\xce\xb1\x0e\x6d\xd3\xc8\xaa\x2a\xb5\x4d\x94\x1e\xaa\x0a\xaf\x11\x3b\xbc\x5d\x4f\x32\xcc\xe0\x99\xc1\xae\x43\xf9\xdf\xab\x61\xd8\x5d\xd8\x0f\xf7\x50\x9f\x72\x01\xde\xf7\xe7\xef\x91\xe7\x0f\xc8\x4a\xac\x0a\x21\xa8\xe1\x79\x5d\x28\x8d\xf9\x06\x4d\x14\x43\xeb\x03\x00\x94\x48\x79\xa1\x10\x12\xf5\x06\x4c\xb1\xe2\xa8\xd3\x08\x32\x82\xc2\x30\xf3\x44\x96\x29\xa1\x52\xac\xd9\x26\xa7\xaa\x78\xe4\x79\xcf\x66\xa8\x09\x64\x64\xa5\xe4\xa3\x46\x35\xd2\x19\x38\xb9\x23\x35\x81\x9b\x3e\x04\x40\x46\x7a\x73\xc7\x3f\x72\xba\x53\xcf\xc8\x46\xc9\xa6\x3e\x52\xb8\x93\xda\xe4\xbd\x68\xac\xfb\x51\xae\x8e\x34\x3f\xca\xd5\x24\x6c\x2d\x39\x33\x28\x50\xeb\x91\xea\x9e\x39\x76\xa7\x24\x47\xab\x54\xca\x8d\x25\x35\xbd\xc3\xb2\x71\xac\x49\x88\xad\xe0\x54\x95\x9a\x2a\x56\x9b\x13\x1d\x71\x82\x3e\x8e\x46\x2c\x47\x1a\x96\xd4\x04\xe2\xde\x07\x97\xb4\xe0\x6e\x0c\x69\xd0\xba\x71\x64\xc1\xe5\xb2\x83\xfb\x06\xd5\x13\x18\xac\x6a\x5e\x18\x84\xc9\x50\x65\x63\x7c\xdf\x63\x6b\xc8\x20\xf9\x0c\x24\xe8\xed\x08\x2c\xaf\xc0\xdc\xa1\x18\x92\x53\x68\x1a\x25\x60\xd1\x93\x6b\xe6\xf7\xef\xde\x6b\x4a\xd4\xac\x37\x89\xc2\x21\x66\x17\xc6\x64\xeb\x50\x00\x09\x68\xa3\x0e\xdd\x0d\x96\x41\xdb\x7f\x74\xb3\x15\x9a\x47\x44\x61\x5d\xd0\x46\x75\xe1\x05\x0c\x5f\x9f\xc3\x0b\x68\x99\x28\xf1\xef\xef\x42\x56\x86\x5d\x4c\xb6\x19\x78\x87\x3e\xa4\x2a\x51\xfd\xf4\x14\x4d\xd4\x67\x35\x6f\xe8\xa7\xc8\x12\x83\xe9\xb6\x09\x29\x69\xdb\x5a\x31\x61\xb8\x80\x19\x2b\xbb\xce\x89\xd9\x1a\xaa\xa2\x5e\x33\x8e\x90\x98\xa3\x46\xc1\x6b\x78\x1d\x4d\xb8\xa0\xb0\x96\xca\x0c\x1d\xde\x65\x43\x20\x91\xfb\x7e\x27\x86\x04\xed\x96\xb2\x32\xfd\x6a\x01\xaf\xbe\x9f\x97\xf8\x30\x17\x0d\xe7\x10\x4f\xba\x03\xe3\x14\xde\xbe\xfb\xed\xfd\x87\xeb\xf7\xbf\xfe\xe5\x62\x53\x59\xd5\x1b\x14\x90\xfc\x09\x24\x88\xa0\xaf\x60\x0d\xe1\xd7\xf7\x10\xda\xe8\x87\x09\x67\x3f\x2e\x3b\x02\x31\x81\x24\xd9\x4e\xe2\x1f\x28\x1e\x3f\x41\x38\x87\x39\xb4\xce\x1e\xc8\x0d\x21\xc1\xc2\x3e\xa1\x83\xf9\x6d\x76\x0b\xcb\x6f\x83\xbd\x38\x58\x40\x17\x0e\x3b\xb6\x66\x7e\xe7\xfb\x07\x77\x61\x83\x26\x57\xa8\x65\xa3\x28\xee\x4e\x83\x5d\x80\x0c\x82\xf6\x2b\x21\x1b\xa1\x6d\x22\x90\xe0\x3d\x2c\x60\xb9\x3c\xa8\x76\x58\xae\xcb\x6d\x00\xfb\x3a\x77\x79\x20\x68\x9d\xbf\xa9\xe3\xcb\x65\x37\x0e\xfa\xc3\x7f\x84\x5a\x9c\xaf\xa5\x9f\xdf\x71\x35\x0e\x5b\x47\xc0\xf9\xff\x2b\x93\xdc\x7f\x49\x9b\x40\x1b\x6d\x64\x95\xaf\x1b\x41\x77\xad\xa3\x85\x46\x08\x5a\x5e\x68\x93\x53\x59\x55\x85\x28\x3b\x60\xfb\x12\x0f\x57\x29\xde\x49\x4e\x2c\xc2\x78\xd5\x26\x7a\x6e\xb2\x13\xd6\xd5\xd5\xe9\x18\xae\xff\x6e\xd2\xb1\xef\x79\xde\xb3\x2b\x60\x15\x06\xe7\x9e\xe7\x8d\x7c\x7e\x13\x9f\x8a\x86\xba\xa0\x67\x20\x22\x8a\xea\x25\xe0\xe1\xb9\x5d\xb4\x76\xbe\x67\x9f\xe9\xf3\x98\x18\x7e\x0b\xc3\xf9\x39\x7f\x04\x2b\x34\xc5\xcc\xe6\xb8\xbd\x85\x2f\xb9\xf3\x16\xba\x24\xb0\xd9\x91\xfe\xaf\x70\xeb\xee\xfb\x70\x0b\xa7\xc7\x12\xa6\xd7\xf2\x14\x3c\xbc\xe7\xb1\xb1\x07\xc3\x8d\x78\x06\x0d\x0e\x00\xc9\x03\xfc\xf2\xf3\xef\xef\x3e\x5c\xbf\x7d\xf3\xc7\x75\x7a\x69\xe9\x3a\x1d\x20\x12\xb6\x75\x9a\xea\x66\xa5\x8d\x8a\x82\xc5\xc5\xe2\x82\xa3\xd8\x98\xbb\xa8\x8e\xe3\xee\x3c\x2a\xfe\x0d\x00\x00\xff\xff\xa4\x67\x85\x69\x37\x09\x00\x00"), - }, - "/crawlexecution.template": &vfsgen۰CompressedFileInfo{ - name: "crawlexecution.template", - modTime: time.Date(2019, 10, 30, 14, 57, 19, 471490855, time.UTC), - uncompressedSize: 385, - - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\x90\xb1\x4e\xc3\x30\x10\x86\xf7\x3c\xc5\xaf\x93\x18\x6b\x01\x85\x0e\x6c\xa8\xcd\x10\x54\xc1\x40\xc4\x9c\x50\x5f\xc1\x52\xe2\x54\x17\x87\x0e\x27\xbf\x3b\xb2\x13\xa1\xb0\x9c\xcf\x9f\x7e\x5b\xdf\x9d\xaa\xe5\xb3\xf3\x0c\x3a\x56\xaf\x25\x61\x13\xa3\xea\x45\x9c\x0f\x67\x34\x37\xdb\xdd\x88\xb9\xdc\x3d\xa6\x72\x6b\x1b\x98\xca\xc2\xbc\x0c\x9f\xe9\x78\x0f\x6d\x60\x98\xc3\x70\x9a\x7a\xf6\x61\xdc\x4b\x7b\xed\xd8\xc6\x08\xd5\xe0\x7a\xce\x09\x09\xb5\xeb\x79\xc5\x4a\x6f\x67\xa2\x7a\x75\xe1\x1b\xa6\x14\x19\x24\xc6\x02\x80\xaa\xa4\xf7\x99\x3c\x41\xd5\xa4\x14\x7b\x3b\x8b\x09\x8f\x1c\x56\xa4\x50\x75\xfe\x87\x65\xe4\x7f\xda\x9b\xed\xce\x64\xeb\xbf\x66\xd1\x4f\xe8\xfe\x61\xa9\x0d\xa8\xb2\x04\xca\xb3\x10\x28\x0f\x43\xa0\xc3\x70\x1a\xe7\xab\x04\x24\x63\x02\x95\xde\xce\xed\xca\xa2\x50\x95\xd6\x7f\x31\xcc\x47\xdb\x4d\xd9\x20\x70\x7f\xe9\xd2\x4a\x96\x6d\x9a\x9c\x62\x6f\x63\x2c\xea\xb7\xfa\xf9\x88\xc5\x12\x66\x3f\x4c\x3e\x7d\xf2\x1b\x00\x00\xff\xff\xea\xfd\x52\x48\x81\x01\x00\x00"), - }, - "/crawllog.template": &vfsgen۰CompressedFileInfo{ - name: "crawllog.template", - modTime: time.Date(2019, 11, 1, 8, 0, 58, 615486587, time.UTC), - uncompressedSize: 984, - - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x93\xcd\x6e\xdb\x30\x0c\x80\xef\x7d\x0a\x82\x80\x8f\x11\x9a\x9f\xa6\xe9\x31\xc8\x32\xc0\x40\xd3\x0d\x89\xb7\x5e\xe3\x59\x74\x22\xa0\x91\x3d\x4a\xee\x96\x19\x7e\xf7\x81\x52\xe7\x24\x4b\x0f\xbd\x10\x96\x04\x92\x1f\xf8\xd1\x6d\xab\xa9\x34\x96\x00\x1f\xd3\xa7\x25\xc2\xa0\xeb\x6e\xda\xb6\x66\x63\x7d\x09\xdb\x64\x3c\x55\xe3\xa9\x83\x64\x30\xbc\x93\xf8\x30\x52\x0f\x23\xf9\x98\xa9\x99\x83\xb7\xd7\x2d\xa8\xe7\x9c\x8b\x54\x83\xfa\x64\x5c\x51\xbd\x12\x1f\xbf\xe6\x7e\x0f\x6a\x4d\x3f\x1b\x72\x9e\xf4\x37\x36\x72\x2a\x2a\xd6\xd9\xb1\xa6\x98\xb0\xa6\x92\xd8\x65\x55\xe8\xf8\x83\xcd\x6e\xef\x8b\x63\x6e\xbb\xee\x03\xfd\x87\x77\x2a\xdc\x8c\x35\x24\xc3\xa1\x86\xe4\x5e\x43\x32\xd2\x5b\x50\xcb\xdf\x54\x34\xde\x54\x56\x78\xd2\x7a\xae\x35\x93\x73\xd2\xdd\xd5\x95\x75\x14\x50\x16\x95\xf5\x64\x7d\x64\xd9\xf8\xdc\x37\x6e\x51\x69\xf9\x36\x7f\x08\xd4\x67\xf2\xc5\x3e\x33\x07\x5a\x85\x44\xcf\x86\x9c\x60\x31\x39\xf2\x01\xf7\x0a\x74\x30\xbd\x55\xd3\xdb\x30\x9a\x89\x9a\x4d\x64\x28\x1b\x5f\x71\xbe\xa3\x35\x95\x52\xa4\x24\x66\xe2\xae\x83\xb6\xf5\xe6\x40\xa0\xa4\xfe\xc6\xe7\x87\x3a\xdc\xfd\x32\x32\xb0\x25\x73\xc5\x52\x37\x8e\x83\x49\xcb\x41\x49\x20\xab\x2f\x11\xc8\xea\x60\xeb\xe6\xa4\x70\x35\x4f\x9f\xfe\x29\x34\xf6\x95\xd8\xd1\x25\xe4\xd5\x38\x03\xb0\x84\xc9\xc8\x6d\x01\x9f\xe7\xeb\x05\xa4\x1a\x01\x45\x20\x02\x9e\x1b\x0c\xc7\x42\x66\x86\x80\xe7\x02\xf1\x12\xec\x52\xe5\xc7\x39\xa2\x50\x27\x42\x1d\x24\xf7\xe1\x6a\x28\x54\xbd\xd2\x88\xd6\x4b\x0d\x40\xbd\x55\x04\x3c\xd3\x1a\xdf\x10\x50\x8c\x22\x60\x50\xba\x8a\x29\x9e\x8f\xf8\xbe\xce\x77\x61\xcf\xcc\x4a\x1c\xc5\x28\x7b\x8f\x27\xc5\xa1\x70\x74\x8c\x80\xbd\x5b\x04\x0c\x4e\xff\xeb\xc7\xb9\xdd\x11\xa8\xef\xf9\x4b\x13\x9a\x79\x3a\xd4\x2f\xb9\xef\xff\xc2\x93\xf1\x9b\xec\x4b\x36\x7f\x84\x37\x1e\xd9\xdc\xc6\x5e\xf9\x3f\xa5\xc7\x0d\x50\x5d\xf7\x37\x00\x00\xff\xff\x98\x4f\x85\xcc\xd8\x03\x00\x00"), - }, - "/jobexecution.template": &vfsgen۰CompressedFileInfo{ - name: "jobexecution.template", - modTime: time.Date(2019, 10, 30, 14, 57, 19, 471490855, time.UTC), - uncompressedSize: 442, - - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\x91\x41\x4f\xfb\x30\x0c\xc5\xef\xfb\x14\x4f\xd6\x76\xfb\x2f\xd2\xfe\x63\x13\x42\xe2\x80\xb6\x1e\x86\x26\x38\x30\x38\xb7\x34\x1e\x8a\x68\xd3\x29\x49\x07\x28\xca\x77\x47\x49\x3a\xb4\x1e\xec\xba\x56\xfc\xfc\x7e\x89\xf7\x92\x8f\x4a\x33\x68\xbf\x7b\x2a\x08\xf3\x10\xbc\x3f\x19\xa5\xdd\x11\xe5\x6c\xb9\xb6\xc8\x69\xb1\xb2\x98\xdd\xca\x18\x25\xc4\x4e\x42\x3c\x76\xef\xf1\xf3\xe2\x2a\xc7\x10\xdb\xae\xee\x5b\xd6\xce\x6e\x4c\xf5\xd5\xb0\x84\x78\x35\xea\xf2\x13\x02\xbc\x77\xaa\xe5\x74\xdc\xb8\x83\x6a\xf9\xaa\x57\x68\x99\x3b\x13\xef\x4d\xa5\x3f\x18\xd3\x4f\xfe\xf9\x87\xe9\xb9\x6a\x7a\xc6\xdd\x3d\x44\xf1\xcd\x75\xef\x54\xa7\x6d\xda\x37\x32\xb9\x88\xfe\x56\xb2\x4c\x53\xc3\x50\xd2\x62\x2d\x23\xcf\xa8\x52\xfa\xcc\xc6\x8e\x05\xe6\xcb\xb5\x48\x90\x7f\x45\xa6\x1d\x62\xfe\xff\x66\xc8\x25\x68\x27\x09\x94\xd0\x09\x94\xbc\x10\x68\xdb\xd5\x96\x40\x91\x38\x77\x8d\x43\x44\x23\x50\xa1\x65\x2e\xe3\x46\xc3\x96\xdd\x15\xa6\x78\xcb\x5e\xbd\x77\xdc\x9e\x9a\x78\x91\xc3\x33\x88\x8b\xed\x10\x26\x87\xe7\xc3\xc3\x1e\x83\x5f\x88\x4d\xd7\xeb\x28\xf2\x1b\x00\x00\xff\xff\x3d\x35\x93\x89\xba\x01\x00\x00"), - }, - "/json.template": &vfsgen۰FileInfo{ - name: "json.template", - modTime: time.Date(2019, 11, 1, 8, 43, 30, 491971887, time.UTC), - content: []byte("\x7b\x7b\x70\x72\x65\x74\x74\x79\x4a\x73\x6f\x6e\x20\x2e\x7d\x7d\x0a"), - }, - "/pagelog.template": &vfsgen۰CompressedFileInfo{ - name: "pagelog.template", - modTime: time.Date(2019, 10, 30, 14, 57, 19, 472490860, time.UTC), - uncompressedSize: 964, - - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x92\xcf\x6e\xe2\x30\x10\xc6\xef\x7d\x8a\x91\xa5\x1c\x63\x35\x8e\x28\xa2\x37\x94\x65\x57\xd1\xb6\xa5\x4a\x61\x7b\xc5\x24\x53\xb0\x36\x38\xc8\x76\xba\x8b\x22\xde\x7d\x35\x6e\xc9\x1f\x16\xd4\x43\x24\x7b\x26\x9e\xf9\xbe\xf9\x4d\xd3\x14\xf8\xa6\x34\x02\xcb\x66\x2f\xf3\x65\x96\xcc\x18\x84\xc7\xe3\x4d\xd3\xac\x8d\xda\x6c\xdd\x4e\x6e\x50\x3b\x79\x3c\x36\xcd\xde\x28\xed\xde\x60\x15\xc4\x77\x3c\xbe\xb3\x10\x84\x23\x07\x41\x5c\x40\x10\x8d\xe8\x36\x11\x7c\x22\xe8\x10\x09\x1e\x89\x53\x3e\x14\x82\x0b\x61\x57\xc0\x5f\xa5\xc9\xd3\x02\xf8\x77\x53\xed\x12\x99\x6f\x11\xf8\x8b\x93\xae\xb6\x49\x55\x20\xf0\x6f\xca\xe6\xd5\x3b\x9a\xc3\xb3\x74\x5b\xe0\x4b\xa3\x80\x67\x68\xab\xda\xe4\xb8\x38\xec\x91\x6e\xba\x40\x23\xd7\x25\x02\x7f\x54\x3b\x1f\x25\x61\x06\x2d\x3a\xaf\x19\x75\xe1\xd5\xdf\x74\xb6\xe6\xcb\xc5\x43\xfa\xf4\x73\xe8\x2a\x3f\x48\xdd\xb7\x04\x21\xc9\x1e\xdf\xf2\x68\x7c\x4b\x52\xbf\xac\xfa\x3c\xfd\xd1\x0e\x4a\xe9\x77\x34\x16\x07\x23\x0a\xdb\x19\xb5\x87\x48\xc4\x76\x05\xec\x75\x9a\x25\x90\x16\x0c\xd8\xec\x2f\xe6\xb5\x53\x95\xf6\xb7\xa5\x51\x6c\xd8\x76\x5d\x95\x05\x45\x0e\x58\x96\xd5\x9f\x8b\x04\xda\xe2\xfd\xf9\xf6\xea\xfa\x31\x0e\xab\xf6\xd4\x5e\x25\x7c\x1a\xbb\xbd\x87\x40\x8c\xb8\x20\xbc\xf4\xc5\xb6\x63\xfd\x61\xc9\x53\xe6\x3e\x24\x04\x1f\x0d\x0d\x7a\xc8\x0c\x58\x86\x96\x01\x23\xac\xe4\x33\x4b\x7d\x28\x27\x7a\xfe\xa4\xe9\x5f\xe2\x79\xe6\xdf\x48\xbd\xc1\x6e\x07\x28\xe9\x70\xb7\x2f\xa5\x1b\x6c\xab\x87\x75\x42\x74\xc1\xdf\x39\xeb\x20\x8c\x26\x63\x12\x3a\xaf\x5d\xa9\xf4\x6f\x7b\x7f\xb9\xef\x67\x7a\xd8\xb6\xdd\xa6\x53\xd7\x6b\x0b\xf2\x38\x4d\x9f\x58\xbf\xdc\x2f\x59\xd6\x67\x1e\x3e\x96\xa8\x57\x69\x31\x5f\x4c\x1f\xe0\x53\x2a\xf0\xa4\xaa\xf5\x7f\x1b\xd8\x3d\xf7\x2d\xe8\xf9\xbf\x00\x00\x00\xff\xff\x7c\xa2\xe6\x10\xc4\x03\x00\x00"), - }, - "/screenshot.template": &vfsgen۰CompressedFileInfo{ - name: "screenshot.template", - modTime: time.Date(2019, 10, 30, 14, 57, 19, 472490860, time.UTC), - uncompressedSize: 236, - - compressedContent: []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x54\xce\xc1\x8a\x83\x40\x0c\x06\xe0\xbb\x4f\x11\x02\x7b\x34\xa0\x03\xde\x97\xc5\x83\x20\xbb\x17\xdd\xb3\xd2\x89\x65\xc0\x46\x99\x19\x4b\x61\x98\x77\x2f\xa3\x45\xda\x4b\x48\x20\xff\x97\x84\xa0\x79\x32\xc2\x80\x6d\xf3\x5b\x23\xe4\x31\x86\xb0\x5a\x23\x7e\x82\xe1\x4b\x55\x0e\x8e\x92\x17\xa5\xa2\xa2\x54\x6e\x00\x6a\x34\x50\xfd\xe0\xcb\xe6\xcd\x22\x69\xe8\xad\x49\x31\x16\x9d\xf2\x59\x08\x46\xee\x6c\x1d\x7f\x58\xb9\xaa\xe8\xa0\xce\xe6\xf0\xb0\xd1\x08\xf8\x06\x22\x60\x6f\x0d\xa6\xb4\x65\xc7\x7e\x27\xed\x28\x57\x06\xfa\x1f\xe7\x6d\x77\x3d\xdf\xd6\x79\xf4\xe7\xe3\xb4\x6f\xb1\xe8\x18\xb3\xee\xaf\xfb\x6e\xe1\x75\x1b\xe8\x67\xd9\x24\x21\xcf\x00\x00\x00\xff\xff\x79\xbe\x4d\x7f\xec\x00\x00\x00"), - }, - } - fs["/"].(*vfsgen۰DirInfo).entries = []os.FileInfo{ - fs["/completion.sh"].(os.FileInfo), - fs["/crawlexecution.template"].(os.FileInfo), - fs["/crawllog.template"].(os.FileInfo), - fs["/jobexecution.template"].(os.FileInfo), - fs["/json.template"].(os.FileInfo), - fs["/pagelog.template"].(os.FileInfo), - fs["/screenshot.template"].(os.FileInfo), - } - - return fs -}() - -type vfsgen۰FS map[string]interface{} - -func (fs vfsgen۰FS) Open(path string) (http.File, error) { - path = pathpkg.Clean("/" + path) - f, ok := fs[path] - if !ok { - return nil, &os.PathError{Op: "open", Path: path, Err: os.ErrNotExist} - } - - switch f := f.(type) { - case *vfsgen۰CompressedFileInfo: - gr, err := gzip.NewReader(bytes.NewReader(f.compressedContent)) - if err != nil { - // This should never happen because we generate the gzip bytes such that they are always valid. - panic("unexpected error reading own gzip compressed bytes: " + err.Error()) - } - return &vfsgen۰CompressedFile{ - vfsgen۰CompressedFileInfo: f, - gr: gr, - }, nil - case *vfsgen۰FileInfo: - return &vfsgen۰File{ - vfsgen۰FileInfo: f, - Reader: bytes.NewReader(f.content), - }, nil - case *vfsgen۰DirInfo: - return &vfsgen۰Dir{ - vfsgen۰DirInfo: f, - }, nil - default: - // This should never happen because we generate only the above types. - panic(fmt.Sprintf("unexpected type %T", f)) - } -} - -// vfsgen۰CompressedFileInfo is a static definition of a gzip compressed file. -type vfsgen۰CompressedFileInfo struct { - name string - modTime time.Time - compressedContent []byte - uncompressedSize int64 -} - -func (f *vfsgen۰CompressedFileInfo) Readdir(count int) ([]os.FileInfo, error) { - return nil, fmt.Errorf("cannot Readdir from file %s", f.name) -} -func (f *vfsgen۰CompressedFileInfo) Stat() (os.FileInfo, error) { return f, nil } - -func (f *vfsgen۰CompressedFileInfo) GzipBytes() []byte { - return f.compressedContent -} - -func (f *vfsgen۰CompressedFileInfo) Name() string { return f.name } -func (f *vfsgen۰CompressedFileInfo) Size() int64 { return f.uncompressedSize } -func (f *vfsgen۰CompressedFileInfo) Mode() os.FileMode { return 0444 } -func (f *vfsgen۰CompressedFileInfo) ModTime() time.Time { return f.modTime } -func (f *vfsgen۰CompressedFileInfo) IsDir() bool { return false } -func (f *vfsgen۰CompressedFileInfo) Sys() interface{} { return nil } - -// vfsgen۰CompressedFile is an opened compressedFile instance. -type vfsgen۰CompressedFile struct { - *vfsgen۰CompressedFileInfo - gr *gzip.Reader - grPos int64 // Actual gr uncompressed position. - seekPos int64 // Seek uncompressed position. -} - -func (f *vfsgen۰CompressedFile) Read(p []byte) (n int, err error) { - if f.grPos > f.seekPos { - // Rewind to beginning. - err = f.gr.Reset(bytes.NewReader(f.compressedContent)) - if err != nil { - return 0, err - } - f.grPos = 0 - } - if f.grPos < f.seekPos { - // Fast-forward. - _, err = io.CopyN(ioutil.Discard, f.gr, f.seekPos-f.grPos) - if err != nil { - return 0, err - } - f.grPos = f.seekPos - } - n, err = f.gr.Read(p) - f.grPos += int64(n) - f.seekPos = f.grPos - return n, err -} -func (f *vfsgen۰CompressedFile) Seek(offset int64, whence int) (int64, error) { - switch whence { - case io.SeekStart: - f.seekPos = 0 + offset - case io.SeekCurrent: - f.seekPos += offset - case io.SeekEnd: - f.seekPos = f.uncompressedSize + offset - default: - panic(fmt.Errorf("invalid whence value: %v", whence)) - } - return f.seekPos, nil -} -func (f *vfsgen۰CompressedFile) Close() error { - return f.gr.Close() -} - -// vfsgen۰FileInfo is a static definition of an uncompressed file (because it's not worth gzip compressing). -type vfsgen۰FileInfo struct { - name string - modTime time.Time - content []byte -} - -func (f *vfsgen۰FileInfo) Readdir(count int) ([]os.FileInfo, error) { - return nil, fmt.Errorf("cannot Readdir from file %s", f.name) -} -func (f *vfsgen۰FileInfo) Stat() (os.FileInfo, error) { return f, nil } - -func (f *vfsgen۰FileInfo) NotWorthGzipCompressing() {} - -func (f *vfsgen۰FileInfo) Name() string { return f.name } -func (f *vfsgen۰FileInfo) Size() int64 { return int64(len(f.content)) } -func (f *vfsgen۰FileInfo) Mode() os.FileMode { return 0444 } -func (f *vfsgen۰FileInfo) ModTime() time.Time { return f.modTime } -func (f *vfsgen۰FileInfo) IsDir() bool { return false } -func (f *vfsgen۰FileInfo) Sys() interface{} { return nil } - -// vfsgen۰File is an opened file instance. -type vfsgen۰File struct { - *vfsgen۰FileInfo - *bytes.Reader -} - -func (f *vfsgen۰File) Close() error { - return nil -} - -// vfsgen۰DirInfo is a static definition of a directory. -type vfsgen۰DirInfo struct { - name string - modTime time.Time - entries []os.FileInfo -} - -func (d *vfsgen۰DirInfo) Read([]byte) (int, error) { - return 0, fmt.Errorf("cannot Read from directory %s", d.name) -} -func (d *vfsgen۰DirInfo) Close() error { return nil } -func (d *vfsgen۰DirInfo) Stat() (os.FileInfo, error) { return d, nil } - -func (d *vfsgen۰DirInfo) Name() string { return d.name } -func (d *vfsgen۰DirInfo) Size() int64 { return 0 } -func (d *vfsgen۰DirInfo) Mode() os.FileMode { return 0755 | os.ModeDir } -func (d *vfsgen۰DirInfo) ModTime() time.Time { return d.modTime } -func (d *vfsgen۰DirInfo) IsDir() bool { return true } -func (d *vfsgen۰DirInfo) Sys() interface{} { return nil } - -// vfsgen۰Dir is an opened dir instance. -type vfsgen۰Dir struct { - *vfsgen۰DirInfo - pos int // Position within entries for Seek and Readdir. -} - -func (d *vfsgen۰Dir) Seek(offset int64, whence int) (int64, error) { - if offset == 0 && whence == io.SeekStart { - d.pos = 0 - return 0, nil - } - return 0, fmt.Errorf("unsupported Seek in directory %s", d.name) -} - -func (d *vfsgen۰Dir) Readdir(count int) ([]os.FileInfo, error) { - if d.pos >= len(d.entries) && count > 0 { - return nil, io.EOF - } - if count <= 0 || count > len(d.entries)-d.pos { - count = len(d.entries) - d.pos - } - e := d.entries[d.pos : d.pos+count] - d.pos += count - return e, nil -}