feat: boot.img.lz4
This commit is contained in:
29
vendor/github.com/gobuffalo/packd/.gitignore
generated
vendored
Normal file
29
vendor/github.com/gobuffalo/packd/.gitignore
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
*.log
|
||||
.DS_Store
|
||||
doc
|
||||
tmp
|
||||
pkg
|
||||
*.gem
|
||||
*.pid
|
||||
coverage
|
||||
coverage.data
|
||||
build/*
|
||||
*.pbxuser
|
||||
*.mode1v3
|
||||
.svn
|
||||
profile
|
||||
.console_history
|
||||
.sass-cache/*
|
||||
.rake_tasks~
|
||||
*.log.lck
|
||||
solr/
|
||||
.jhw-cache/
|
||||
jhw.*
|
||||
*.sublime*
|
||||
node_modules/
|
||||
dist/
|
||||
generated/
|
||||
.vendor/
|
||||
bin/*
|
||||
gin-bin
|
||||
.idea/
|
3
vendor/github.com/gobuffalo/packd/.gometalinter.json
generated
vendored
Normal file
3
vendor/github.com/gobuffalo/packd/.gometalinter.json
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"]
|
||||
}
|
26
vendor/github.com/gobuffalo/packd/.travis.yml
generated
vendored
Normal file
26
vendor/github.com/gobuffalo/packd/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
language: go
|
||||
|
||||
sudo: false
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- go: "1.9.x"
|
||||
- go: "1.10.x"
|
||||
- go: "1.11.x"
|
||||
env:
|
||||
- GO111MODULE=off
|
||||
- go: "1.11.x"
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
- go: "tip"
|
||||
env:
|
||||
- GO111MODULE=off
|
||||
- go: "tip"
|
||||
env:
|
||||
- GO111MODULE=on
|
||||
allow_failures:
|
||||
- go: "tip"
|
||||
|
||||
install: make deps
|
||||
|
||||
script: make ci-test
|
21
vendor/github.com/gobuffalo/packd/LICENSE
generated
vendored
Normal file
21
vendor/github.com/gobuffalo/packd/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Mark Bates
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
55
vendor/github.com/gobuffalo/packd/Makefile
generated
vendored
Normal file
55
vendor/github.com/gobuffalo/packd/Makefile
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
TAGS ?= "sqlite"
|
||||
GO_BIN ?= go
|
||||
|
||||
install:
|
||||
packr
|
||||
$(GO_BIN) install -tags ${TAGS} -v .
|
||||
make tidy
|
||||
|
||||
tidy:
|
||||
ifeq ($(GO111MODULE),on)
|
||||
$(GO_BIN) mod tidy
|
||||
else
|
||||
echo skipping go mod tidy
|
||||
endif
|
||||
|
||||
deps:
|
||||
$(GO_BIN) get github.com/gobuffalo/release
|
||||
$(GO_BIN) get github.com/gobuffalo/packr/packr
|
||||
$(GO_BIN) get -tags ${TAGS} -t ./...
|
||||
make tidy
|
||||
|
||||
build:
|
||||
packr
|
||||
$(GO_BIN) build -v .
|
||||
make tidy
|
||||
|
||||
test:
|
||||
packr
|
||||
$(GO_BIN) test -tags ${TAGS} ./...
|
||||
make tidy
|
||||
|
||||
ci-test:
|
||||
$(GO_BIN) test -tags ${TAGS} -race ./...
|
||||
make tidy
|
||||
|
||||
lint:
|
||||
gometalinter --vendor ./... --deadline=1m --skip=internal
|
||||
make tidy
|
||||
|
||||
update:
|
||||
$(GO_BIN) get -u -tags ${TAGS}
|
||||
make tidy
|
||||
packr
|
||||
make test
|
||||
make install
|
||||
make tidy
|
||||
|
||||
release-test:
|
||||
$(GO_BIN) test -tags ${TAGS} -race ./...
|
||||
make tidy
|
||||
|
||||
release:
|
||||
make tidy
|
||||
release -y -f version.go
|
||||
make tidy
|
24
vendor/github.com/gobuffalo/packd/README.md
generated
vendored
Normal file
24
vendor/github.com/gobuffalo/packd/README.md
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
<p align="center"><img src="https://github.com/gobuffalo/buffalo/blob/master/logo.svg" width="360"></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://godoc.org/github.com/gobuffalo/packd"><img src="https://godoc.org/github.com/gobuffalo/packd?status.svg" alt="GoDoc" /></a>
|
||||
<a href="https://travis-ci.org/gobuffalo/packd"><img src="https://travis-ci.org/gobuffalo/packd.svg?branch=master" alt="Build Status" /></a>
|
||||
<a href="https://goreportcard.com/report/github.com/gobuffalo/packd"><img src="https://goreportcard.com/badge/github.com/gobuffalo/packd" alt="Go Report Card" /></a>
|
||||
</p>
|
||||
|
||||
# github.com/gobuffalo/packd
|
||||
|
||||
This is a collection of interfaces designed to make using [github.com/gobuffalo/packr](https://github.com/gobuffalo/packr) easier, and to make the transition between v1 and v2 as seamless as possible.
|
||||
|
||||
They can, and should, be used for testing, alternate Box implementations, etc...
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ go get -u -v github.com/gobuffalo/packd
|
||||
```
|
||||
|
||||
## Memory Box
|
||||
|
||||
The [`packd#MemoryBox`](https://godoc.org/github.com/gobuffalo/packd#MemoryBox) is a complete, thread-safe, implementation of [`packd#Box`](https://godoc.org/github.com/gobuffalo/packd#Box)
|
104
vendor/github.com/gobuffalo/packd/file.go
generated
vendored
Normal file
104
vendor/github.com/gobuffalo/packd/file.go
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
package packd
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var _ File = &virtualFile{}
|
||||
var _ io.Reader = &virtualFile{}
|
||||
var _ io.Writer = &virtualFile{}
|
||||
var _ fmt.Stringer = &virtualFile{}
|
||||
|
||||
type virtualFile struct {
|
||||
buf *bytes.Buffer
|
||||
name string
|
||||
info fileInfo
|
||||
}
|
||||
|
||||
func (f virtualFile) Name() string {
|
||||
return f.name
|
||||
}
|
||||
|
||||
func (f virtualFile) Seek(offset int64, whence int) (int64, error) {
|
||||
return -1, nil
|
||||
}
|
||||
|
||||
func (f virtualFile) FileInfo() (os.FileInfo, error) {
|
||||
return f.info, nil
|
||||
}
|
||||
|
||||
func (f virtualFile) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f virtualFile) Readdir(count int) ([]os.FileInfo, error) {
|
||||
return []os.FileInfo{f.info}, nil
|
||||
}
|
||||
|
||||
func (f virtualFile) Stat() (os.FileInfo, error) {
|
||||
return f.info, nil
|
||||
}
|
||||
|
||||
func (s *virtualFile) String() string {
|
||||
return s.buf.String()
|
||||
}
|
||||
|
||||
func (s *virtualFile) Read(p []byte) (int, error) {
|
||||
return s.buf.Read(p)
|
||||
}
|
||||
|
||||
func (s *virtualFile) Write(p []byte) (int, error) {
|
||||
bb := &bytes.Buffer{}
|
||||
i, err := bb.Write(p)
|
||||
if err != nil {
|
||||
return i, errors.WithStack(err)
|
||||
}
|
||||
s.buf = bb
|
||||
s.info = fileInfo{
|
||||
Path: s.name,
|
||||
Contents: bb.Bytes(),
|
||||
size: int64(bb.Len()),
|
||||
modTime: time.Now(),
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
// NewDir returns a new "virtual" file
|
||||
func NewFile(name string, r io.Reader) (File, error) {
|
||||
bb := &bytes.Buffer{}
|
||||
if r != nil {
|
||||
io.Copy(bb, r)
|
||||
}
|
||||
return &virtualFile{
|
||||
buf: bb,
|
||||
name: name,
|
||||
info: fileInfo{
|
||||
Path: name,
|
||||
Contents: bb.Bytes(),
|
||||
size: int64(bb.Len()),
|
||||
modTime: time.Now(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NewDir returns a new "virtual" directory
|
||||
func NewDir(name string) (File, error) {
|
||||
bb := &bytes.Buffer{}
|
||||
return &virtualFile{
|
||||
buf: bb,
|
||||
name: name,
|
||||
info: fileInfo{
|
||||
Path: name,
|
||||
Contents: bb.Bytes(),
|
||||
size: int64(bb.Len()),
|
||||
modTime: time.Now(),
|
||||
isDir: true,
|
||||
},
|
||||
}, nil
|
||||
}
|
40
vendor/github.com/gobuffalo/packd/file_info.go
generated
vendored
Normal file
40
vendor/github.com/gobuffalo/packd/file_info.go
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
package packd
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
var _ os.FileInfo = fileInfo{}
|
||||
|
||||
type fileInfo struct {
|
||||
Path string
|
||||
Contents []byte
|
||||
size int64
|
||||
modTime time.Time
|
||||
isDir bool
|
||||
}
|
||||
|
||||
func (f fileInfo) Name() string {
|
||||
return f.Path
|
||||
}
|
||||
|
||||
func (f fileInfo) Size() int64 {
|
||||
return f.size
|
||||
}
|
||||
|
||||
func (f fileInfo) Mode() os.FileMode {
|
||||
return 0444
|
||||
}
|
||||
|
||||
func (f fileInfo) ModTime() time.Time {
|
||||
return f.modTime
|
||||
}
|
||||
|
||||
func (f fileInfo) IsDir() bool {
|
||||
return f.isDir
|
||||
}
|
||||
|
||||
func (f fileInfo) Sys() interface{} {
|
||||
return nil
|
||||
}
|
8
vendor/github.com/gobuffalo/packd/go.mod
generated
vendored
Normal file
8
vendor/github.com/gobuffalo/packd/go.mod
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
module github.com/gobuffalo/packd
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/pkg/errors v0.8.0
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/stretchr/testify v1.2.2
|
||||
)
|
8
vendor/github.com/gobuffalo/packd/go.sum
generated
vendored
Normal file
8
vendor/github.com/gobuffalo/packd/go.sum
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
79
vendor/github.com/gobuffalo/packd/interfaces.go
generated
vendored
Normal file
79
vendor/github.com/gobuffalo/packd/interfaces.go
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
package packd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
type WalkFunc func(string, File) error
|
||||
|
||||
// Box represents the entirety of the necessary
|
||||
// interfaces to form a "full" box.
|
||||
// github.com/gobuffalo/packr#Box is an example of this interface.
|
||||
type Box interface {
|
||||
HTTPBox
|
||||
Lister
|
||||
Addable
|
||||
Finder
|
||||
Walkable
|
||||
Haser
|
||||
}
|
||||
|
||||
type Haser interface {
|
||||
Has(string) bool
|
||||
}
|
||||
|
||||
type Walkable interface {
|
||||
Walk(wf WalkFunc) error
|
||||
WalkPrefix(prefix string, wf WalkFunc) error
|
||||
}
|
||||
|
||||
type Finder interface {
|
||||
Find(string) ([]byte, error)
|
||||
FindString(name string) (string, error)
|
||||
}
|
||||
|
||||
type HTTPBox interface {
|
||||
Open(name string) (http.File, error)
|
||||
}
|
||||
|
||||
type Lister interface {
|
||||
List() []string
|
||||
}
|
||||
|
||||
type Addable interface {
|
||||
AddString(path string, t string) error
|
||||
AddBytes(path string, t []byte) error
|
||||
}
|
||||
|
||||
type SimpleFile interface {
|
||||
fmt.Stringer
|
||||
io.Reader
|
||||
io.Writer
|
||||
Name() string
|
||||
}
|
||||
|
||||
type HTTPFile interface {
|
||||
SimpleFile
|
||||
io.Closer
|
||||
io.Seeker
|
||||
Readdir(count int) ([]os.FileInfo, error)
|
||||
Stat() (os.FileInfo, error)
|
||||
}
|
||||
|
||||
type File interface {
|
||||
HTTPFile
|
||||
FileInfo() (os.FileInfo, error)
|
||||
}
|
||||
|
||||
// LegacyBox represents deprecated methods
|
||||
// that older Box implementations might have had.
|
||||
// github.com/gobuffalo/packr v1 is an example of a LegacyBox.
|
||||
type LegacyBox interface {
|
||||
String(name string) string
|
||||
MustString(name string) (string, error)
|
||||
Bytes(name string) []byte
|
||||
MustBytes(name string) ([]byte, error)
|
||||
}
|
148
vendor/github.com/gobuffalo/packd/memory_box.go
generated
vendored
Normal file
148
vendor/github.com/gobuffalo/packd/memory_box.go
generated
vendored
Normal file
@ -0,0 +1,148 @@
|
||||
package packd
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var _ Addable = NewMemoryBox()
|
||||
var _ Finder = NewMemoryBox()
|
||||
var _ Lister = NewMemoryBox()
|
||||
var _ HTTPBox = NewMemoryBox()
|
||||
var _ Haser = NewMemoryBox()
|
||||
var _ Walkable = NewMemoryBox()
|
||||
var _ Box = NewMemoryBox()
|
||||
|
||||
// MemoryBox is a thread-safe, in-memory, implementation of the Box interface.
|
||||
type MemoryBox struct {
|
||||
files *sync.Map
|
||||
}
|
||||
|
||||
func (m *MemoryBox) Has(path string) bool {
|
||||
_, ok := m.files.Load(path)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (m *MemoryBox) List() []string {
|
||||
var names []string
|
||||
m.files.Range(func(key interface{}, value interface{}) bool {
|
||||
if s, ok := key.(string); ok {
|
||||
names = append(names, s)
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
sort.Strings(names)
|
||||
return names
|
||||
}
|
||||
|
||||
func (m *MemoryBox) Open(path string) (http.File, error) {
|
||||
cpath := strings.TrimPrefix(path, "/")
|
||||
|
||||
if filepath.Ext(cpath) == "" {
|
||||
// it's a directory
|
||||
return NewDir(path)
|
||||
}
|
||||
|
||||
if len(cpath) == 0 {
|
||||
cpath = "index.html"
|
||||
}
|
||||
|
||||
b, err := m.Find(cpath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cpath = filepath.FromSlash(cpath)
|
||||
|
||||
f, err := NewFile(cpath, bytes.NewReader(b))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
|
||||
func (m *MemoryBox) FindString(path string) (string, error) {
|
||||
bb, err := m.Find(path)
|
||||
return string(bb), err
|
||||
}
|
||||
|
||||
func (m *MemoryBox) Find(path string) ([]byte, error) {
|
||||
res, ok := m.files.Load(strings.ToLower(path))
|
||||
if !ok {
|
||||
return nil, os.ErrNotExist
|
||||
}
|
||||
b, ok := res.([]byte)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("expected []byte got %T", res)
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (m *MemoryBox) AddString(path string, t string) error {
|
||||
return m.AddBytes(path, []byte(t))
|
||||
}
|
||||
|
||||
func (m *MemoryBox) AddBytes(path string, t []byte) error {
|
||||
m.files.Store(strings.ToLower(path), t)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MemoryBox) Walk(wf WalkFunc) error {
|
||||
var err error
|
||||
m.files.Range(func(key interface{}, res interface{}) bool {
|
||||
|
||||
path, ok := key.(string)
|
||||
if !ok {
|
||||
err = fmt.Errorf("expected string got %T", key)
|
||||
return false
|
||||
}
|
||||
|
||||
b, ok := res.([]byte)
|
||||
if !ok {
|
||||
err = fmt.Errorf("expected []byte got %T", res)
|
||||
return false
|
||||
}
|
||||
|
||||
var f File
|
||||
f, err = NewFile(path, bytes.NewReader(b))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
err = wf(path, f)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *MemoryBox) WalkPrefix(pre string, wf WalkFunc) error {
|
||||
return m.Walk(func(path string, file File) error {
|
||||
if strings.HasPrefix(path, pre) {
|
||||
return wf(path, file)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (m *MemoryBox) Remove(path string) {
|
||||
m.files.Delete(path)
|
||||
}
|
||||
|
||||
// NewMemoryBox returns a configured *MemoryBox
|
||||
func NewMemoryBox() *MemoryBox {
|
||||
return &MemoryBox{
|
||||
files: &sync.Map{},
|
||||
}
|
||||
}
|
4
vendor/github.com/gobuffalo/packd/version.go
generated
vendored
Normal file
4
vendor/github.com/gobuffalo/packd/version.go
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
package packd
|
||||
|
||||
// Version of packd
|
||||
const Version = "v0.0.1"
|
Reference in New Issue
Block a user