diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fa0fac0..8998c7b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,27 +1,19 @@ name: Tests on: [push, pull_request] jobs: - tests: name: ${{matrix.go-version}} ${{matrix.os}} runs-on: ${{ matrix.os }} strategy: matrix: - go-version: [1.12.x, 1.13.x] + go-version: [1.16.x, 1.17.x] os: [macos-latest, windows-latest, ubuntu-latest] steps: - name: Checkout Code - uses: actions/checkout@v1 + uses: actions/checkout@v2 with: fetch-depth: 1 - - name: Test v1 + - name: Test run: | - go get -t -v ./... go test -race ./... - go install -v ./packr - - name: Test v2 - run: | - cd v2 - go get -t -v ./... - go test -race ./... - go install -v ./packr2 \ No newline at end of file + go install -v ./packr2 diff --git a/.goreleaser.yml b/.goreleaser.yml index 288f4d5..7a57ebb 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -7,10 +7,19 @@ builds: - darwin - linux - windows + goarch: + - ppc64le + - 386 + - amd64 env: - CGO_ENABLED=0 - main: ./packr/main.go - binary: packr + ignore: + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: ppc64le + main: ./packr2/main.go + binary: packr2 checksum: name_template: 'checksums.txt' @@ -25,8 +34,9 @@ changelog: - '^docs:' - '^test:' -brew: - github: - owner: gobuffalo - name: homebrew-tap +brews: + - + github: + owner: gobuffalo + name: homebrew-tap diff --git a/.goreleaser.yml.plush b/.goreleaser.yml.plush index 1d25c9a..6bd6ba9 100644 --- a/.goreleaser.yml.plush +++ b/.goreleaser.yml.plush @@ -4,10 +4,19 @@ builds: - darwin - linux - windows + goarch: + - ppc64le + - 386 + - amd64 env: - CGO_ENABLED=0 - main: ./packr/main.go - binary: packr + ignore: + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: ppc64le + main: ./packr2/main.go + binary: packr2 checksum: name_template: 'checksums.txt' @@ -22,8 +31,9 @@ changelog: - '^docs:' - '^test:' <%= if (brew) { %> -brew: - github: - owner: gobuffalo - name: homebrew-tap +brews: + - + github: + owner: gobuffalo + name: homebrew-tap <% } %> diff --git a/Makefile b/Makefile index b60c437..0c87008 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,9 @@ TAGS ?= "sqlite" GO_BIN ?= go install: deps - echo "installing packr v1" - packr - $(GO_BIN) install -v ./packr + echo "installing packr v2" + packr2 + $(GO_BIN) install -v ./packr2 tidy: ifeq ($(GO111MODULE),on) @@ -14,46 +14,28 @@ else endif deps: - rm -rf packrd - rm -rf v2/packrd - $(GO_BIN) get github.com/gobuffalo/release $(GO_BIN) get -tags ${TAGS} -t ./... - $(GO_BIN) install -v ./packr - packr clean + $(GO_BIN) install -v ./packr2 make tidy build: deps - packr - $(GO_BIN) build -v . + packr2 + $(GO_BIN) build -v ./packr2 make tidy test: - packr clean + packr2 $(GO_BIN) test -tags ${TAGS} ./... - packr clean - -ci-deps: - rm -rf packrd - rm -rf v2/packrd - $(GO_BIN) get -tags ${TAGS} -t ./... - $(GO_BIN) install -v ./packr - packr clean - make tidy - -ci-test: - $(GO_BIN) test -v -tags ${TAGS} -race ./... make tidy - cd ./v2 && make ci-test lint: gometalinter --vendor ./... --deadline=1m --skip=internal update: - $(GO_BIN) get -u -tags ${TAGS} + $(GO_BIN) get -u -tags ${TAGS} ./... make tidy - packr - make test make install + make test make tidy release-test: diff --git a/README.md b/README.md index f74de4c..cb63463 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,50 @@ -**NOTICE: Please consider migrating your projects to [github.com/markbates/pkger](https://github.com/markbates/pkger). It has an idiomatic API, minimal dependencies, a stronger test suite (tested directly against the std lib counterparts), transparent tooling, and more.** +**NOTICE: Please consider migrating your projects to github.com/markbates/pkger. It has an idiomatic API, minimal dependencies, a stronger test suite (tested directly against the std lib counterparts), transparent tooling, and more.** https://blog.gobuffalo.io/introducing-pkger-static-file-embedding-in-go-1ce76dc79c65 +# Packr (v2) -# packr (v1) - -[![GoDoc](https://godoc.org/github.com/gobuffalo/packr?status.svg)](https://godoc.org/github.com/gobuffalo/packr) - -## Packr has been updated to `v2`! Please read the `./v2/README.md` file for more details. - ---- +[![GoDoc](https://godoc.org/github.com/gobuffalo/packr/v2?status.svg)](https://godoc.org/github.com/gobuffalo/packr/v2) +[![Actions Status](https://github.com/gobuffalo/packr/workflows/Tests/badge.svg)](https://github.com/gobuffalo/packr/actions) Packr is a simple solution for bundling static assets inside of Go binaries. Most importantly it does it in a way that is friendly to developers while they are developing. ## Intro Video -To get an idea of the what and why of packr, please enjoy this short video: [https://vimeo.com/219863271](https://vimeo.com/219863271). - -## Installation +To get an idea of the what and why of Packr, please enjoy this short video: [https://vimeo.com/219863271](https://vimeo.com/219863271). -To install Packr utility +## Library Installation ```text -$ go get -u github.com/gobuffalo/packr/packr +$ go get -u github.com/gobuffalo/packr/v2/... ``` -To get the dependency +## Binary Installation ```text -$ go get -u github.com/gobuffalo/packr +$ go get -u github.com/gobuffalo/packr/v2/packr2 +``` + +## New File Format FAQs + +In version `v2.0.0` the file format changed and is not backward compatible with the `packr-v1.x` library. + +#### Can `packr-v1.x` read the new format? + +No, it can not. Because of the way the new file format works porting it to `packr-v1.x` would be difficult. PRs are welcome though. :) + +#### Can `packr-v2.x` read `packr-v1.x` files? + +Yes it can, but that ability will eventually be phased out. Because of that we recommend moving to the new format. + +#### Can `packr-v2.x` generate `packr-v1.x` files? + +Yes it can, but that ability will eventually be phased out. Because of that we recommend moving to the new format. + +The `--legacy` command is available on all commands that generate `-packr.go` files. + +```bash +$ packr2 --legacy ``` ## Usage @@ -38,8 +54,8 @@ $ go get -u github.com/gobuffalo/packr The first step in using Packr is to create a new box. A box represents a folder on disk. Once you have a box you can get `string` or `[]byte` representations of the file. ```go -// set up a new box by giving it a (relative) path to a folder on disk: -box := packr.NewBox("./templates") +// set up a new box by giving it a name and an optional (relative) path to a folder on disk: +box := packr.New("My Box", "./templates") // Get the string representation of a file, or an error if it doesn't exist: html, err := box.FindString("index.html") @@ -50,7 +66,7 @@ html, err := box.Find("index.html") ### What is a Box? -A box represents a folder, and any sub-folders, on disk that you want to have access to in your binary. When compiling a binary using the `packr` CLI the contents of the folder will be converted into Go files that can be compiled inside of a "standard" go binary. Inside of the compiled binary the files will be read from memory. When working locally the files will be read directly off of disk. This is a seamless switch that doesn't require any special attention on your part. +A box represents a folder, and any sub-folders, on disk that you want to have access to in your binary. When compiling a binary using the `packr2` CLI the contents of the folder will be converted into Go files that can be compiled inside of a "standard" go binary. Inside of the compiled binary the files will be read from memory. When working locally the files will be read directly off of disk. This is a seamless switch that doesn't require any special attention on your part. #### Example @@ -72,11 +88,11 @@ package main import ( "fmt" - "github.com/gobuffalo/packr" + "github.com/gobuffalo/packr/v2" ) func main() { - box := packr.NewBox("./templates") + box := packr.New("myBox", "./templates") s, err := box.FindString("admin/index.html") if err != nil { @@ -111,100 +127,114 @@ A box implements the [`http.FileSystem`](https://golang.org/pkg/net/http/#FileSy package main import ( - "net/http" + "net/http" - "github.com/gobuffalo/packr" + "github.com/gobuffalo/packr/v2" ) func main() { - box := packr.NewBox("./templates") + box := packr.New("someBoxName", "./templates") - http.Handle("/", http.FileServer(box)) - http.ListenAndServe(":3000", nil) + http.Handle("/", http.FileServer(box)) + http.ListenAndServe(":3000", nil) } ``` --- -## Building a Binary (the easy way) - -When it comes time to build, or install, your Go binary, simply use `packr build` or `packr install` just as you would `go build` or `go install`. All flags for the `go` tool are supported and everything works the way you expect, the only difference is your static assets are now bundled in the generated binary. If you want more control over how this happens, looking at the following section on building binaries (the hard way). - -## Building a Binary (the hard way) +## Building a Binary -Before you build your Go binary, run the `packr` command first. It will look for all the boxes in your code and then generate `.go` files that pack the static files into bytes that can be bundled into the Go binary. +Before you build your Go binary, run the `packr2` command first. It will look for all the boxes in your code and then generate `.go` files that pack the static files into bytes that can be bundled into the Go binary. ``` -$ packr +$ packr2 ``` Then run your `go build command` like normal. -*NOTE*: It is not recommended to check-in these generated `-packr.go` files. They can be large, and can easily become out of date if not careful. It is recommended that you always run `packr clean` after running the `packr` tool. +*NOTE*: It is not recommended to check-in these generated `-packr.go` files. They can be large, and can easily become out of date if not careful. It is recommended that you always run `packr2 clean` after running the `packr2` tool. #### Cleaning Up -When you're done it is recommended that you run the `packr clean` command. This will remove all of the generated files that Packr created for you. +When you're done it is recommended that you run the `packr2 clean` command. This will remove all of the generated files that Packr created for you. ``` -$ packr clean +$ packr2 clean ``` Why do you want to do this? Packr first looks to the information stored in these generated files, if the information isn't there it looks to disk. This makes it easy to work with in development. --- -## Building/Moving a portable release - -When it comes to building multiple releases you typically want that release to be built in a specific directory. +## Debugging -For example: `./releases` +The `packr2` command passes all arguments down to the underlying `go` command, this includes the `-v` flag to print out `go build` information. Packr looks for the `-v` flag, and will turn on its own verbose logging. This is very useful for trying to understand what the `packr` command is doing when it is run. -However, because passing a `.go` file requires absolute paths, we must compile the release in the appropriate absolute path. +--- -```bash -GOOS=linux GOARCH=amd64 packr build -``` +## FAQ -Now your `project_name` binary will be built at the root of your project dir. Great! +### Compilation Errors with Go Templates -All that is left to do is to move that binary to your release dir: +Q: I have a program with Go template files, those files are named `foo.go` and look like the following: -Linux/macOS/Windows (bash) +``` +// Copyright {{.Year}} {{.Author}}. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. -```bash -mv ./project_name ./releases +package {{.Project}} ``` -Windows (cmd): +When I run `packr2` I get errors like: -```cmd -move ./project_name ./releases +``` +expected 'IDENT', found '{' ``` -Powershell: +A: Packr works by searching your `.go` files for [`github.com/gobuffalo/packr/v2#New`](https://godoc.org/github.com/gobuffalo/packr/v2#New) or [`github.com/gobuffalo/packr/v2#NewBox`](https://godoc.org/github.com/gobuffalo/packr/v2#NewBox) calls. Because those files aren't "proper" Go files, Packr can't parse them to find the box declarations. To fix this you need to tell Packr to ignore those files when searching for boxes. A couple solutions to this problem are: -```powershell -Move-Item -Path .\project_name -Destination .\releases\ +* Name the files something else. The `.tmpl` extension is the idiomatic way of naming these types of files. +* Rename the folder containing these files to start with an `_`, for example `_templates`. Packr, like Go, will ignore folders starting with the `_` character when searching for boxes. + +### Dynamic Box Paths + +Q: I need to set the path of a box using a variable, but `packr.New("foo", myVar)` doesn't work correctly. + +A: Packr attempts to "automagically" set it's resolution directory when using [`github.com/gobuffalo/packr/v2#New`](https://godoc.org/github.com/gobuffalo/packr/v2#New), however, for dynamic paths you need to set it manually: + +```go +box := packr.New("foo", "|") +box.ResolutionDir = myVar ``` -If you _target_ for Windows when building don't forget that it's `project_name.exe` +### I don't want to pack files, but still use the Packr interface. -Now you can make multiple releases and all of your needed static files will be available! +Q: I want to write code that using the Packr tools, but doesn't actually pack the files into my binary. How can I do that? -#### Summing it up: +A: Using [`github.com/gobuffalo/packr/v2#Folder`](https://godoc.org/github.com/gobuffalo/packr/v2#Folder) gives you back a `*packr.Box` that can be used as normal, but is excluded by the Packr tool when compiling. -Example Script for building to 3 common targets: +### Packr Finds No Boxes -```bash -GOOS=darwin GOARCH=amd64 packr build && mv ./project_name ./releases/darwin-project_name \ - && GOOS=linux GOARCH=amd64 packr build && mv ./project_name ./releases/linux-project_name \ - && GOOS=windows GOARCH=386 packr build && mv ./project_name.exe ./releases/project_name.exe \ - && packr clean +Q: I run `packr2 -v` but it doesn't find my boxes: + +``` +DEBU[2019-03-18T18:48:52+01:00] *parser.Parser#NewFromRoots found prospects=0 +DEBU[2019-03-18T18:48:52+01:00] found 0 boxes ``` ---- +A: Packr works by parsing `.go` files to find [`github.com/gobuffalo/packr/v2#Box`](https://godoc.org/github.com/gobuffalo/packr/v2#Box) and [`github.com/gobuffalo/packr/v2#NewBox`](https://godoc.org/github.com/gobuffalo/packr/v2#NewBox) declarations. If there aren't any `.go` in the folder that `packr2` is run in it can not find those declarations. To fix this problem run the `packr2` command in the directory containing your `.go` files. -## Debugging +### Box Interfaces -The `packr` command passes all arguments down to the underlying `go` command, this includes the `-v` flag to print out `go build` information. Packr looks for the `-v` flag, and will turn on its own verbose logging. This is very useful for trying to understand what the `packr` command is doing when it is run. +Q: I want to be able to easily test my applications by passing in mock boxes. How do I do that? + +A: Packr boxes and files conform to the interfaces found at [`github.com/gobuffalo/packd`](https://godoc.org/github.com/gobuffalo/packd). Change your application to use those interfaces instead of the concrete Packr types. + +```go +// using concrete type +func myFunc(box *packr.Box) {} + +// using interfaces +func myFunc(box packd.Box) {} +``` diff --git a/SHOULDERS.md b/SHOULDERS.md index 2690007..9b97a55 100644 --- a/SHOULDERS.md +++ b/SHOULDERS.md @@ -1,18 +1,32 @@ -# github.com/gobuffalo/packr Stands on the Shoulders of Giants +# github.com/gobuffalo/packr/v2 Stands on the Shoulders of Giants -github.com/gobuffalo/packr does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants, this project would not be possible. Please make sure to check them out and thank them for all of their hard work. +github.com/gobuffalo/packr/v2 does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants, this project would not be possible. Please make sure to check them out and thank them for all of their hard work. Thank you to the following **GIANTS**: -* [github.com/gobuffalo/envy](https://godoc.org/github.com/gobuffalo/envy) +* [github.com/gobuffalo/logger](https://godoc.org/github.com/gobuffalo/logger) * [github.com/gobuffalo/packd](https://godoc.org/github.com/gobuffalo/packd) -* [github.com/gobuffalo/packr/v2](https://godoc.org/github.com/gobuffalo/packr/v2) +* [github.com/karrick/godirwalk](https://godoc.org/github.com/karrick/godirwalk) + +* [github.com/konsorten/go-windows-terminal-sequences](https://godoc.org/github.com/konsorten/go-windows-terminal-sequences) + +* [github.com/markbates/errx](https://godoc.org/github.com/markbates/errx) + +* [github.com/markbates/oncer](https://godoc.org/github.com/markbates/oncer) + +* [github.com/markbates/safe](https://godoc.org/github.com/markbates/safe) + +* [github.com/rogpeppe/go-internal](https://godoc.org/github.com/rogpeppe/go-internal) + +* [github.com/sirupsen/logrus](https://godoc.org/github.com/sirupsen/logrus) * [github.com/spf13/cobra](https://godoc.org/github.com/spf13/cobra) * [github.com/stretchr/testify](https://godoc.org/github.com/stretchr/testify) * [golang.org/x/sync](https://godoc.org/golang.org/x/sync) + +* [golang.org/x/tools](https://godoc.org/golang.org/x/tools) diff --git a/v2/_fixtures/http_test/css/main.css b/_fixtures/http_test/css/main.css similarity index 100% rename from v2/_fixtures/http_test/css/main.css rename to _fixtures/http_test/css/main.css diff --git a/v2/_fixtures/http_test/footer.html b/_fixtures/http_test/footer.html similarity index 100% rename from v2/_fixtures/http_test/footer.html rename to _fixtures/http_test/footer.html diff --git a/v2/_fixtures/http_test/index.html b/_fixtures/http_test/index.html similarity index 100% rename from v2/_fixtures/http_test/index.html rename to _fixtures/http_test/index.html diff --git a/v2/_fixtures/http_test/sub/index.html b/_fixtures/http_test/sub/index.html similarity index 100% rename from v2/_fixtures/http_test/sub/index.html rename to _fixtures/http_test/sub/index.html diff --git a/v2/_fixtures/import_pkg/import_pkg.go b/_fixtures/import_pkg/import_pkg.go similarity index 100% rename from v2/_fixtures/import_pkg/import_pkg.go rename to _fixtures/import_pkg/import_pkg.go diff --git a/v2/_fixtures/import_pkg/import_pkg_test.go b/_fixtures/import_pkg/import_pkg_test.go similarity index 100% rename from v2/_fixtures/import_pkg/import_pkg_test.go rename to _fixtures/import_pkg/import_pkg_test.go diff --git a/v2/_fixtures/import_pkg/pkg_test/1.txt b/_fixtures/import_pkg/pkg_test/1.txt similarity index 100% rename from v2/_fixtures/import_pkg/pkg_test/1.txt rename to _fixtures/import_pkg/pkg_test/1.txt diff --git a/v2/_fixtures/import_pkg/pkg_test/2.txt b/_fixtures/import_pkg/pkg_test/2.txt similarity index 100% rename from v2/_fixtures/import_pkg/pkg_test/2.txt rename to _fixtures/import_pkg/pkg_test/2.txt diff --git a/fixtures/foo/a.txt b/_fixtures/list_test/a.txt similarity index 100% rename from fixtures/foo/a.txt rename to _fixtures/list_test/a.txt diff --git a/fixtures/foo/bar/b.txt b/_fixtures/list_test/b/b.txt similarity index 100% rename from fixtures/foo/bar/b.txt rename to _fixtures/list_test/b/b.txt diff --git a/v2/_fixtures/list_test/b/b2.txt b/_fixtures/list_test/b/b2.txt similarity index 100% rename from v2/_fixtures/list_test/b/b2.txt rename to _fixtures/list_test/b/b2.txt diff --git a/v2/_fixtures/list_test/c/c.txt b/_fixtures/list_test/c/c.txt similarity index 100% rename from v2/_fixtures/list_test/c/c.txt rename to _fixtures/list_test/c/c.txt diff --git a/v2/_fixtures/templates/foo.txt b/_fixtures/templates/foo.txt similarity index 100% rename from v2/_fixtures/templates/foo.txt rename to _fixtures/templates/foo.txt diff --git a/box.go b/box.go index 4922ebb..a2636de 100644 --- a/box.go +++ b/box.go @@ -2,227 +2,239 @@ package packr import ( "bytes" - "compress/gzip" "fmt" + "io" "io/ioutil" "net/http" "os" "path" "path/filepath" - "runtime" + "sort" "strings" "github.com/gobuffalo/packd" + "github.com/gobuffalo/packr/v2/file" + "github.com/gobuffalo/packr/v2/file/resolver" + "github.com/gobuffalo/packr/v2/plog" + "github.com/markbates/oncer" ) -var ( - // ErrResOutsideBox gets returned in case of the requested resources being outside the box - ErrResOutsideBox = fmt.Errorf("Can't find a resource outside the box") -) +var _ packd.Box = &Box{} +var _ packd.HTTPBox = &Box{} +var _ packd.Addable = &Box{} +var _ packd.Walkable = &Box{} +var _ packd.Finder = &Box{} -var _ packd.Box = Box{} -var _ packd.HTTPBox = Box{} -var _ packd.Lister = Box{} -var _ packd.Addable = Box{} -var _ packd.Walkable = Box{} -var _ packd.Finder = Box{} -var _ packd.LegacyBox = Box{} +// Box represent a folder on a disk you want to +// have access to in the built Go binary. +type Box struct { + Path string `json:"path"` + Name string `json:"name"` + ResolutionDir string `json:"resolution_dir"` + DefaultResolver resolver.Resolver `json:"default_resolver"` + resolvers resolversMap + dirs dirsMap +} // NewBox returns a Box that can be used to // retrieve files from either disk or the embedded // binary. -func NewBox(path string) Box { - var cd string - if !filepath.IsAbs(path) { - _, filename, _, _ := runtime.Caller(1) - cd = filepath.Dir(filename) - } +// Deprecated: Use New instead. +func NewBox(path string) *Box { + oncer.Deprecate(0, "packr.NewBox", "Use packr.New instead.") + return New(path, path) +} - // this little hack courtesy of the `-cover` flag!! - cov := filepath.Join("_test", "_obj_test") - cd = strings.Replace(cd, string(filepath.Separator)+cov, "", 1) - if !filepath.IsAbs(cd) && cd != "" { - cd = filepath.Join(GoPath(), "src", cd) +// New returns a new Box with the name of the box +// and the path of the box. +func New(name string, path string) *Box { + plog.Debug("packr", "New", "name", name, "path", path) + b, _ := findBox(name) + if b != nil { + return b } - return Box{ - Path: path, - callingDir: cd, - data: map[string][]byte{}, + b = construct(name, path) + plog.Debug(b, "New", "Box", b, "ResolutionDir", b.ResolutionDir) + b, err := placeBox(b) + if err != nil { + panic(err) } -} -// Box represent a folder on a disk you want to -// have access to in the built Go binary. -type Box struct { - Path string - callingDir string - data map[string][]byte - directories map[string]bool + return b } -// AddString converts t to a byteslice and delegates to AddBytes to add to b.data -func (b Box) AddString(path string, t string) error { - b.AddBytes(path, []byte(t)) - return nil +// Folder returns a Box that will NOT be packed. +// This is useful for writing tests or tools that +// need to work with a folder at runtime. +func Folder(path string) *Box { + return New(path, path) } -// AddBytes sets t in b.data by the given path -func (b Box) AddBytes(path string, t []byte) error { - b.data[path] = t - return nil +// SetResolver allows for the use of a custom resolver for +// the specified file +func (b *Box) SetResolver(file string, res resolver.Resolver) { + d := filepath.Dir(file) + b.dirs.Store(d, true) + plog.Debug(b, "SetResolver", "file", file, "resolver", fmt.Sprintf("%T", res)) + b.resolvers.Store(resolver.Key(file), res) } -// Deprecated: Use FindString instead. -func (b Box) String(name string) string { - bb, _ := b.FindString(name) - return bb -} - -// Deprecated: Use FindString instead. -func (b Box) MustString(name string) (string, error) { - return b.FindString(name) -} - -// Deprecated: Use Find instead. -func (b Box) Bytes(name string) []byte { - bb, _ := b.Find(name) - return bb +// AddString converts t to a byteslice and delegates to AddBytes to add to b.data +func (b *Box) AddString(path string, t string) error { + return b.AddBytes(path, []byte(t)) } -// Deprecated: Use Find instead. -func (b Box) MustBytes(name string) ([]byte, error) { - return b.Find(name) +// AddBytes sets t in b.data by the given path +func (b *Box) AddBytes(path string, t []byte) error { + m := map[string]file.File{} + f, err := file.NewFile(path, t) + if err != nil { + return err + } + m[resolver.Key(path)] = f + res := resolver.NewInMemory(m) + b.SetResolver(path, res) + return nil } // FindString returns either the string of the requested // file or an error if it can not be found. -func (b Box) FindString(name string) (string, error) { +func (b *Box) FindString(name string) (string, error) { bb, err := b.Find(name) return string(bb), err } // Find returns either the byte slice of the requested // file or an error if it can not be found. -func (b Box) Find(name string) ([]byte, error) { - f, err := b.find(name) - if err == nil { - bb := &bytes.Buffer{} - bb.ReadFrom(f) - return bb.Bytes(), err +func (b *Box) Find(name string) ([]byte, error) { + f, err := b.Resolve(name) + if err != nil { + return []byte(""), err } - return nil, err + bb := &bytes.Buffer{} + io.Copy(bb, f) + return bb.Bytes(), nil } // Has returns true if the resource exists in the box -func (b Box) Has(name string) bool { - _, err := b.find(name) - if err != nil { - return false - } - return true +func (b *Box) Has(name string) bool { + _, err := b.Find(name) + return err == nil } -func (b Box) decompress(bb []byte) []byte { - reader, err := gzip.NewReader(bytes.NewReader(bb)) - if err != nil { - return bb +// HasDir returns true if the directory exists in the box +func (b *Box) HasDir(name string) bool { + oncer.Do("packr2/box/HasDir"+b.Name, func() { + for _, f := range b.List() { + for d := filepath.Dir(f); d != "."; d = filepath.Dir(d) { + b.dirs.Store(d, true) + } + } + }) + if name == "/" { + return b.Has("index.html") } - defer reader.Close() + _, ok := b.dirs.Load(name) + return ok +} - data, err := ioutil.ReadAll(reader) +// Open returns a File using the http.File interface +func (b *Box) Open(name string) (http.File, error) { + plog.Debug(b, "Open", "name", name) + f, err := b.Resolve(name) if err != nil { - return bb + if len(filepath.Ext(name)) == 0 { + return b.openWoExt(name) + } + return f, err } - return data + f, err = file.NewFileR(name, f) + plog.Debug(b, "Open", "name", f.Name(), "file", f.Name()) + return f, err } -func (b Box) find(name string) (File, error) { - if bb, ok := b.data[name]; ok { - return packd.NewFile(name, bytes.NewReader(bb)) - } - - if b.directories == nil { - b.indexDirectories() - } - - cleanName := filepath.ToSlash(filepath.Clean(name)) - // Ensure name is not outside the box - if strings.HasPrefix(cleanName, "../") { - return nil, ErrResOutsideBox - } - // Absolute name is considered as relative to the box root - cleanName = strings.TrimPrefix(cleanName, "/") - - if _, ok := data[b.Path]; ok { - if bb, ok := data[b.Path][cleanName]; ok { - bb = b.decompress(bb) - return packd.NewFile(cleanName, bytes.NewReader(bb)) - } - if _, ok := b.directories[cleanName]; ok { - return packd.NewDir(cleanName) - } - if filepath.Ext(cleanName) != "" { - // The Handler created by http.FileSystem checks for those errors and - // returns http.StatusNotFound instead of http.StatusInternalServerError. - return nil, os.ErrNotExist +func (b *Box) openWoExt(name string) (http.File, error) { + if !b.HasDir(name) { + id := path.Join(name, "index.html") + if b.Has(id) { + return b.Open(id) } return nil, os.ErrNotExist } - - // Not found in the box virtual fs, try to get it from the file system - cleanName = filepath.FromSlash(cleanName) - p := filepath.Join(b.callingDir, b.Path, cleanName) - return fileFor(p, cleanName) -} - -// Open returns a File using the http.File interface -func (b Box) Open(name string) (http.File, error) { - return b.find(name) + d, err := file.NewDir(name) + plog.Debug(b, "Open", "name", name, "dir", d) + return d, err } // List shows "What's in the box?" -func (b Box) List() []string { +func (b *Box) List() []string { var keys []string - if b.data == nil || len(b.data) == 0 { - b.Walk(func(path string, info File) error { - finfo, _ := info.FileInfo() - if !finfo.IsDir() { - keys = append(keys, finfo.Name()) - } + b.Walk(func(path string, info File) error { + if info == nil { return nil - }) - } else { - for k := range b.data { - keys = append(keys, k) } - } + finfo, _ := info.FileInfo() + if !finfo.IsDir() { + keys = append(keys, path) + } + return nil + }) + sort.Strings(keys) return keys } -func (b *Box) indexDirectories() { - b.directories = map[string]bool{} - if _, ok := data[b.Path]; ok { - for name := range data[b.Path] { - prefix, _ := path.Split(name) - // Even on Windows the suffix appears to be a / - prefix = strings.TrimSuffix(prefix, "/") - b.directories[prefix] = true +// Resolve will attempt to find the file in the box, +// returning an error if the find can not be found. +func (b *Box) Resolve(key string) (file.File, error) { + key = strings.TrimPrefix(key, "/") + + var r resolver.Resolver + + b.resolvers.Range(func(k string, vr resolver.Resolver) bool { + lk := strings.ToLower(resolver.Key(k)) + lkey := strings.ToLower(resolver.Key(key)) + if lk == lkey { + r = vr + return false + } + return true + }) + + if r == nil { + r = b.DefaultResolver + if r == nil { + r = resolver.DefaultResolver + if r == nil { + return nil, fmt.Errorf("resolver.DefaultResolver is nil") + } } } -} + plog.Debug(r, "Resolve", "box", b.Name, "key", key) -func fileFor(p string, name string) (File, error) { - fi, err := os.Stat(p) + f, err := r.Resolve(b.Name, key) if err != nil { - return nil, err - } - if fi.IsDir() { - return packd.NewDir(p) - } - if bb, err := ioutil.ReadFile(p); err == nil { - return packd.NewFile(name, bytes.NewReader(bb)) + z, err := resolver.ResolvePathInBase(resolver.OsPath(b.ResolutionDir), filepath.FromSlash(path.Clean("/"+resolver.OsPath(key)))) + if err != nil { + plog.Debug(r, "Resolve", "box", b.Name, "key", key, "err", err) + return f, err + } + + f, err = r.Resolve(b.Name, z) + if err != nil { + plog.Debug(r, "Resolve", "box", b.Name, "key", z, "err", err) + return f, err + } + b, err := ioutil.ReadAll(f) + if err != nil { + return f, err + } + f, err = file.NewFile(key, b) + if err != nil { + return f, err + } } - return nil, os.ErrNotExist + plog.Debug(r, "Resolve", "box", b.Name, "key", key, "file", f.Name()) + return f, nil } diff --git a/v2/box_import_test.go b/box_import_test.go similarity index 100% rename from v2/box_import_test.go rename to box_import_test.go diff --git a/v2/box_map.go b/box_map.go similarity index 100% rename from v2/box_map.go rename to box_map.go diff --git a/v2/box_map_test.go b/box_map_test.go similarity index 100% rename from v2/box_map_test.go rename to box_map_test.go diff --git a/box_test.go b/box_test.go index c5cf9ca..75fc8c4 100644 --- a/box_test.go +++ b/box_test.go @@ -2,128 +2,252 @@ package packr import ( "bytes" - "io/ioutil" - "os" - "runtime" - "sort" + "path/filepath" "strings" "testing" + "github.com/gobuffalo/packr/v2/file" + "github.com/gobuffalo/packr/v2/file/resolver" "github.com/stretchr/testify/require" ) +func Test_New(t *testing.T) { + r := require.New(t) + + box := New("Test_NewBox", filepath.Join("_fixtures", "list_test")) + r.Len(box.List(), 4) + +} +func Test_Box_AddString(t *testing.T) { + r := require.New(t) + + box := New("Test_Box_AddString", "./templates") + s, err := box.FindString("foo.txt") + r.Error(err) + r.Equal("", s) + + r.NoError(box.AddString("foo.txt", "foo!!")) + s, err = box.FindString("foo.txt") + r.NoError(err) + r.Equal("foo!!", s) +} + +func Test_Box_AddBytes(t *testing.T) { + r := require.New(t) + + box := New("Test_Box_AddBytes", "") + s, err := box.FindString("foo.txt") + r.Error(err) + r.Equal("", s) + + r.NoError(box.AddBytes("foo.txt", []byte("foo!!"))) + s, err = box.FindString("foo.txt") + r.NoError(err) + r.Equal("foo!!", s) +} + +func Test_Box_String(t *testing.T) { + r := require.New(t) + + box := New("Test_Box_String", "./templates") + d := resolver.NewInMemory(map[string]file.File{ + "foo.txt": qfile("foo.txt", "foo!"), + }) + box.SetResolver("foo.txt", d) + + s := box.String("foo.txt") + r.Equal("foo!", s) + + s = box.String("idontexist") + r.Equal("", s) +} + +func Test_Box_String_Miss(t *testing.T) { + r := require.New(t) + + box := New("Test_Box_String_Miss", filepath.Join("_fixtures", "templates")) + + s := box.String("foo.txt") + r.Equal("FOO!!!", strings.TrimSpace(s)) + + s = box.String("idontexist") + r.Equal("", s) +} + func Test_Box_FindString(t *testing.T) { r := require.New(t) - s, err := testBox.FindString("hello.txt") + + box := New("Test_Box_FindString", "./templates") + d := resolver.NewInMemory(map[string]file.File{ + "foo.txt": qfile("foo.txt", "foo!"), + }) + box.SetResolver("foo.txt", d) + + s, err := box.FindString("foo.txt") r.NoError(err) - r.Equal("hello world!", strings.TrimSpace(s)) + r.Equal("foo!", s) - _, err = testBox.Find("idontexist.txt") + s, err = box.FindString("idontexist") r.Error(err) + r.Equal("", s) } -func Test_Box_FindBytes(t *testing.T) { +func Test_Box_FindString_Miss(t *testing.T) { r := require.New(t) - s, err := testBox.Find("hello.txt") + + box := New("Test_Box_FindString_Miss", filepath.Join("_fixtures", "templates")) + + s, err := box.FindString("foo.txt") r.NoError(err) - r.Equal([]byte("hello world!"), bytes.TrimSpace(s)) + r.Equal("FOO!!!", strings.TrimSpace(s)) - _, err = testBox.Find("idontexist.txt") + s, err = box.FindString("idontexist") r.Error(err) + r.Equal("", s) } -func Test_Box_Has(t *testing.T) { +func Test_Box_Bytes(t *testing.T) { r := require.New(t) - r.True(testBox.Has("hello.txt")) - r.False(testBox.Has("idontexist.txt")) + + box := New("Test_Box_Bytes", "./templates") + d := resolver.NewInMemory(map[string]file.File{ + "foo.txt": qfile("foo.txt", "foo!"), + }) + box.SetResolver("foo.txt", d) + + s := box.Bytes("foo.txt") + r.Equal([]byte("foo!"), s) + + s = box.Bytes("idontexist") + r.Equal([]byte(""), s) } -func Test_List_Virtual(t *testing.T) { +func Test_Box_Bytes_Miss(t *testing.T) { r := require.New(t) - mustHave := []string{"a", "b", "c", "d/a"} - actual := virtualBox.List() - sort.Strings(actual) - r.Equal(mustHave, actual) + + box := New("Test_Box_Bytes_Miss", filepath.Join("_fixtures", "templates")) + + s := box.Bytes("foo.txt") + r.Equal([]byte("FOO!!!"), bytes.TrimSpace(s)) + + s = box.Bytes("idontexist") + r.Equal([]byte(""), s) } -func Test_List_Physical(t *testing.T) { +func Test_Box_Find(t *testing.T) { r := require.New(t) - mustHave := osPaths("MyFile.txt", "foo/a.txt", "foo/bar/b.txt", "goodbye.txt", "hello.txt", "index.html") - actual := testBox.List() - r.Equal(mustHave, actual) + + box := New("Test_Box_Find", "./templates") + d := resolver.NewInMemory(map[string]file.File{ + "foo.txt": qfile("foo.txt", "foo!"), + }) + box.SetResolver("foo.txt", d) + + s, err := box.Find("foo.txt") + r.NoError(err) + r.Equal("foo!", string(s)) + + s, err = box.Find("idontexist") + r.Error(err) + r.Equal("", string(s)) } -func Test_Outside_Box(t *testing.T) { +func Test_Box_Find_Miss(t *testing.T) { r := require.New(t) - f, err := ioutil.TempFile("", "") + + box := New("Test_Box_Find_Miss", "./_fixtures/templates") + s, err := box.Find("foo.txt") r.NoError(err) - defer os.RemoveAll(f.Name()) - _, err = testBox.FindString(f.Name()) + r.Equal("FOO!!!", strings.TrimSpace(string(s))) + + s, err = box.Find("idontexist") r.Error(err) + r.Equal("", string(s)) } -func Test_Box_find(t *testing.T) { - box := NewBox("./example") - - onWindows := runtime.GOOS == "windows" - table := []struct { - name string - found bool - }{ - {"assets/app.css", true}, - {"assets\\app.css", onWindows}, - {"foo/bar.baz", false}, - {"bar", true}, - {"bar/sub", true}, - {"bar/foo", false}, - {"bar/sub/sub.html", true}, - } +func Test_Box_Has(t *testing.T) { + r := require.New(t) - for _, tt := range table { - t.Run(tt.name, func(st *testing.T) { - r := require.New(st) - _, err := box.find(tt.name) - if tt.found { - r.True(box.Has(tt.name)) - r.NoError(err) - } else { - r.False(box.Has(tt.name)) - r.Error(err) - } - }) - } + box := New("Test_Box_Has", "./templates") + d := resolver.NewInMemory(map[string]file.File{ + "foo.txt": qfile("foo.txt", "foo!"), + }) + box.SetResolver("foo.txt", d) + + r.True(box.Has("foo.txt")) + r.False(box.Has("idontexist")) } -func Test_Virtual_Directory_Not_Found(t *testing.T) { +func Test_Box_Open(t *testing.T) { r := require.New(t) - _, err := virtualBox.find("d") - r.NoError(err) - _, err = virtualBox.find("does-not-exist") + + d := resolver.NewInMemory(map[string]file.File{ + "foo.txt": qfile("foo.txt", "foo!"), + "bar": qfile("bar", "bar!"), + "baz/index.html": qfile("baz", "baz!"), + }) + box := New("Test_Box_Open", "./templates") + + box.DefaultResolver = d + + for _, x := range []string{"foo.txt", "/foo.txt", "bar", "/bar", "baz", "/baz"} { + f, err := box.Open(x) + r.NoError(err) + r.NotZero(f) + } + + f, err := box.Open("idontexist.txt") r.Error(err) + r.Zero(f) } -func Test_AddString(t *testing.T) { +func Test_Box_List(t *testing.T) { r := require.New(t) - _, err := virtualBox.Find("string") - r.Error(err) + box := New("Test_Box_List", filepath.Join("_fixtures", "list_test")) + r.NoError(box.AddString(filepath.Join("d", "d.txt"), "D")) - virtualBox.AddString("string", "hello") + act := box.List() + exp := []string{"a.txt", filepath.Join("b", "b.txt"), filepath.Join("b", "b2.txt"), filepath.Join("c", "c.txt"), filepath.Join("d", "d.txt")} + r.Equal(exp, act) +} - s, err := virtualBox.FindString("string") - r.NoError(err) - r.Equal("hello", s) +func Test_Box_HasDir(t *testing.T) { + r := require.New(t) + + box := New("Test_Box_HasDir", filepath.Join("_fixtures", "list_test")) + r.NoError(box.AddString("d/e/f.txt", "D")) + + r.True(box.HasDir("d/e")) + r.True(box.HasDir("d")) + r.True(box.HasDir("c")) + r.False(box.HasDir("a")) } -func Test_AddBytes(t *testing.T) { +func Test_Box_Traversal_Standard(t *testing.T) { r := require.New(t) + box := New("Test_Box_Traversal_Standard", "") + _, err := box.FindString("../fixtures/hello.txt") + r.Error(err) +} - _, err := virtualBox.Find("bytes") +func Test_Box_Traversal_Standard_Depth2(t *testing.T) { + r := require.New(t) + box := New("Test_Box_Traversal_Standard_Depth2", "") + _, err := box.FindString("../../packr/fixtures/hello.txt") r.Error(err) +} - virtualBox.AddBytes("bytes", []byte("hello")) +func Test_Box_Traversal_Backslash(t *testing.T) { + r := require.New(t) + box := New("Test_Box_Traversal_Backslash", "") + _, err := box.FindString("..\\fixtures\\hello.txt") + r.Error(err) +} - s, err := virtualBox.Find("bytes") - r.NoError(err) - r.Equal([]byte("hello"), s) +func Test_Box_Traversal_Backslash_Depth2(t *testing.T) { + r := require.New(t) + box := New("Test_Box_Traversal_Backslash_Depth2", "") + _, err := box.FindString("..\\..\\packr2\\fixtures\\hello.txt") + r.Error(err) } diff --git a/builder/box.go b/builder/box.go deleted file mode 100644 index cfeb187..0000000 --- a/builder/box.go +++ /dev/null @@ -1,75 +0,0 @@ -package builder - -import ( - "bytes" - "compress/gzip" - "encoding/json" - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" -) - -type box struct { - Name string - Files []file - compress bool -} - -func (b *box) Walk(root string) error { - root, err := filepath.EvalSymlinks(root) - if err != nil { - return err - } - if _, err := os.Stat(root); err != nil { - // return nil - return fmt.Errorf("could not find folder for box: %s", root) - } - return filepath.Walk(root, func(path string, info os.FileInfo, err error) error { - if info == nil || info.IsDir() || strings.HasSuffix(info.Name(), "-packr.go") { - return nil - } - name := strings.Replace(path, root+string(os.PathSeparator), "", 1) - name = strings.Replace(name, "\\", "/", -1) - f := file{ - Name: name, - } - - DebugLog("packing file %s\n", f.Name) - - bb, err := ioutil.ReadFile(path) - if err != nil { - return err - } - if b.compress { - bb, err = compressFile(bb) - if err != nil { - return err - } - } - bb, err = json.Marshal(bb) - if err != nil { - return err - } - f.Contents = strings.Replace(string(bb), "\"", "\\\"", -1) - - DebugLog("packed file %s\n", f.Name) - b.Files = append(b.Files, f) - return nil - }) -} - -func compressFile(bb []byte) ([]byte, error) { - var buf bytes.Buffer - writer := gzip.NewWriter(&buf) - _, err := writer.Write(bb) - if err != nil { - return bb, err - } - err = writer.Close() - if err != nil { - return bb, err - } - return buf.Bytes(), nil -} diff --git a/builder/builder.go b/builder/builder.go deleted file mode 100644 index 430400e..0000000 --- a/builder/builder.go +++ /dev/null @@ -1,171 +0,0 @@ -package builder - -import ( - "context" - "os" - "path/filepath" - "regexp" - "strings" - "sync" - "text/template" - - "golang.org/x/sync/errgroup" -) - -var DebugLog func(string, ...interface{}) - -func init() { - DebugLog = func(string, ...interface{}) {} -} - -var invalidFilePattern = regexp.MustCompile(`(_test|-packr).go$`) - -// Builder scans folders/files looking for `packr.NewBox` and then compiling -// the required static files into `-packr.go` files so they can -// be built into Go binaries. -type Builder struct { - context.Context - RootPath string - IgnoredBoxes []string - IgnoredFolders []string - pkgs map[string]pkg - moot *sync.Mutex - Compress bool -} - -// Run the builder. -func (b *Builder) Run() error { - wg := &errgroup.Group{} - root, err := filepath.EvalSymlinks(b.RootPath) - if err != nil { - return err - } - err = filepath.Walk(root, func(path string, info os.FileInfo, err error) error { - if info == nil { - return filepath.SkipDir - } - - base := strings.ToLower(filepath.Base(path)) - if strings.HasPrefix(base, "_") { - return filepath.SkipDir - } - for _, f := range b.IgnoredFolders { - if strings.ToLower(f) == base { - if info.IsDir() { - return filepath.SkipDir - } else { - return nil - } - } - } - if !info.IsDir() { - wg.Go(func() error { - return b.process(path) - }) - } - return nil - }) - if err != nil { - return err - } - if err := wg.Wait(); err != nil { - return err - } - return b.dump() -} - -func (b *Builder) dump() error { - for _, p := range b.pkgs { - name := filepath.Join(p.Dir, "a_"+p.Name+"-packr.go") - f, err := os.Create(name) - defer f.Close() - if err != nil { - return err - } - t, err := template.New("").Parse(tmpl) - - if err != nil { - return err - } - err = t.Execute(f, p) - if err != nil { - return err - } - } - return nil -} - -func (b *Builder) process(path string) error { - ext := filepath.Ext(path) - if ext != ".go" || invalidFilePattern.MatchString(path) { - return nil - } - - v := newVisitor(path) - if err := v.Run(); err != nil { - return err - } - - pk := pkg{ - Dir: filepath.Dir(path), - Boxes: []box{}, - Name: v.Package, - } - - for _, n := range v.Boxes { - var ignored bool - for _, i := range b.IgnoredBoxes { - if n == i { - // this is an ignored box - ignored = true - break - } - } - if ignored { - continue - } - bx := &box{ - Name: n, - Files: []file{}, - compress: b.Compress, - } - DebugLog("building box %s\n", bx.Name) - p := filepath.Join(pk.Dir, bx.Name) - if err := bx.Walk(p); err != nil { - return err - } - if len(bx.Files) > 0 { - pk.Boxes = append(pk.Boxes, *bx) - } - DebugLog("built box %s with %q\n", bx.Name, bx.Files) - } - - if len(pk.Boxes) > 0 { - b.addPkg(pk) - } - return nil -} - -func (b *Builder) addPkg(p pkg) { - b.moot.Lock() - defer b.moot.Unlock() - if _, ok := b.pkgs[p.Name]; !ok { - b.pkgs[p.Name] = p - return - } - pp := b.pkgs[p.Name] - pp.Boxes = append(pp.Boxes, p.Boxes...) - b.pkgs[p.Name] = pp -} - -// New Builder with a given context and path -func New(ctx context.Context, path string) *Builder { - return &Builder{ - Context: ctx, - RootPath: path, - IgnoredBoxes: []string{}, - IgnoredFolders: []string{"vendor", ".git", "node_modules", ".idea"}, - pkgs: map[string]pkg{}, - moot: &sync.Mutex{}, - } -} diff --git a/builder/builder_test.go b/builder/builder_test.go deleted file mode 100644 index b67f6e1..0000000 --- a/builder/builder_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package builder - -import ( - "bytes" - "context" - "io/ioutil" - "os" - "path/filepath" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_Builder_Run(t *testing.T) { - r := require.New(t) - - root := filepath.Join("..", "example") - Clean(root) - defer Clean(root) - - exPackr := filepath.Join(root, "a_example-packr.go") - - fooPackr := filepath.Join(root, "foo", "a_foo-packr.go") - - b := New(context.Background(), root) - err := b.Run() - r.NoError(err) - - r.True(fileExists(exPackr)) - r.True(fileExists(fooPackr)) - - bb, err := ioutil.ReadFile(exPackr) - r.NoError(err) - r.True(bytes.Contains(bb, []byte(`packr.PackJSONBytes("./assets", "app.css", "\"Ym9ke`))) - r.True(bytes.Contains(bb, []byte(`packr.PackJSONBytes("./assets", "app.js", "\"YWxlcn`))) - r.True(bytes.Contains(bb, []byte(`packr.PackJSONBytes("./templates", "index.html", "\"PCFET0NUWVBF`))) - - bb, err = ioutil.ReadFile(fooPackr) - r.NoError(err) - r.True(bytes.Contains(bb, []byte(`packr.PackJSONBytes("../assets", "app.css", "\"Ym9keS`))) - r.True(bytes.Contains(bb, []byte(`packr.PackJSONBytes("../assets", "app.js", "\"YWxlcn`))) - r.True(bytes.Contains(bb, []byte(`packr.PackJSONBytes("../templates", "index.html", "\"PCFET0NUW`))) -} - -func Test_Builder_Run_Compress(t *testing.T) { - r := require.New(t) - - root := filepath.Join("..", "example") - defer Clean(root) - - exPackr := filepath.Join(root, "a_example-packr.go") - - fooPackr := filepath.Join(root, "foo", "a_foo-packr.go") - - b := New(context.Background(), root) - b.Compress = true - err := b.Run() - r.NoError(err) - - r.True(fileExists(exPackr)) - r.True(fileExists(fooPackr)) - - bb, err := ioutil.ReadFile(exPackr) - r.NoError(err) - r.True(bytes.Contains(bb, []byte(`packr.PackJSONBytes("./assets", "app.css", "\"H4sIAAAAAAAA/0rKT`))) - r.True(bytes.Contains(bb, []byte(`packr.PackJSONBytes("./assets", "app.js", "\"H4sIAAAAAAAA/0rMSS`))) - - bb, err = ioutil.ReadFile(fooPackr) - r.NoError(err) - r.True(bytes.Contains(bb, []byte(`packr.PackJSONBytes("../assets", "app.css", "\"H4sIAAAAAAAA/0rKT`))) - r.True(bytes.Contains(bb, []byte(`packr.PackJSONBytes("../assets", "app.js", "\"H4sIAAAAAAAA/0rMSS`))) - r.True(bytes.Contains(bb, []byte(`packr.PackJSONBytes("../templates", "index.html", "\"H4sIAAAAAAAA`))) -} - -func fileExists(path string) bool { - _, err := os.Stat(path) - return err == nil -} diff --git a/builder/clean.go b/builder/clean.go deleted file mode 100644 index 3287e59..0000000 --- a/builder/clean.go +++ /dev/null @@ -1,37 +0,0 @@ -package builder - -import ( - "os" - "path/filepath" - - "github.com/gobuffalo/packr/v2/jam/parser" - "github.com/gobuffalo/packr/v2/jam/store" -) - -// Clean up an *-packr.go files -func Clean(root string) error { - defer func() { - packd := filepath.Join(root, "packrd") - os.RemoveAll(packd) - }() - - p, err := parser.NewFromRoots([]string{root}, &parser.RootsOptions{ - IgnoreImports: true, - }) - if err != nil { - return err - } - - boxes, err := p.Run() - if err != nil { - return err - } - - d := store.NewDisk("", "") - for _, box := range boxes { - if err := d.Clean(box); err != nil { - return err - } - } - return nil -} diff --git a/builder/file.go b/builder/file.go deleted file mode 100644 index d439d49..0000000 --- a/builder/file.go +++ /dev/null @@ -1,10 +0,0 @@ -package builder - -type file struct { - Name string - Contents string -} - -func (f file) String() string { - return f.Name -} diff --git a/builder/pkg.go b/builder/pkg.go deleted file mode 100644 index fbad2ac..0000000 --- a/builder/pkg.go +++ /dev/null @@ -1,7 +0,0 @@ -package builder - -type pkg struct { - Name string - Dir string - Boxes []box -} diff --git a/builder/tmpl.go b/builder/tmpl.go deleted file mode 100644 index 812420a..0000000 --- a/builder/tmpl.go +++ /dev/null @@ -1,18 +0,0 @@ -package builder - -var tmpl = `// Code generated by github.com/gobuffalo/packr. DO NOT EDIT. - -package {{.Name}} - -import "github.com/gobuffalo/packr" - -// You can use the "packr clean" command to clean up this, -// and any other packr generated files. -func init() { - {{- range $box := .Boxes }} - {{- range .Files }} - _ = packr.PackJSONBytes("{{$box.Name}}", "{{.Name}}", "{{.Contents}}") - {{- end }} - {{- end }} -} -` diff --git a/builder/visitor.go b/builder/visitor.go deleted file mode 100644 index 44823e7..0000000 --- a/builder/visitor.go +++ /dev/null @@ -1,247 +0,0 @@ -package builder - -import ( - "errors" - "go/ast" - "go/parser" - "go/token" - "io/ioutil" - "sort" - "strings" -) - -type visitor struct { - Path string - Package string - Boxes []string - Errors []error -} - -func newVisitor(path string) *visitor { - return &visitor{ - Path: path, - Boxes: []string{}, - Errors: []error{}, - } -} - -func (v *visitor) Run() error { - b, err := ioutil.ReadFile(v.Path) - if err != nil { - return err - } - - fset := token.NewFileSet() - file, err := parser.ParseFile(fset, v.Path, string(b), parser.ParseComments) - if err != nil { - return err - } - - v.Package = file.Name.Name - ast.Walk(v, file) - - m := map[string]string{} - for _, s := range v.Boxes { - m[s] = s - } - v.Boxes = []string{} - for k := range m { - v.Boxes = append(v.Boxes, k) - } - - sort.Strings(v.Boxes) - - if len(v.Errors) > 0 { - s := make([]string, len(v.Errors)) - for i, e := range v.Errors { - s[i] = e.Error() - } - return errors.New(strings.Join(s, "\n")) - } - return nil -} - -func (v *visitor) Visit(node ast.Node) ast.Visitor { - if node == nil { - return v - } - if err := v.eval(node); err != nil { - v.Errors = append(v.Errors, err) - } - return v -} - -func (v *visitor) eval(node ast.Node) error { - switch t := node.(type) { - case *ast.CallExpr: - return v.evalExpr(t) - case *ast.Ident: - return v.evalIdent(t) - case *ast.GenDecl: - for _, n := range t.Specs { - if err := v.eval(n); err != nil { - return err - } - } - case *ast.FuncDecl: - if t.Body == nil { - return nil - } - for _, b := range t.Body.List { - if err := v.evalStmt(b); err != nil { - return err - } - } - return nil - case *ast.ValueSpec: - for _, e := range t.Values { - if err := v.evalExpr(e); err != nil { - return err - } - } - } - return nil -} - -func (v *visitor) evalStmt(stmt ast.Stmt) error { - switch t := stmt.(type) { - case *ast.ExprStmt: - return v.evalExpr(t.X) - case *ast.AssignStmt: - for _, e := range t.Rhs { - if err := v.evalArgs(e); err != nil { - return err - } - } - } - return nil -} - -func (v *visitor) evalExpr(expr ast.Expr) error { - switch t := expr.(type) { - case *ast.CallExpr: - if t.Fun == nil { - return nil - } - for _, a := range t.Args { - switch at := a.(type) { - case *ast.CallExpr: - if sel, ok := t.Fun.(*ast.SelectorExpr); ok { - return v.evalSelector(at, sel) - } - - if err := v.evalArgs(at); err != nil { - return err - } - case *ast.CompositeLit: - for _, e := range at.Elts { - if err := v.evalExpr(e); err != nil { - return err - } - } - } - } - if ft, ok := t.Fun.(*ast.SelectorExpr); ok { - return v.evalSelector(t, ft) - } - case *ast.KeyValueExpr: - return v.evalExpr(t.Value) - } - return nil -} - -func (v *visitor) evalArgs(expr ast.Expr) error { - switch at := expr.(type) { - case *ast.CompositeLit: - for _, e := range at.Elts { - if err := v.evalExpr(e); err != nil { - return err - } - } - // case *ast.BasicLit: - // fmt.Println("evalArgs", at.Value) - // v.addBox(at.Value) - case *ast.CallExpr: - if at.Fun == nil { - return nil - } - switch st := at.Fun.(type) { - case *ast.SelectorExpr: - if err := v.evalSelector(at, st); err != nil { - return err - } - case *ast.Ident: - return v.evalIdent(st) - } - for _, a := range at.Args { - if err := v.evalArgs(a); err != nil { - return err - } - } - } - return nil -} - -func (v *visitor) evalSelector(expr *ast.CallExpr, sel *ast.SelectorExpr) error { - x, ok := sel.X.(*ast.Ident) - if !ok { - return nil - } - if x.Name == "packr" && sel.Sel.Name == "NewBox" { - for _, e := range expr.Args { - switch at := e.(type) { - case *ast.Ident: - switch at.Obj.Kind { - case ast.Var: - if as, ok := at.Obj.Decl.(*ast.AssignStmt); ok { - v.addVariable(as) - } - case ast.Con: - if vs, ok := at.Obj.Decl.(*ast.ValueSpec); ok { - v.addConstant(vs) - } - } - return v.evalIdent(at) - case *ast.BasicLit: - v.addBox(at.Value) - case *ast.CallExpr: - return v.evalExpr(at) - } - } - } - - return nil -} - -func (v *visitor) evalIdent(i *ast.Ident) error { - if i.Obj == nil { - return nil - } - if s, ok := i.Obj.Decl.(*ast.AssignStmt); ok { - return v.evalStmt(s) - } - return nil -} - -func (v *visitor) addBox(b string) { - b = strings.Replace(b, "\"", "", -1) - v.Boxes = append(v.Boxes, b) -} - -func (v *visitor) addVariable(as *ast.AssignStmt) error { - if len(as.Rhs) == 1 { - if bs, ok := as.Rhs[0].(*ast.BasicLit); ok { - v.addBox(bs.Value) - } - } - return nil -} - -func (v *visitor) addConstant(vs *ast.ValueSpec) error { - if len(vs.Values) == 1 { - if bs, ok := vs.Values[0].(*ast.BasicLit); ok { - v.addBox(bs.Value) - } - } - return nil -} diff --git a/builder/visitor_test.go b/builder/visitor_test.go deleted file mode 100644 index 1be3d78..0000000 --- a/builder/visitor_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package builder - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_Visitor(t *testing.T) { - r := require.New(t) - v := newVisitor("../example/example.go") - r.NoError(v.Run()) - - r.Equal("example", v.Package) - r.Len(v.Errors, 0) - r.Len(v.Boxes, 7) - r.Equal([]string{"./assets", "./bar", "./constant", "./foo", "./sf", "./templates", "./variable"}, v.Boxes) -} diff --git a/v2/deprecated.go b/deprecated.go similarity index 100% rename from v2/deprecated.go rename to deprecated.go diff --git a/v2/deprecated_test.go b/deprecated_test.go similarity index 100% rename from v2/deprecated_test.go rename to deprecated_test.go diff --git a/v2/dirs_map.go b/dirs_map.go similarity index 100% rename from v2/dirs_map.go rename to dirs_map.go diff --git a/env.go b/env.go deleted file mode 100644 index 8ec70b5..0000000 --- a/env.go +++ /dev/null @@ -1,13 +0,0 @@ -package packr - -import ( - "github.com/gobuffalo/envy" -) - -// GoPath returns the current GOPATH env var -// or if it's missing, the default. -var GoPath = envy.GoPath - -// GoBin returns the current GO_BIN env var -// or if it's missing, a default of "go" -var GoBin = envy.GoBin diff --git a/example/assets/app.css b/example/assets/app.css deleted file mode 100644 index 67ce83e..0000000 --- a/example/assets/app.css +++ /dev/null @@ -1,3 +0,0 @@ -body { - background: red; -} diff --git a/example/assets/app.js b/example/assets/app.js deleted file mode 100644 index 619a8c5..0000000 --- a/example/assets/app.js +++ /dev/null @@ -1 +0,0 @@ -alert("hello!"); diff --git a/example/bar/bar.html b/example/bar/bar.html deleted file mode 100644 index e69de29..0000000 diff --git a/example/bar/sub/sub.html b/example/bar/sub/sub.html deleted file mode 100644 index e69de29..0000000 diff --git a/example/baz/baz.html b/example/baz/baz.html deleted file mode 100644 index e69de29..0000000 diff --git a/example/constant/constant.html b/example/constant/constant.html deleted file mode 100644 index e69de29..0000000 diff --git a/example/example.go b/example/example.go deleted file mode 100644 index 96a7981..0000000 --- a/example/example.go +++ /dev/null @@ -1,42 +0,0 @@ -package example - -import ( - "github.com/gobuffalo/packr" -) - -var a = packr.NewBox("./foo") - -const constString = "./constant" - -type S struct{} - -func (S) f(packr.Box) {} - -func init() { - - b := "./variable" - packr.NewBox(b) - - packr.NewBox(constString) - - // Cannot work from a function - packr.NewBox(strFromFunc()) - - // This variable should not be added - fromFunc := strFromFunc() - packr.NewBox(fromFunc) - - foo("/templates", packr.NewBox("./templates")) - packr.NewBox("./assets") - - packr.NewBox("./bar") - - s := S{} - s.f(packr.NewBox("./sf")) -} - -func strFromFunc() string { - return "./fromFunc" -} - -func foo(s string, box packr.Box) {} diff --git a/example/foo/bar.go b/example/foo/bar.go deleted file mode 100644 index ee9ded2..0000000 --- a/example/foo/bar.go +++ /dev/null @@ -1,7 +0,0 @@ -package foo - -import "github.com/gobuffalo/packr" - -func init() { - packr.NewBox("../assets") -} diff --git a/example/foo/foo.go b/example/foo/foo.go deleted file mode 100644 index 9d28bbc..0000000 --- a/example/foo/foo.go +++ /dev/null @@ -1,7 +0,0 @@ -package foo - -import "github.com/gobuffalo/packr" - -func init() { - packr.NewBox("../templates") -} diff --git a/example/sf/foo.html b/example/sf/foo.html deleted file mode 100644 index 63a950c..0000000 --- a/example/sf/foo.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - Foo - - - body - - diff --git a/example/templates/index.html b/example/templates/index.html deleted file mode 100644 index a48e363..0000000 --- a/example/templates/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - INDEX - link - - - body - - diff --git a/example/variable/variable.html b/example/variable/variable.html deleted file mode 100644 index e69de29..0000000 diff --git a/file.go b/file.go deleted file mode 100644 index 8d24b73..0000000 --- a/file.go +++ /dev/null @@ -1,5 +0,0 @@ -package packr - -import "github.com/gobuffalo/packd" - -type File = packd.File diff --git a/v2/file/file.go b/file/file.go similarity index 100% rename from v2/file/file.go rename to file/file.go diff --git a/v2/file/info.go b/file/info.go similarity index 100% rename from v2/file/info.go rename to file/info.go diff --git a/v2/file/resolver/_fixtures/templates/foo.txt b/file/resolver/_fixtures/templates/foo.txt similarity index 100% rename from v2/file/resolver/_fixtures/templates/foo.txt rename to file/resolver/_fixtures/templates/foo.txt diff --git a/v2/file/resolver/disk.go b/file/resolver/disk.go similarity index 100% rename from v2/file/resolver/disk.go rename to file/resolver/disk.go diff --git a/v2/file/resolver/disk_test.go b/file/resolver/disk_test.go similarity index 100% rename from v2/file/resolver/disk_test.go rename to file/resolver/disk_test.go diff --git a/v2/file/resolver/encoding/hex/hex.go b/file/resolver/encoding/hex/hex.go similarity index 100% rename from v2/file/resolver/encoding/hex/hex.go rename to file/resolver/encoding/hex/hex.go diff --git a/v2/file/resolver/hex_gzip.go b/file/resolver/hex_gzip.go similarity index 100% rename from v2/file/resolver/hex_gzip.go rename to file/resolver/hex_gzip.go diff --git a/v2/file/resolver/hex_gzip_test.go b/file/resolver/hex_gzip_test.go similarity index 100% rename from v2/file/resolver/hex_gzip_test.go rename to file/resolver/hex_gzip_test.go diff --git a/v2/file/resolver/ident.go b/file/resolver/ident.go similarity index 100% rename from v2/file/resolver/ident.go rename to file/resolver/ident.go diff --git a/v2/file/resolver/ident_test.go b/file/resolver/ident_test.go similarity index 100% rename from v2/file/resolver/ident_test.go rename to file/resolver/ident_test.go diff --git a/v2/file/resolver/in_memory.go b/file/resolver/in_memory.go similarity index 100% rename from v2/file/resolver/in_memory.go rename to file/resolver/in_memory.go diff --git a/v2/file/resolver/in_memory_test.go b/file/resolver/in_memory_test.go similarity index 100% rename from v2/file/resolver/in_memory_test.go rename to file/resolver/in_memory_test.go diff --git a/v2/file/resolver/packable.go b/file/resolver/packable.go similarity index 100% rename from v2/file/resolver/packable.go rename to file/resolver/packable.go diff --git a/v2/file/resolver/resolver.go b/file/resolver/resolver.go similarity index 100% rename from v2/file/resolver/resolver.go rename to file/resolver/resolver.go diff --git a/v2/file/resolver/resolver_test.go b/file/resolver/resolver_test.go similarity index 100% rename from v2/file/resolver/resolver_test.go rename to file/resolver/resolver_test.go diff --git a/fixtures/MyFile.txt b/fixtures/MyFile.txt deleted file mode 100644 index 61aae3e..0000000 --- a/fixtures/MyFile.txt +++ /dev/null @@ -1 +0,0 @@ -this is my file diff --git a/fixtures/goodbye.txt b/fixtures/goodbye.txt deleted file mode 100644 index e4d35e1..0000000 --- a/fixtures/goodbye.txt +++ /dev/null @@ -1 +0,0 @@ -goodbye cruel world! diff --git a/fixtures/hello.txt b/fixtures/hello.txt deleted file mode 100644 index a042389..0000000 --- a/fixtures/hello.txt +++ /dev/null @@ -1 +0,0 @@ -hello world! diff --git a/fixtures/index.html b/fixtures/index.html deleted file mode 100644 index 2058d77..0000000 --- a/fixtures/index.html +++ /dev/null @@ -1 +0,0 @@ -

Index!

diff --git a/go.mod b/go.mod index fcb35b3..3a96e44 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,18 @@ -module github.com/gobuffalo/packr +module github.com/gobuffalo/packr/v2 -go 1.12 +go 1.16 require ( - github.com/gobuffalo/envy v1.7.0 - github.com/gobuffalo/packd v0.3.0 - github.com/gobuffalo/packr/v2 v2.5.2 - github.com/spf13/cobra v0.0.5 - github.com/stretchr/testify v1.3.0 - golang.org/x/sync v0.0.0-20190423024810-112230192c58 + github.com/gobuffalo/logger v1.0.6 + github.com/gobuffalo/packd v1.0.1 + github.com/karrick/godirwalk v1.16.1 + github.com/markbates/errx v1.1.0 + github.com/markbates/oncer v1.0.0 + github.com/markbates/safe v1.0.1 + github.com/rogpeppe/go-internal v1.8.0 + github.com/sirupsen/logrus v1.8.1 + github.com/spf13/cobra v1.2.1 + github.com/stretchr/testify v1.7.0 + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c + golang.org/x/tools v0.1.7 ) diff --git a/go.sum b/go.sum index 675c18d..a1536a2 100644 --- a/go.sum +++ b/go.sum @@ -1,79 +1,603 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU= -github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/logger v1.0.0 h1:xw9Ko9EcC5iAFprrjJ6oZco9UpzS5MQ4jAwghsLHdy4= -github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= -github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4= -github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= -github.com/gobuffalo/packr/v2 v2.5.2 h1:4EvjeIpQLZuRIljwnidYgbRXbr1yIzVRrESiLjqKj6s= -github.com/gobuffalo/packr/v2 v2.5.2/go.mod h1:sgEE1xNZ6G0FNN5xn9pevVu4nywaxHvgup67xisti08= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/gobuffalo/logger v1.0.6 h1:nnZNpxYo0zx+Aj9RfMPBm+x9zAU2OayFh/xrAWi34HU= +github.com/gobuffalo/logger v1.0.6/go.mod h1:J31TBEHR1QLV2683OXTAItYIg8pv2JMHnF/quuAbMjs= +github.com/gobuffalo/packd v1.0.1 h1:U2wXfRr4E9DH8IdsDLlRFwTZTK7hLfq9qT/QHXGVe/0= +github.com/gobuffalo/packd v1.0.1/go.mod h1:PP2POP3p3RXGz7Jh6eYEf93S7vA2za6xM7QT85L4+VY= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= -github.com/karrick/godirwalk v1.10.12 h1:BqUm+LuJcXjGv1d2mj3gBiQyrQ57a0rYoAmhvJQ7RDU= -github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw= +github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/markbates/errx v1.1.0 h1:QDFeR+UP95dO12JgW+tgi2UVfo0V8YBHiUIOaeBPiEI= +github.com/markbates/errx v1.1.0/go.mod h1:PLa46Oex9KNbVDZhKel8v1OT7hD5JZ2eI7AHhA0wswc= +github.com/markbates/oncer v1.0.0 h1:E83IaVAHygyndzPimgUYJjbshhDTALZyXxvk9FOlQRY= +github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI= +github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI= +github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= 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/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw= +github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 h1:ydJNl0ENAG67pFbB+9tfhiL2pYqLhfoaZFw/cjLhY4A= -golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190515120540-06a5c4944438 h1:khxRGsvPk4n2y8I/mLLjp7e5dMTJmH75wvqS6nMwUtY= -golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0 h1:Dh6fw+p6FyRl5x/FvNswO1ji0lIGzm3KP8Y9VkS9PTE= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/v2/helpers.go b/helpers.go similarity index 100% rename from v2/helpers.go rename to helpers.go diff --git a/http_box_test.go b/http_box_test.go index e3bb7f4..3685133 100644 --- a/http_box_test.go +++ b/http_box_test.go @@ -6,14 +6,41 @@ import ( "strings" "testing" + "github.com/gobuffalo/packd" + "github.com/gobuffalo/packr/v2/file/resolver" "github.com/stretchr/testify/require" ) +var httpBox = func() packd.Box { + box := New("http box", "") + + ind, err := resolver.HexGzipString("

Index!

") + if err != nil { + panic(err) + } + + hello, err := resolver.HexGzipString("hello world!") + if err != nil { + panic(err) + } + + hg, err := resolver.NewHexGzip(map[string]string{ + "index.html": ind, + "hello.txt": hello, + }) + if err != nil { + panic(err) + } + + box.DefaultResolver = hg + return box +}() + func Test_HTTPBox(t *testing.T) { r := require.New(t) mux := http.NewServeMux() - mux.Handle("/", http.FileServer(testBox)) + mux.Handle("/", http.FileServer(httpBox)) req, err := http.NewRequest("GET", "/hello.txt", nil) r.NoError(err) @@ -26,34 +53,11 @@ func Test_HTTPBox(t *testing.T) { r.Equal("hello world!", strings.TrimSpace(res.Body.String())) } -// func Test_HTTPBox_CaseInsensitive(t *testing.T) { -// -// mux := http.NewServeMux() -// testBox.AddString("myfile.txt", "this is my file") -// mux.Handle("/", http.FileServer(testBox)) -// -// for _, path := range []string{"/MyFile.txt", "/myfile.txt", "/Myfile.txt"} { -// t.Run(path, func(st *testing.T) { -// r := require.New(st) -// -// req, err := http.NewRequest("GET", path, nil) -// r.NoError(err) -// -// res := httptest.NewRecorder() -// -// mux.ServeHTTP(res, req) -// -// r.Equal(200, res.Code) -// r.Equal("this is my file", strings.TrimSpace(res.Body.String())) -// }) -// } -// } - func Test_HTTPBox_NotFound(t *testing.T) { r := require.New(t) mux := http.NewServeMux() - mux.Handle("/", http.FileServer(testBox)) + mux.Handle("/", http.FileServer(httpBox)) req, err := http.NewRequest("GET", "/notInBox.txt", nil) r.NoError(err) @@ -65,11 +69,32 @@ func Test_HTTPBox_NotFound(t *testing.T) { r.Equal(404, res.Code) } +func Test_HTTPBox_Handles_IndexHTML_Nested(t *testing.T) { + r := require.New(t) + + box := New("Test_HTTPBox_Handles_IndexHTML_Nested", "!") + box.AddString("foo/index.html", "foo") + + mux := http.NewServeMux() + mux.Handle("/", http.FileServer(box)) + + req, err := http.NewRequest("GET", "/foo", nil) + r.NoError(err) + + res := httptest.NewRecorder() + + mux.ServeHTTP(res, req) + + r.Equal(200, res.Code) + + r.Equal("foo", strings.TrimSpace(res.Body.String())) +} + func Test_HTTPBox_Handles_IndexHTML(t *testing.T) { r := require.New(t) mux := http.NewServeMux() - mux.Handle("/", http.FileServer(testBox)) + mux.Handle("/", http.FileServer(httpBox)) req, err := http.NewRequest("GET", "/", nil) r.NoError(err) @@ -78,5 +103,67 @@ func Test_HTTPBox_Handles_IndexHTML(t *testing.T) { mux.ServeHTTP(res, req) + r.Equal(200, res.Code) + r.Equal("

Index!

", strings.TrimSpace(res.Body.String())) } + +func Test_HTTPBox_CaseInsensitive(t *testing.T) { + mux := http.NewServeMux() + httpBox.AddString("myfile.txt", "this is my file") + mux.Handle("/", http.FileServer(httpBox)) + + for _, path := range []string{"/MyFile.txt", "/myfile.txt", "/Myfile.txt"} { + t.Run(path, func(st *testing.T) { + r := require.New(st) + + req, err := http.NewRequest("GET", path, nil) + r.NoError(err) + + res := httptest.NewRecorder() + + mux.ServeHTTP(res, req) + + r.Equal(200, res.Code) + r.Equal("this is my file", strings.TrimSpace(res.Body.String())) + }) + } +} + +func Test_HTTPBox_Disk(t *testing.T) { + r := require.New(t) + + box := New("http disk box", "./_fixtures/http_test") + mux := http.NewServeMux() + mux.Handle("/", http.FileServer(box)) + + type testcase struct { + URL, Content, Location string + Code int + } + + testcases := []testcase{ + {"/", "Index", "", 200}, + {"/sub", "Sub", "", 200}, + {"/index.html", "", "./", 301}, + {"/sub/index.html", "", "./", 301}, + {"/sub/", "", "../sub", 301}, + {"/footer.html", "Footer", "", 200}, + {"/css/main.css", "Css", "", 200}, + {"/css", "404 page not found", "", 404}, + {"/css/", "404 page not found", "", 404}, + } + + for _, tc := range testcases { + t.Run("path"+tc.URL, func(t *testing.T) { + req, err := http.NewRequest("GET", tc.URL, nil) + r.NoError(err) + res := httptest.NewRecorder() + mux.ServeHTTP(res, req) + + r.Equal(tc.Code, res.Code) + r.Equal(tc.Location, res.Header().Get("location")) + r.Equal(tc.Content, strings.TrimSpace(res.Body.String())) + }) + } +} diff --git a/v2/jam/pack.go b/jam/pack.go similarity index 100% rename from v2/jam/pack.go rename to jam/pack.go diff --git a/v2/jam/parser/_fixtures/new_from_roots/_r/r.go b/jam/parser/_fixtures/new_from_roots/_r/r.go similarity index 100% rename from v2/jam/parser/_fixtures/new_from_roots/_r/r.go rename to jam/parser/_fixtures/new_from_roots/_r/r.go diff --git a/v2/jam/parser/_fixtures/new_from_roots/e/e.go b/jam/parser/_fixtures/new_from_roots/e/e.go similarity index 100% rename from v2/jam/parser/_fixtures/new_from_roots/e/e.go rename to jam/parser/_fixtures/new_from_roots/e/e.go diff --git a/v2/jam/parser/_fixtures/new_from_roots/q.go b/jam/parser/_fixtures/new_from_roots/q.go similarity index 100% rename from v2/jam/parser/_fixtures/new_from_roots/q.go rename to jam/parser/_fixtures/new_from_roots/q.go diff --git a/v2/jam/parser/_fixtures/new_from_roots/w/w.go b/jam/parser/_fixtures/new_from_roots/w/w.go similarity index 100% rename from v2/jam/parser/_fixtures/new_from_roots/w/w.go rename to jam/parser/_fixtures/new_from_roots/w/w.go diff --git a/v2/jam/parser/args.go b/jam/parser/args.go similarity index 100% rename from v2/jam/parser/args.go rename to jam/parser/args.go diff --git a/v2/jam/parser/box.go b/jam/parser/box.go similarity index 100% rename from v2/jam/parser/box.go rename to jam/parser/box.go diff --git a/v2/jam/parser/file.go b/jam/parser/file.go similarity index 100% rename from v2/jam/parser/file.go rename to jam/parser/file.go diff --git a/v2/jam/parser/finder.go b/jam/parser/finder.go similarity index 100% rename from v2/jam/parser/finder.go rename to jam/parser/finder.go diff --git a/v2/jam/parser/gogen.go b/jam/parser/gogen.go similarity index 100% rename from v2/jam/parser/gogen.go rename to jam/parser/gogen.go diff --git a/v2/jam/parser/parser.go b/jam/parser/parser.go similarity index 100% rename from v2/jam/parser/parser.go rename to jam/parser/parser.go diff --git a/v2/jam/parser/parser_test.go b/jam/parser/parser_test.go similarity index 100% rename from v2/jam/parser/parser_test.go rename to jam/parser/parser_test.go diff --git a/v2/jam/parser/prospect.go b/jam/parser/prospect.go similarity index 100% rename from v2/jam/parser/prospect.go rename to jam/parser/prospect.go diff --git a/v2/jam/parser/prospect_test.go b/jam/parser/prospect_test.go similarity index 100% rename from v2/jam/parser/prospect_test.go rename to jam/parser/prospect_test.go diff --git a/v2/jam/parser/roots.go b/jam/parser/roots.go similarity index 100% rename from v2/jam/parser/roots.go rename to jam/parser/roots.go diff --git a/v2/jam/parser/visitor.go b/jam/parser/visitor.go similarity index 100% rename from v2/jam/parser/visitor.go rename to jam/parser/visitor.go diff --git a/v2/jam/parser/visitor_test.go b/jam/parser/visitor_test.go similarity index 100% rename from v2/jam/parser/visitor_test.go rename to jam/parser/visitor_test.go diff --git a/v2/jam/store/_fixtures/disk-pack/a/a.go b/jam/store/_fixtures/disk-pack/a/a.go similarity index 100% rename from v2/jam/store/_fixtures/disk-pack/a/a.go rename to jam/store/_fixtures/disk-pack/a/a.go diff --git a/v2/jam/store/_fixtures/disk-pack/b/b.go b/jam/store/_fixtures/disk-pack/b/b.go similarity index 100% rename from v2/jam/store/_fixtures/disk-pack/b/b.go rename to jam/store/_fixtures/disk-pack/b/b.go diff --git a/v2/jam/store/_fixtures/disk-pack/c/d.txt b/jam/store/_fixtures/disk-pack/c/d.txt similarity index 100% rename from v2/jam/store/_fixtures/disk-pack/c/d.txt rename to jam/store/_fixtures/disk-pack/c/d.txt diff --git a/v2/jam/store/_fixtures/disk-pack/c/e.txt b/jam/store/_fixtures/disk-pack/c/e.txt similarity index 100% rename from v2/jam/store/_fixtures/disk-pack/c/e.txt rename to jam/store/_fixtures/disk-pack/c/e.txt diff --git a/v2/jam/store/_fixtures/disk-pack/c/f.txt b/jam/store/_fixtures/disk-pack/c/f.txt similarity index 100% rename from v2/jam/store/_fixtures/disk-pack/c/f.txt rename to jam/store/_fixtures/disk-pack/c/f.txt diff --git a/v2/jam/store/_fixtures/disk-pack/go.mod b/jam/store/_fixtures/disk-pack/go.mod similarity index 100% rename from v2/jam/store/_fixtures/disk-pack/go.mod rename to jam/store/_fixtures/disk-pack/go.mod diff --git a/v2/jam/store/_fixtures/disk-pack/go.sum b/jam/store/_fixtures/disk-pack/go.sum similarity index 100% rename from v2/jam/store/_fixtures/disk-pack/go.sum rename to jam/store/_fixtures/disk-pack/go.sum diff --git a/v2/jam/store/_fixtures/disk/_r/r.go b/jam/store/_fixtures/disk/_r/r.go similarity index 100% rename from v2/jam/store/_fixtures/disk/_r/r.go rename to jam/store/_fixtures/disk/_r/r.go diff --git a/v2/jam/store/_fixtures/disk/e/e.go b/jam/store/_fixtures/disk/e/e.go similarity index 100% rename from v2/jam/store/_fixtures/disk/e/e.go rename to jam/store/_fixtures/disk/e/e.go diff --git a/v2/jam/store/_fixtures/disk/e/heartbreakers/refugee.txt b/jam/store/_fixtures/disk/e/heartbreakers/refugee.txt similarity index 100% rename from v2/jam/store/_fixtures/disk/e/heartbreakers/refugee.txt rename to jam/store/_fixtures/disk/e/heartbreakers/refugee.txt diff --git a/v2/jam/store/_fixtures/disk/e/petty/fallin.txt b/jam/store/_fixtures/disk/e/petty/fallin.txt similarity index 100% rename from v2/jam/store/_fixtures/disk/e/petty/fallin.txt rename to jam/store/_fixtures/disk/e/petty/fallin.txt diff --git a/v2/jam/store/_fixtures/disk/franklin/aretha.txt b/jam/store/_fixtures/disk/franklin/aretha.txt similarity index 100% rename from v2/jam/store/_fixtures/disk/franklin/aretha.txt rename to jam/store/_fixtures/disk/franklin/aretha.txt diff --git a/v2/jam/store/_fixtures/disk/franklin/think.txt b/jam/store/_fixtures/disk/franklin/think.txt similarity index 100% rename from v2/jam/store/_fixtures/disk/franklin/think.txt rename to jam/store/_fixtures/disk/franklin/think.txt diff --git a/v2/jam/store/_fixtures/disk/q.go b/jam/store/_fixtures/disk/q.go similarity index 100% rename from v2/jam/store/_fixtures/disk/q.go rename to jam/store/_fixtures/disk/q.go diff --git a/v2/jam/store/_fixtures/disk/w/w.go b/jam/store/_fixtures/disk/w/w.go similarity index 100% rename from v2/jam/store/_fixtures/disk/w/w.go rename to jam/store/_fixtures/disk/w/w.go diff --git a/v2/jam/store/clean.go b/jam/store/clean.go similarity index 100% rename from v2/jam/store/clean.go rename to jam/store/clean.go diff --git a/v2/jam/store/disk.go b/jam/store/disk.go similarity index 79% rename from v2/jam/store/disk.go rename to jam/store/disk.go index 9a46876..a4ffa8d 100644 --- a/v2/jam/store/disk.go +++ b/jam/store/disk.go @@ -5,7 +5,6 @@ import ( "compress/gzip" "crypto/md5" "fmt" - "go/build" "html/template" "io" "io/ioutil" @@ -17,7 +16,6 @@ import ( "strings" "sync" - "github.com/gobuffalo/packr/v2/internal" "github.com/karrick/godirwalk" "github.com/gobuffalo/packr/v2/file/resolver/encoding/hex" @@ -255,49 +253,34 @@ func (d *Disk) Close() error { } var ip string - if internal.Mods() { - // Starting in 1.12, we can rely on Go's method for - // resolving where go.mod resides. Prior versions will - // simply return an empty string. - cmd := exec.Command("go", "env", "GOMOD") - out, err := cmd.Output() - if err != nil { - return fmt.Errorf("go.mod cannot be read or does not exist while go module is enabled") - } - mp := strings.TrimSpace(string(out)) - if mp == "" { - // We are on a prior version of Go; try and do - // the resolution ourselves. - mp = filepath.Join(filepath.Dir(d.DBPath), "go.mod") - if _, err := os.Stat(mp); err != nil { - mp = filepath.Join(d.DBPath, "go.mod") - } - } - - moddata, err := ioutil.ReadFile(mp) - if err != nil { - return fmt.Errorf("go.mod cannot be read or does not exist while go module is enabled") - } - ip = modfile.ModulePath(moddata) - if ip == "" { - return fmt.Errorf("go.mod is malformed") - } - ip = filepath.Join(ip, strings.TrimPrefix(filepath.Dir(d.DBPath), filepath.Dir(mp))) - ip = strings.Replace(ip, "\\", "/", -1) - } else { - ip = filepath.Dir(d.DBPath) - srcs := internal.GoPaths() - srcs = append(srcs, build.Default.SrcDirs()...) - for _, x := range srcs { - ip = strings.TrimPrefix(ip, "/private") - ip = strings.TrimPrefix(ip, x) + // Starting in 1.12, we can rely on Go's method for + // resolving where go.mod resides. Prior versions will + // simply return an empty string. + cmd := exec.Command("go", "env", "GOMOD") + out, err := cmd.Output() + if err != nil { + return fmt.Errorf("go.mod cannot be read or does not exist while go module is enabled") + } + mp := strings.TrimSpace(string(out)) + if mp == "" { + // We are on a prior version of Go; try and do + // the resolution ourselves. + mp = filepath.Join(filepath.Dir(d.DBPath), "go.mod") + if _, err := os.Stat(mp); err != nil { + mp = filepath.Join(d.DBPath, "go.mod") } - ip = strings.TrimPrefix(ip, string(filepath.Separator)) - ip = strings.TrimPrefix(ip, "src") - ip = strings.TrimPrefix(ip, string(filepath.Separator)) + } - ip = strings.Replace(ip, "\\", "/", -1) + moddata, err := ioutil.ReadFile(mp) + if err != nil { + return fmt.Errorf("go.mod cannot be read or does not exist while go module is enabled") + } + ip = modfile.ModulePath(moddata) + if ip == "" { + return fmt.Errorf("go.mod is malformed") } + ip = filepath.Join(ip, strings.TrimPrefix(filepath.Dir(d.DBPath), filepath.Dir(mp))) + ip = strings.Replace(ip, "\\", "/", -1) ip = path.Join(ip, d.DBPackage) for _, n := range opts.Boxes { diff --git a/v2/jam/store/disk_packed_test.go b/jam/store/disk_packed_test.go similarity index 100% rename from v2/jam/store/disk_packed_test.go rename to jam/store/disk_packed_test.go diff --git a/v2/jam/store/disk_test.go b/jam/store/disk_test.go similarity index 100% rename from v2/jam/store/disk_test.go rename to jam/store/disk_test.go diff --git a/v2/jam/store/disk_tmpl.go b/jam/store/disk_tmpl.go similarity index 100% rename from v2/jam/store/disk_tmpl.go rename to jam/store/disk_tmpl.go diff --git a/v2/jam/store/env.go b/jam/store/env.go similarity index 100% rename from v2/jam/store/env.go rename to jam/store/env.go diff --git a/v2/jam/store/fn.go b/jam/store/fn.go similarity index 100% rename from v2/jam/store/fn.go rename to jam/store/fn.go diff --git a/v2/jam/store/legacy.go b/jam/store/legacy.go similarity index 100% rename from v2/jam/store/legacy.go rename to jam/store/legacy.go diff --git a/v2/jam/store/legacy_test.go b/jam/store/legacy_test.go similarity index 100% rename from v2/jam/store/legacy_test.go rename to jam/store/legacy_test.go diff --git a/v2/jam/store/store.go b/jam/store/store.go similarity index 100% rename from v2/jam/store/store.go rename to jam/store/store.go diff --git a/v2/jam/store/store_test.go b/jam/store/store_test.go similarity index 100% rename from v2/jam/store/store_test.go rename to jam/store/store_test.go diff --git a/packr.go b/packr.go index 6ccc6c1..f0f88f1 100644 --- a/packr.go +++ b/packr.go @@ -1,74 +1,56 @@ package packr import ( - "bytes" - "compress/gzip" - "encoding/json" - "runtime" - "strings" - "sync" -) + "fmt" -var gil = &sync.Mutex{} -var data = map[string]map[string][]byte{} + "github.com/gobuffalo/packr/v2/file/resolver" + "github.com/gobuffalo/packr/v2/jam/parser" + "github.com/gobuffalo/packr/v2/plog" + "github.com/markbates/safe" +) -// PackBytes packs bytes for a file into a box. -func PackBytes(box string, name string, bb []byte) { - gil.Lock() - defer gil.Unlock() - if _, ok := data[box]; !ok { - data[box] = map[string][]byte{} - } - data[box][name] = bb -} +var boxes = &boxMap{} -// PackBytesGzip packets the gzipped compressed bytes into a box. -func PackBytesGzip(box string, name string, bb []byte) error { - var buf bytes.Buffer - w := gzip.NewWriter(&buf) - _, err := w.Write(bb) +var _ = safe.Run(func() { + p, err := parser.NewFromRoots([]string{}, nil) if err != nil { - return err + plog.Logger.Error(err) + return } - err = w.Close() + boxes, err := p.Run() if err != nil { - return err + plog.Logger.Error(err) + return } - PackBytes(box, name, buf.Bytes()) - return nil -} - -// PackJSONBytes packs JSON encoded bytes for a file into a box. -func PackJSONBytes(box string, name string, jbb string) error { - var bb []byte - err := json.Unmarshal([]byte(jbb), &bb) - if err != nil { - return err + for _, box := range boxes { + b := construct(box.Name, box.AbsPath) + _, err = placeBox(b) + if err != nil { + plog.Logger.Error(err) + return + } } - PackBytes(box, name, bb) - return nil -} -// UnpackBytes unpacks bytes for specific box. -func UnpackBytes(box string) { - gil.Lock() - defer gil.Unlock() - delete(data, box) -} +}) -func osPaths(paths ...string) []string { - if runtime.GOOS == "windows" { - for i, path := range paths { - paths[i] = strings.Replace(path, "/", "\\", -1) - } +func findBox(name string) (*Box, error) { + key := resolver.Key(name) + plog.Debug("packr", "findBox", "name", name, "key", key) + + b, ok := boxes.Load(key) + if !ok { + plog.Debug("packr", "findBox", "name", name, "key", key, "found", ok) + return nil, fmt.Errorf("could not find box %s", name) } - return paths + plog.Debug(b, "found", "box", b) + return b, nil } -func osPath(path string) string { - if runtime.GOOS == "windows" { - return strings.Replace(path, "/", "\\", -1) - } - return path +func placeBox(b *Box) (*Box, error) { + key := resolver.Key(b.Name) + eb, _ := boxes.LoadOrStore(key, b) + + plog.Debug("packr", "placeBox", "name", eb.Name, "path", eb.Path, "resolution directory", eb.ResolutionDir) + return eb, nil } diff --git a/packr/cmd/build.go b/packr/cmd/build.go deleted file mode 100644 index 8433d50..0000000 --- a/packr/cmd/build.go +++ /dev/null @@ -1,39 +0,0 @@ -package cmd - -import ( - "context" - "os" - "os/exec" - - "github.com/gobuffalo/packr" - "github.com/gobuffalo/packr/builder" - "github.com/spf13/cobra" -) - -// buildCmd represents the build command -var buildCmd = &cobra.Command{ - Use: "build", - Short: "Wraps the go build command with packr", - DisableFlagParsing: true, - RunE: func(cmd *cobra.Command, args []string) error { - defer builder.Clean(input) - b := builder.New(context.Background(), input) - err := b.Run() - if err != nil { - return err - } - - cargs := []string{"build"} - cargs = append(cargs, args...) - cp := exec.Command(packr.GoBin(), cargs...) - cp.Stderr = os.Stderr - cp.Stdin = os.Stdin - cp.Stdout = os.Stdout - - return cp.Run() - }, -} - -func init() { - rootCmd.AddCommand(buildCmd) -} diff --git a/packr/cmd/clean.go b/packr/cmd/clean.go deleted file mode 100644 index 3be7992..0000000 --- a/packr/cmd/clean.go +++ /dev/null @@ -1,18 +0,0 @@ -package cmd - -import ( - "github.com/gobuffalo/packr/builder" - "github.com/spf13/cobra" -) - -var cleanCmd = &cobra.Command{ - Use: "clean", - Short: "removes any *-packr.go files", - Run: func(cmd *cobra.Command, args []string) { - builder.Clean(input) - }, -} - -func init() { - rootCmd.AddCommand(cleanCmd) -} diff --git a/packr/cmd/install.go b/packr/cmd/install.go deleted file mode 100644 index f446242..0000000 --- a/packr/cmd/install.go +++ /dev/null @@ -1,50 +0,0 @@ -package cmd - -import ( - "context" - "os" - "os/exec" - "path/filepath" - "strings" - - "github.com/gobuffalo/packr" - "github.com/gobuffalo/packr/builder" - "github.com/spf13/cobra" -) - -// installCmd represents the install command -var installCmd = &cobra.Command{ - Use: "install", - Short: "Wraps the go install command with packr", - DisableFlagParsing: true, - RunE: func(cmd *cobra.Command, args []string) error { - if len(args) > 0 { - input = args[len(args)-1] - if !strings.HasPrefix(input, ".") { - input = filepath.Join(packr.GoPath(), "src", input) - if _, err := os.Stat(input); err != nil { - return err - } - } - } - defer builder.Clean(input) - b := builder.New(context.Background(), input) - err := b.Run() - if err != nil { - return err - } - - cargs := []string{"install"} - cargs = append(cargs, args...) - cp := exec.Command(packr.GoBin(), cargs...) - cp.Stderr = os.Stderr - cp.Stdin = os.Stdin - cp.Stdout = os.Stdout - - return cp.Run() - }, -} - -func init() { - rootCmd.AddCommand(installCmd) -} diff --git a/packr/cmd/root.go b/packr/cmd/root.go deleted file mode 100644 index 94f1c55..0000000 --- a/packr/cmd/root.go +++ /dev/null @@ -1,55 +0,0 @@ -package cmd - -import ( - "context" - "fmt" - "os" - - "github.com/gobuffalo/packr/builder" - "github.com/spf13/cobra" -) - -var input string -var compress bool -var verbose bool - -var rootCmd = &cobra.Command{ - Use: "packr", - Short: "compiles static files into Go files", - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - if !verbose { - for _, a := range args { - if a == "-v" { - verbose = true - break - } - } - } - - if verbose { - builder.DebugLog = func(s string, a ...interface{}) { - os.Stdout.WriteString(fmt.Sprintf(s, a...)) - } - } - return nil - }, - RunE: func(cmd *cobra.Command, args []string) error { - b := builder.New(context.Background(), input) - b.Compress = compress - return b.Run() - }, -} - -func init() { - pwd, _ := os.Getwd() - rootCmd.Flags().StringVarP(&input, "input", "i", pwd, "path to scan for packr Boxes") - rootCmd.Flags().BoolVarP(&compress, "compress", "z", false, "compress box contents") - rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "print verbose logging information") -} - -// Execute the commands -func Execute() { - if err := rootCmd.Execute(); err != nil { - os.Exit(-1) - } -} diff --git a/packr/cmd/version.go b/packr/cmd/version.go deleted file mode 100644 index 470a1d5..0000000 --- a/packr/cmd/version.go +++ /dev/null @@ -1,20 +0,0 @@ -package cmd - -import ( - "fmt" - - "github.com/gobuffalo/packr" - "github.com/spf13/cobra" -) - -var versionCmd = &cobra.Command{ - Use: "version", - Short: "prints packr version", - Run: func(cmd *cobra.Command, args []string) { - fmt.Println(packr.Version) - }, -} - -func init() { - rootCmd.AddCommand(versionCmd) -} diff --git a/packr/main.go b/packr/main.go deleted file mode 100644 index c59a00b..0000000 --- a/packr/main.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright © 2017 NAME HERE -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import "github.com/gobuffalo/packr/packr/cmd" - -func main() { - cmd.Execute() -} diff --git a/v2/packr2/LICENSE b/packr2/LICENSE similarity index 100% rename from v2/packr2/LICENSE rename to packr2/LICENSE diff --git a/v2/packr2/cmd/build.go b/packr2/cmd/build.go similarity index 100% rename from v2/packr2/cmd/build.go rename to packr2/cmd/build.go diff --git a/v2/packr2/cmd/clean.go b/packr2/cmd/clean.go similarity index 100% rename from v2/packr2/cmd/clean.go rename to packr2/cmd/clean.go diff --git a/v2/packr2/cmd/fix.go b/packr2/cmd/fix.go similarity index 100% rename from v2/packr2/cmd/fix.go rename to packr2/cmd/fix.go diff --git a/v2/packr2/cmd/fix/fix.go b/packr2/cmd/fix/fix.go similarity index 100% rename from v2/packr2/cmd/fix/fix.go rename to packr2/cmd/fix/fix.go diff --git a/v2/packr2/cmd/fix/imports.go b/packr2/cmd/fix/imports.go similarity index 100% rename from v2/packr2/cmd/fix/imports.go rename to packr2/cmd/fix/imports.go diff --git a/v2/packr2/cmd/fix/runner.go b/packr2/cmd/fix/runner.go similarity index 100% rename from v2/packr2/cmd/fix/runner.go rename to packr2/cmd/fix/runner.go diff --git a/v2/packr2/cmd/gocmd.go b/packr2/cmd/gocmd.go similarity index 100% rename from v2/packr2/cmd/gocmd.go rename to packr2/cmd/gocmd.go diff --git a/v2/packr2/cmd/install.go b/packr2/cmd/install.go similarity index 100% rename from v2/packr2/cmd/install.go rename to packr2/cmd/install.go diff --git a/v2/packr2/cmd/pack.go b/packr2/cmd/pack.go similarity index 100% rename from v2/packr2/cmd/pack.go rename to packr2/cmd/pack.go diff --git a/v2/packr2/cmd/root.go b/packr2/cmd/root.go similarity index 100% rename from v2/packr2/cmd/root.go rename to packr2/cmd/root.go diff --git a/v2/packr2/cmd/version.go b/packr2/cmd/version.go similarity index 100% rename from v2/packr2/cmd/version.go rename to packr2/cmd/version.go diff --git a/v2/packr2/main.go b/packr2/main.go similarity index 100% rename from v2/packr2/main.go rename to packr2/main.go diff --git a/packr_test.go b/packr_test.go index d540360..adc6b33 100644 --- a/packr_test.go +++ b/packr_test.go @@ -1,46 +1,11 @@ package packr -import ( - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" -) - -var testBox = NewBox("./fixtures") -var virtualBox = NewBox("./virtual") - -func init() { - PackBytes(virtualBox.Path, "a", []byte("a")) - PackBytes(virtualBox.Path, "b", []byte("b")) - PackBytes(virtualBox.Path, "c", []byte("c")) - PackBytes(virtualBox.Path, "d/a", []byte("d/a")) -} - -func Test_PackBytes(t *testing.T) { - r := require.New(t) - PackBytes(testBox.Path, "foo", []byte("bar")) - s, err := testBox.FindString("foo") - r.NoError(err) - r.Equal("bar", s) -} - -func Test_PackJSONBytes(t *testing.T) { - r := require.New(t) - b, err := json.Marshal([]byte("json bytes")) - r.NoError(err) - err = PackJSONBytes(testBox.Path, "the bytes", string(b)) - r.NoError(err) - s, err := testBox.Find("the bytes") - r.NoError(err) - r.Equal([]byte("json bytes"), s) -} - -func Test_PackBytesGzip(t *testing.T) { - r := require.New(t) - err := PackBytesGzip(testBox.Path, "gzip", []byte("gzip foobar")) - r.NoError(err) - s, err := testBox.FindString("gzip") - r.NoError(err) - r.Equal("gzip foobar", s) +import "github.com/gobuffalo/packr/v2/file" + +func qfile(name string, body string) File { + f, err := file.NewFile(name, []byte(body)) + if err != nil { + panic(err) + } + return f } diff --git a/v2/plog/plog.go b/plog/plog.go similarity index 100% rename from v2/plog/plog.go rename to plog/plog.go diff --git a/v2/pointer.go b/pointer.go similarity index 100% rename from v2/pointer.go rename to pointer.go diff --git a/v2/pointer_test.go b/pointer_test.go similarity index 100% rename from v2/pointer_test.go rename to pointer_test.go diff --git a/v2/resolvers_map.go b/resolvers_map.go similarity index 100% rename from v2/resolvers_map.go rename to resolvers_map.go diff --git a/v2/.gometalinter.json b/v2/.gometalinter.json deleted file mode 100644 index e4f65a3..0000000 --- a/v2/.gometalinter.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"] -} diff --git a/v2/.goreleaser.yml b/v2/.goreleaser.yml deleted file mode 100644 index 7a57ebb..0000000 --- a/v2/.goreleaser.yml +++ /dev/null @@ -1,42 +0,0 @@ -# Code generated by github.com/gobuffalo/release. DO NOT EDIT. -# Edit .goreleaser.yml.plush instead - -builds: -- - goos: - - darwin - - linux - - windows - goarch: - - ppc64le - - 386 - - amd64 - env: - - CGO_ENABLED=0 - ignore: - - goos: darwin - goarch: ppc64le - - goos: windows - goarch: ppc64le - main: ./packr2/main.go - binary: packr2 - -checksum: - name_template: 'checksums.txt' - -snapshot: - name_template: "{{ .Tag }}-next" - -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' - -brews: - - - github: - owner: gobuffalo - name: homebrew-tap - diff --git a/v2/.goreleaser.yml.plush b/v2/.goreleaser.yml.plush deleted file mode 100644 index 6bd6ba9..0000000 --- a/v2/.goreleaser.yml.plush +++ /dev/null @@ -1,39 +0,0 @@ -builds: -- - goos: - - darwin - - linux - - windows - goarch: - - ppc64le - - 386 - - amd64 - env: - - CGO_ENABLED=0 - ignore: - - goos: darwin - goarch: ppc64le - - goos: windows - goarch: ppc64le - main: ./packr2/main.go - binary: packr2 - -checksum: - name_template: 'checksums.txt' - -snapshot: - name_template: "{{ .Tag }}-next" - -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' -<%= if (brew) { %> -brews: - - - github: - owner: gobuffalo - name: homebrew-tap -<% } %> diff --git a/v2/LICENSE.txt b/v2/LICENSE.txt deleted file mode 100644 index 3ccb336..0000000 --- a/v2/LICENSE.txt +++ /dev/null @@ -1,8 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2016 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. diff --git a/v2/Makefile b/v2/Makefile deleted file mode 100644 index 0c87008..0000000 --- a/v2/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -TAGS ?= "sqlite" -GO_BIN ?= go - -install: deps - echo "installing packr v2" - packr2 - $(GO_BIN) install -v ./packr2 - -tidy: -ifeq ($(GO111MODULE),on) - $(GO_BIN) mod tidy -else - echo skipping go mod tidy -endif - -deps: - $(GO_BIN) get -tags ${TAGS} -t ./... - $(GO_BIN) install -v ./packr2 - make tidy - -build: deps - packr2 - $(GO_BIN) build -v ./packr2 - make tidy - -test: - packr2 - $(GO_BIN) test -tags ${TAGS} ./... - make tidy - -lint: - gometalinter --vendor ./... --deadline=1m --skip=internal - -update: - $(GO_BIN) get -u -tags ${TAGS} ./... - make tidy - make install - make test - make tidy - -release-test: - $(GO_BIN) test -tags ${TAGS} -race ./... - -release: - release -y -f version.go - make tidy diff --git a/v2/README.md b/v2/README.md deleted file mode 100644 index cb65f9b..0000000 --- a/v2/README.md +++ /dev/null @@ -1,239 +0,0 @@ -**NOTICE: Please consider migrating your projects to github.com/markbates/pkger. It has an idiomatic API, minimal dependencies, a stronger test suite (tested directly against the std lib counterparts), transparent tooling, and more.** - -https://blog.gobuffalo.io/introducing-pkger-static-file-embedding-in-go-1ce76dc79c65 - -# Packr (v2) - -[![GoDoc](https://godoc.org/github.com/gobuffalo/packr/v2?status.svg)](https://godoc.org/github.com/gobuffalo/packr/v2) - -Packr is a simple solution for bundling static assets inside of Go binaries. Most importantly it does it in a way that is friendly to developers while they are developing. - -## Intro Video - -To get an idea of the what and why of Packr, please enjoy this short video: [https://vimeo.com/219863271](https://vimeo.com/219863271). - -## Library Installation - -```text -$ go get -u github.com/gobuffalo/packr/v2/... -``` - -## Binary Installation - -```text -$ go get -u github.com/gobuffalo/packr/v2/packr2 -``` - -## New File Format FAQs - -In version `v2.0.0` the file format changed and is not backward compatible with the `packr-v1.x` library. - -#### Can `packr-v1.x` read the new format? - -No, it can not. Because of the way the new file format works porting it to `packr-v1.x` would be difficult. PRs are welcome though. :) - -#### Can `packr-v2.x` read `packr-v1.x` files? - -Yes it can, but that ability will eventually be phased out. Because of that we recommend moving to the new format. - -#### Can `packr-v2.x` generate `packr-v1.x` files? - -Yes it can, but that ability will eventually be phased out. Because of that we recommend moving to the new format. - -The `--legacy` command is available on all commands that generate `-packr.go` files. - -```bash -$ packr2 --legacy -``` - -## Usage - -### In Code - -The first step in using Packr is to create a new box. A box represents a folder on disk. Once you have a box you can get `string` or `[]byte` representations of the file. - -```go -// set up a new box by giving it a name and an optional (relative) path to a folder on disk: -box := packr.New("My Box", "./templates") - -// Get the string representation of a file, or an error if it doesn't exist: -html, err := box.FindString("index.html") - -// Get the []byte representation of a file, or an error if it doesn't exist: -html, err := box.Find("index.html") -``` - -### What is a Box? - -A box represents a folder, and any sub-folders, on disk that you want to have access to in your binary. When compiling a binary using the `packr2` CLI the contents of the folder will be converted into Go files that can be compiled inside of a "standard" go binary. Inside of the compiled binary the files will be read from memory. When working locally the files will be read directly off of disk. This is a seamless switch that doesn't require any special attention on your part. - -#### Example - -Assume the follow directory structure: - -``` -├── main.go -└── templates - ├── admin - │   └── index.html - └── index.html -``` - -The following program will read the `./templates/admin/index.html` file and print it out. - -```go -package main - -import ( - "fmt" - - "github.com/gobuffalo/packr/v2" -) - -func main() { - box := packr.New("myBox", "./templates") - - s, err := box.FindString("admin/index.html") - if err != nil { - log.Fatal(err) - } - fmt.Println(s) -} -``` - -### Development Made Easy - -In order to get static files into a Go binary, those files must first be converted to Go code. To do that, Packr, ships with a few tools to help build binaries. See below. - -During development, however, it is painful to have to keep running a tool to compile those files. - -Packr uses the following resolution rules when looking for a file: - -1. Look for the file in-memory (inside a Go binary) -1. Look for the file on disk (during development) - -Because Packr knows how to fall through to the file system, developers don't need to worry about constantly compiling their static files into a binary. They can work unimpeded. - -Packr takes file resolution a step further. When declaring a new box you use a relative path, `./templates`. When Packr receives this call it calculates out the absolute path to that directory. By doing this it means you can be guaranteed that Packr can find your files correctly, even if you're not running in the directory that the box was created in. This helps with the problem of testing, where Go changes the `pwd` for each package, making relative paths difficult to work with. This is not a problem when using Packr. - ---- - -## Usage with HTTP - -A box implements the [`http.FileSystem`](https://golang.org/pkg/net/http/#FileSystem) interface, meaning it can be used to serve static files. - -```go -package main - -import ( - "net/http" - - "github.com/gobuffalo/packr/v2" -) - -func main() { - box := packr.New("someBoxName", "./templates") - - http.Handle("/", http.FileServer(box)) - http.ListenAndServe(":3000", nil) -} -``` - ---- - -## Building a Binary - -Before you build your Go binary, run the `packr2` command first. It will look for all the boxes in your code and then generate `.go` files that pack the static files into bytes that can be bundled into the Go binary. - -``` -$ packr2 -``` - -Then run your `go build command` like normal. - -*NOTE*: It is not recommended to check-in these generated `-packr.go` files. They can be large, and can easily become out of date if not careful. It is recommended that you always run `packr2 clean` after running the `packr2` tool. - -#### Cleaning Up - -When you're done it is recommended that you run the `packr2 clean` command. This will remove all of the generated files that Packr created for you. - -``` -$ packr2 clean -``` - -Why do you want to do this? Packr first looks to the information stored in these generated files, if the information isn't there it looks to disk. This makes it easy to work with in development. - ---- - -## Debugging - -The `packr2` command passes all arguments down to the underlying `go` command, this includes the `-v` flag to print out `go build` information. Packr looks for the `-v` flag, and will turn on its own verbose logging. This is very useful for trying to understand what the `packr` command is doing when it is run. - ---- - -## FAQ - -### Compilation Errors with Go Templates - -Q: I have a program with Go template files, those files are named `foo.go` and look like the following: - -``` -// Copyright {{.Year}} {{.Author}}. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package {{.Project}} -``` - -When I run `packr2` I get errors like: - -``` -expected 'IDENT', found '{' -``` - -A: Packr works by searching your `.go` files for [`github.com/gobuffalo/packr/v2#New`](https://godoc.org/github.com/gobuffalo/packr/v2#New) or [`github.com/gobuffalo/packr/v2#NewBox`](https://godoc.org/github.com/gobuffalo/packr/v2#NewBox) calls. Because those files aren't "proper" Go files, Packr can't parse them to find the box declarations. To fix this you need to tell Packr to ignore those files when searching for boxes. A couple solutions to this problem are: - -* Name the files something else. The `.tmpl` extension is the idiomatic way of naming these types of files. -* Rename the folder containing these files to start with an `_`, for example `_templates`. Packr, like Go, will ignore folders starting with the `_` character when searching for boxes. - -### Dynamic Box Paths - -Q: I need to set the path of a box using a variable, but `packr.New("foo", myVar)` doesn't work correctly. - -A: Packr attempts to "automagically" set it's resolution directory when using [`github.com/gobuffalo/packr/v2#New`](https://godoc.org/github.com/gobuffalo/packr/v2#New), however, for dynamic paths you need to set it manually: - -```go -box := packr.New("foo", "|") -box.ResolutionDir = myVar -``` - -### I don't want to pack files, but still use the Packr interface. - -Q: I want to write code that using the Packr tools, but doesn't actually pack the files into my binary. How can I do that? - -A: Using [`github.com/gobuffalo/packr/v2#Folder`](https://godoc.org/github.com/gobuffalo/packr/v2#Folder) gives you back a `*packr.Box` that can be used as normal, but is excluded by the Packr tool when compiling. - -### Packr Finds No Boxes - -Q: I run `packr2 -v` but it doesn't find my boxes: - -``` -DEBU[2019-03-18T18:48:52+01:00] *parser.Parser#NewFromRoots found prospects=0 -DEBU[2019-03-18T18:48:52+01:00] found 0 boxes -``` - -A: Packr works by parsing `.go` files to find [`github.com/gobuffalo/packr/v2#Box`](https://godoc.org/github.com/gobuffalo/packr/v2#Box) and [`github.com/gobuffalo/packr/v2#NewBox`](https://godoc.org/github.com/gobuffalo/packr/v2#NewBox) declarations. If there aren't any `.go` in the folder that `packr2` is run in it can not find those declarations. To fix this problem run the `packr2` command in the directory containing your `.go` files. - -### Box Interfaces - -Q: I want to be able to easily test my applications by passing in mock boxes. How do I do that? - -A: Packr boxes and files conform to the interfaces found at [`github.com/gobuffalo/packd`](https://godoc.org/github.com/gobuffalo/packd). Change your application to use those interfaces instead of the concrete Packr types. - -```go -// using concrete type -func myFunc(box *packr.Box) {} - -// using interfaces -func myFunc(box packd.Box) {} -``` diff --git a/v2/SHOULDERS.md b/v2/SHOULDERS.md deleted file mode 100644 index 9b97a55..0000000 --- a/v2/SHOULDERS.md +++ /dev/null @@ -1,32 +0,0 @@ -# github.com/gobuffalo/packr/v2 Stands on the Shoulders of Giants - -github.com/gobuffalo/packr/v2 does not try to reinvent the wheel! Instead, it uses the already great wheels developed by the Go community and puts them all together in the best way possible. Without these giants, this project would not be possible. Please make sure to check them out and thank them for all of their hard work. - -Thank you to the following **GIANTS**: - - -* [github.com/gobuffalo/logger](https://godoc.org/github.com/gobuffalo/logger) - -* [github.com/gobuffalo/packd](https://godoc.org/github.com/gobuffalo/packd) - -* [github.com/karrick/godirwalk](https://godoc.org/github.com/karrick/godirwalk) - -* [github.com/konsorten/go-windows-terminal-sequences](https://godoc.org/github.com/konsorten/go-windows-terminal-sequences) - -* [github.com/markbates/errx](https://godoc.org/github.com/markbates/errx) - -* [github.com/markbates/oncer](https://godoc.org/github.com/markbates/oncer) - -* [github.com/markbates/safe](https://godoc.org/github.com/markbates/safe) - -* [github.com/rogpeppe/go-internal](https://godoc.org/github.com/rogpeppe/go-internal) - -* [github.com/sirupsen/logrus](https://godoc.org/github.com/sirupsen/logrus) - -* [github.com/spf13/cobra](https://godoc.org/github.com/spf13/cobra) - -* [github.com/stretchr/testify](https://godoc.org/github.com/stretchr/testify) - -* [golang.org/x/sync](https://godoc.org/golang.org/x/sync) - -* [golang.org/x/tools](https://godoc.org/golang.org/x/tools) diff --git a/v2/_fixtures/list_test/a.txt b/v2/_fixtures/list_test/a.txt deleted file mode 100644 index e69de29..0000000 diff --git a/v2/_fixtures/list_test/b/b.txt b/v2/_fixtures/list_test/b/b.txt deleted file mode 100644 index e69de29..0000000 diff --git a/v2/box.go b/v2/box.go deleted file mode 100644 index a2636de..0000000 --- a/v2/box.go +++ /dev/null @@ -1,240 +0,0 @@ -package packr - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "net/http" - "os" - "path" - "path/filepath" - "sort" - "strings" - - "github.com/gobuffalo/packd" - "github.com/gobuffalo/packr/v2/file" - "github.com/gobuffalo/packr/v2/file/resolver" - "github.com/gobuffalo/packr/v2/plog" - "github.com/markbates/oncer" -) - -var _ packd.Box = &Box{} -var _ packd.HTTPBox = &Box{} -var _ packd.Addable = &Box{} -var _ packd.Walkable = &Box{} -var _ packd.Finder = &Box{} - -// Box represent a folder on a disk you want to -// have access to in the built Go binary. -type Box struct { - Path string `json:"path"` - Name string `json:"name"` - ResolutionDir string `json:"resolution_dir"` - DefaultResolver resolver.Resolver `json:"default_resolver"` - resolvers resolversMap - dirs dirsMap -} - -// NewBox returns a Box that can be used to -// retrieve files from either disk or the embedded -// binary. -// Deprecated: Use New instead. -func NewBox(path string) *Box { - oncer.Deprecate(0, "packr.NewBox", "Use packr.New instead.") - return New(path, path) -} - -// New returns a new Box with the name of the box -// and the path of the box. -func New(name string, path string) *Box { - plog.Debug("packr", "New", "name", name, "path", path) - b, _ := findBox(name) - if b != nil { - return b - } - - b = construct(name, path) - plog.Debug(b, "New", "Box", b, "ResolutionDir", b.ResolutionDir) - b, err := placeBox(b) - if err != nil { - panic(err) - } - - return b -} - -// Folder returns a Box that will NOT be packed. -// This is useful for writing tests or tools that -// need to work with a folder at runtime. -func Folder(path string) *Box { - return New(path, path) -} - -// SetResolver allows for the use of a custom resolver for -// the specified file -func (b *Box) SetResolver(file string, res resolver.Resolver) { - d := filepath.Dir(file) - b.dirs.Store(d, true) - plog.Debug(b, "SetResolver", "file", file, "resolver", fmt.Sprintf("%T", res)) - b.resolvers.Store(resolver.Key(file), res) -} - -// AddString converts t to a byteslice and delegates to AddBytes to add to b.data -func (b *Box) AddString(path string, t string) error { - return b.AddBytes(path, []byte(t)) -} - -// AddBytes sets t in b.data by the given path -func (b *Box) AddBytes(path string, t []byte) error { - m := map[string]file.File{} - f, err := file.NewFile(path, t) - if err != nil { - return err - } - m[resolver.Key(path)] = f - res := resolver.NewInMemory(m) - b.SetResolver(path, res) - return nil -} - -// FindString returns either the string of the requested -// file or an error if it can not be found. -func (b *Box) FindString(name string) (string, error) { - bb, err := b.Find(name) - return string(bb), err -} - -// Find returns either the byte slice of the requested -// file or an error if it can not be found. -func (b *Box) Find(name string) ([]byte, error) { - f, err := b.Resolve(name) - if err != nil { - return []byte(""), err - } - bb := &bytes.Buffer{} - io.Copy(bb, f) - return bb.Bytes(), nil -} - -// Has returns true if the resource exists in the box -func (b *Box) Has(name string) bool { - _, err := b.Find(name) - return err == nil -} - -// HasDir returns true if the directory exists in the box -func (b *Box) HasDir(name string) bool { - oncer.Do("packr2/box/HasDir"+b.Name, func() { - for _, f := range b.List() { - for d := filepath.Dir(f); d != "."; d = filepath.Dir(d) { - b.dirs.Store(d, true) - } - } - }) - if name == "/" { - return b.Has("index.html") - } - _, ok := b.dirs.Load(name) - return ok -} - -// Open returns a File using the http.File interface -func (b *Box) Open(name string) (http.File, error) { - plog.Debug(b, "Open", "name", name) - f, err := b.Resolve(name) - if err != nil { - if len(filepath.Ext(name)) == 0 { - return b.openWoExt(name) - } - return f, err - } - f, err = file.NewFileR(name, f) - plog.Debug(b, "Open", "name", f.Name(), "file", f.Name()) - return f, err -} - -func (b *Box) openWoExt(name string) (http.File, error) { - if !b.HasDir(name) { - id := path.Join(name, "index.html") - if b.Has(id) { - return b.Open(id) - } - return nil, os.ErrNotExist - } - d, err := file.NewDir(name) - plog.Debug(b, "Open", "name", name, "dir", d) - return d, err -} - -// List shows "What's in the box?" -func (b *Box) List() []string { - var keys []string - - b.Walk(func(path string, info File) error { - if info == nil { - return nil - } - finfo, _ := info.FileInfo() - if !finfo.IsDir() { - keys = append(keys, path) - } - return nil - }) - sort.Strings(keys) - return keys -} - -// Resolve will attempt to find the file in the box, -// returning an error if the find can not be found. -func (b *Box) Resolve(key string) (file.File, error) { - key = strings.TrimPrefix(key, "/") - - var r resolver.Resolver - - b.resolvers.Range(func(k string, vr resolver.Resolver) bool { - lk := strings.ToLower(resolver.Key(k)) - lkey := strings.ToLower(resolver.Key(key)) - if lk == lkey { - r = vr - return false - } - return true - }) - - if r == nil { - r = b.DefaultResolver - if r == nil { - r = resolver.DefaultResolver - if r == nil { - return nil, fmt.Errorf("resolver.DefaultResolver is nil") - } - } - } - plog.Debug(r, "Resolve", "box", b.Name, "key", key) - - f, err := r.Resolve(b.Name, key) - if err != nil { - z, err := resolver.ResolvePathInBase(resolver.OsPath(b.ResolutionDir), filepath.FromSlash(path.Clean("/"+resolver.OsPath(key)))) - if err != nil { - plog.Debug(r, "Resolve", "box", b.Name, "key", key, "err", err) - return f, err - } - - f, err = r.Resolve(b.Name, z) - if err != nil { - plog.Debug(r, "Resolve", "box", b.Name, "key", z, "err", err) - return f, err - } - b, err := ioutil.ReadAll(f) - if err != nil { - return f, err - } - f, err = file.NewFile(key, b) - if err != nil { - return f, err - } - } - plog.Debug(r, "Resolve", "box", b.Name, "key", key, "file", f.Name()) - return f, nil -} diff --git a/v2/box_test.go b/v2/box_test.go deleted file mode 100644 index 75fc8c4..0000000 --- a/v2/box_test.go +++ /dev/null @@ -1,253 +0,0 @@ -package packr - -import ( - "bytes" - "path/filepath" - "strings" - "testing" - - "github.com/gobuffalo/packr/v2/file" - "github.com/gobuffalo/packr/v2/file/resolver" - "github.com/stretchr/testify/require" -) - -func Test_New(t *testing.T) { - r := require.New(t) - - box := New("Test_NewBox", filepath.Join("_fixtures", "list_test")) - r.Len(box.List(), 4) - -} -func Test_Box_AddString(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_AddString", "./templates") - s, err := box.FindString("foo.txt") - r.Error(err) - r.Equal("", s) - - r.NoError(box.AddString("foo.txt", "foo!!")) - s, err = box.FindString("foo.txt") - r.NoError(err) - r.Equal("foo!!", s) -} - -func Test_Box_AddBytes(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_AddBytes", "") - s, err := box.FindString("foo.txt") - r.Error(err) - r.Equal("", s) - - r.NoError(box.AddBytes("foo.txt", []byte("foo!!"))) - s, err = box.FindString("foo.txt") - r.NoError(err) - r.Equal("foo!!", s) -} - -func Test_Box_String(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_String", "./templates") - d := resolver.NewInMemory(map[string]file.File{ - "foo.txt": qfile("foo.txt", "foo!"), - }) - box.SetResolver("foo.txt", d) - - s := box.String("foo.txt") - r.Equal("foo!", s) - - s = box.String("idontexist") - r.Equal("", s) -} - -func Test_Box_String_Miss(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_String_Miss", filepath.Join("_fixtures", "templates")) - - s := box.String("foo.txt") - r.Equal("FOO!!!", strings.TrimSpace(s)) - - s = box.String("idontexist") - r.Equal("", s) -} - -func Test_Box_FindString(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_FindString", "./templates") - d := resolver.NewInMemory(map[string]file.File{ - "foo.txt": qfile("foo.txt", "foo!"), - }) - box.SetResolver("foo.txt", d) - - s, err := box.FindString("foo.txt") - r.NoError(err) - r.Equal("foo!", s) - - s, err = box.FindString("idontexist") - r.Error(err) - r.Equal("", s) -} - -func Test_Box_FindString_Miss(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_FindString_Miss", filepath.Join("_fixtures", "templates")) - - s, err := box.FindString("foo.txt") - r.NoError(err) - r.Equal("FOO!!!", strings.TrimSpace(s)) - - s, err = box.FindString("idontexist") - r.Error(err) - r.Equal("", s) -} - -func Test_Box_Bytes(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_Bytes", "./templates") - d := resolver.NewInMemory(map[string]file.File{ - "foo.txt": qfile("foo.txt", "foo!"), - }) - box.SetResolver("foo.txt", d) - - s := box.Bytes("foo.txt") - r.Equal([]byte("foo!"), s) - - s = box.Bytes("idontexist") - r.Equal([]byte(""), s) -} - -func Test_Box_Bytes_Miss(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_Bytes_Miss", filepath.Join("_fixtures", "templates")) - - s := box.Bytes("foo.txt") - r.Equal([]byte("FOO!!!"), bytes.TrimSpace(s)) - - s = box.Bytes("idontexist") - r.Equal([]byte(""), s) -} - -func Test_Box_Find(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_Find", "./templates") - d := resolver.NewInMemory(map[string]file.File{ - "foo.txt": qfile("foo.txt", "foo!"), - }) - box.SetResolver("foo.txt", d) - - s, err := box.Find("foo.txt") - r.NoError(err) - r.Equal("foo!", string(s)) - - s, err = box.Find("idontexist") - r.Error(err) - r.Equal("", string(s)) -} - -func Test_Box_Find_Miss(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_Find_Miss", "./_fixtures/templates") - s, err := box.Find("foo.txt") - r.NoError(err) - r.Equal("FOO!!!", strings.TrimSpace(string(s))) - - s, err = box.Find("idontexist") - r.Error(err) - r.Equal("", string(s)) -} - -func Test_Box_Has(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_Has", "./templates") - d := resolver.NewInMemory(map[string]file.File{ - "foo.txt": qfile("foo.txt", "foo!"), - }) - box.SetResolver("foo.txt", d) - - r.True(box.Has("foo.txt")) - r.False(box.Has("idontexist")) -} - -func Test_Box_Open(t *testing.T) { - r := require.New(t) - - d := resolver.NewInMemory(map[string]file.File{ - "foo.txt": qfile("foo.txt", "foo!"), - "bar": qfile("bar", "bar!"), - "baz/index.html": qfile("baz", "baz!"), - }) - box := New("Test_Box_Open", "./templates") - - box.DefaultResolver = d - - for _, x := range []string{"foo.txt", "/foo.txt", "bar", "/bar", "baz", "/baz"} { - f, err := box.Open(x) - r.NoError(err) - r.NotZero(f) - } - - f, err := box.Open("idontexist.txt") - r.Error(err) - r.Zero(f) -} - -func Test_Box_List(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_List", filepath.Join("_fixtures", "list_test")) - r.NoError(box.AddString(filepath.Join("d", "d.txt"), "D")) - - act := box.List() - exp := []string{"a.txt", filepath.Join("b", "b.txt"), filepath.Join("b", "b2.txt"), filepath.Join("c", "c.txt"), filepath.Join("d", "d.txt")} - r.Equal(exp, act) -} - -func Test_Box_HasDir(t *testing.T) { - r := require.New(t) - - box := New("Test_Box_HasDir", filepath.Join("_fixtures", "list_test")) - r.NoError(box.AddString("d/e/f.txt", "D")) - - r.True(box.HasDir("d/e")) - r.True(box.HasDir("d")) - r.True(box.HasDir("c")) - r.False(box.HasDir("a")) -} - -func Test_Box_Traversal_Standard(t *testing.T) { - r := require.New(t) - box := New("Test_Box_Traversal_Standard", "") - _, err := box.FindString("../fixtures/hello.txt") - r.Error(err) -} - -func Test_Box_Traversal_Standard_Depth2(t *testing.T) { - r := require.New(t) - box := New("Test_Box_Traversal_Standard_Depth2", "") - _, err := box.FindString("../../packr/fixtures/hello.txt") - r.Error(err) -} - -func Test_Box_Traversal_Backslash(t *testing.T) { - r := require.New(t) - box := New("Test_Box_Traversal_Backslash", "") - _, err := box.FindString("..\\fixtures\\hello.txt") - r.Error(err) -} - -func Test_Box_Traversal_Backslash_Depth2(t *testing.T) { - r := require.New(t) - box := New("Test_Box_Traversal_Backslash_Depth2", "") - _, err := box.FindString("..\\..\\packr2\\fixtures\\hello.txt") - r.Error(err) -} diff --git a/v2/go.mod b/v2/go.mod deleted file mode 100644 index 82bf27a..0000000 --- a/v2/go.mod +++ /dev/null @@ -1,19 +0,0 @@ -module github.com/gobuffalo/packr/v2 - -go 1.13 - -require ( - github.com/gobuffalo/logger v1.0.3 - github.com/gobuffalo/packd v1.0.0 - github.com/karrick/godirwalk v1.15.8 - github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect - github.com/markbates/errx v1.1.0 - github.com/markbates/oncer v1.0.0 - github.com/markbates/safe v1.0.1 - github.com/rogpeppe/go-internal v1.5.2 - github.com/sirupsen/logrus v1.4.2 - github.com/spf13/cobra v0.0.6 - github.com/stretchr/testify v1.5.1 - golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e - golang.org/x/tools v0.0.0-20200308013534-11ec41452d41 -) diff --git a/v2/go.sum b/v2/go.sum deleted file mode 100644 index 86abdab..0000000 --- a/v2/go.sum +++ /dev/null @@ -1,180 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -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/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gobuffalo/logger v1.0.3 h1:YaXOTHNPCvkqqA7w05A4v0k2tCdpr+sgFlgINbQ6gqc= -github.com/gobuffalo/logger v1.0.3/go.mod h1:SoeejUwldiS7ZsyCBphOGURmWdwUFXs0J7TCjEhjKxM= -github.com/gobuffalo/packd v1.0.0 h1:6ERZvJHfe24rfFmA9OaoKBdC7+c9sydrytMg8SdFGBM= -github.com/gobuffalo/packd v1.0.0/go.mod h1:6VTc4htmJRFB7u1m/4LeMTWjFoYrUiBkU9Fdec9hrhI= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/karrick/godirwalk v1.15.8 h1:7+rWAZPn9zuRxaIqqT8Ohs2Q2Ac0msBqwRdxNCr2VVs= -github.com/karrick/godirwalk v1.15.8/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/markbates/errx v1.1.0 h1:QDFeR+UP95dO12JgW+tgi2UVfo0V8YBHiUIOaeBPiEI= -github.com/markbates/errx v1.1.0/go.mod h1:PLa46Oex9KNbVDZhKel8v1OT7hD5JZ2eI7AHhA0wswc= -github.com/markbates/oncer v1.0.0 h1:E83IaVAHygyndzPimgUYJjbshhDTALZyXxvk9FOlQRY= -github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI= -github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI= -github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -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/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.5.2 h1:qLvObTrvO/XRCqmkKxUlOBc48bI3efyDuAZe25QiF0w= -github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.6 h1:breEStsVwemnKh2/s6gMvSdMEkwW0sK8vGStnlVBMCs= -github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c h1:/nJuwDLoL/zrqY6gf57vxC+Pi+pZ8bfhpPkicO5H7W4= -golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200308013534-11ec41452d41 h1:9Di9iYgOt9ThCipBxChBVhgNipDoE5mxO84rQV7D0FE= -golang.org/x/tools v0.0.0-20200308013534-11ec41452d41/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/v2/http_box_test.go b/v2/http_box_test.go deleted file mode 100644 index 3685133..0000000 --- a/v2/http_box_test.go +++ /dev/null @@ -1,169 +0,0 @@ -package packr - -import ( - "net/http" - "net/http/httptest" - "strings" - "testing" - - "github.com/gobuffalo/packd" - "github.com/gobuffalo/packr/v2/file/resolver" - "github.com/stretchr/testify/require" -) - -var httpBox = func() packd.Box { - box := New("http box", "") - - ind, err := resolver.HexGzipString("

Index!

") - if err != nil { - panic(err) - } - - hello, err := resolver.HexGzipString("hello world!") - if err != nil { - panic(err) - } - - hg, err := resolver.NewHexGzip(map[string]string{ - "index.html": ind, - "hello.txt": hello, - }) - if err != nil { - panic(err) - } - - box.DefaultResolver = hg - return box -}() - -func Test_HTTPBox(t *testing.T) { - r := require.New(t) - - mux := http.NewServeMux() - mux.Handle("/", http.FileServer(httpBox)) - - req, err := http.NewRequest("GET", "/hello.txt", nil) - r.NoError(err) - - res := httptest.NewRecorder() - - mux.ServeHTTP(res, req) - - r.Equal(200, res.Code) - r.Equal("hello world!", strings.TrimSpace(res.Body.String())) -} - -func Test_HTTPBox_NotFound(t *testing.T) { - r := require.New(t) - - mux := http.NewServeMux() - mux.Handle("/", http.FileServer(httpBox)) - - req, err := http.NewRequest("GET", "/notInBox.txt", nil) - r.NoError(err) - - res := httptest.NewRecorder() - - mux.ServeHTTP(res, req) - - r.Equal(404, res.Code) -} - -func Test_HTTPBox_Handles_IndexHTML_Nested(t *testing.T) { - r := require.New(t) - - box := New("Test_HTTPBox_Handles_IndexHTML_Nested", "!") - box.AddString("foo/index.html", "foo") - - mux := http.NewServeMux() - mux.Handle("/", http.FileServer(box)) - - req, err := http.NewRequest("GET", "/foo", nil) - r.NoError(err) - - res := httptest.NewRecorder() - - mux.ServeHTTP(res, req) - - r.Equal(200, res.Code) - - r.Equal("foo", strings.TrimSpace(res.Body.String())) -} - -func Test_HTTPBox_Handles_IndexHTML(t *testing.T) { - r := require.New(t) - - mux := http.NewServeMux() - mux.Handle("/", http.FileServer(httpBox)) - - req, err := http.NewRequest("GET", "/", nil) - r.NoError(err) - - res := httptest.NewRecorder() - - mux.ServeHTTP(res, req) - - r.Equal(200, res.Code) - - r.Equal("

Index!

", strings.TrimSpace(res.Body.String())) -} - -func Test_HTTPBox_CaseInsensitive(t *testing.T) { - mux := http.NewServeMux() - httpBox.AddString("myfile.txt", "this is my file") - mux.Handle("/", http.FileServer(httpBox)) - - for _, path := range []string{"/MyFile.txt", "/myfile.txt", "/Myfile.txt"} { - t.Run(path, func(st *testing.T) { - r := require.New(st) - - req, err := http.NewRequest("GET", path, nil) - r.NoError(err) - - res := httptest.NewRecorder() - - mux.ServeHTTP(res, req) - - r.Equal(200, res.Code) - r.Equal("this is my file", strings.TrimSpace(res.Body.String())) - }) - } -} - -func Test_HTTPBox_Disk(t *testing.T) { - r := require.New(t) - - box := New("http disk box", "./_fixtures/http_test") - mux := http.NewServeMux() - mux.Handle("/", http.FileServer(box)) - - type testcase struct { - URL, Content, Location string - Code int - } - - testcases := []testcase{ - {"/", "Index", "", 200}, - {"/sub", "Sub", "", 200}, - {"/index.html", "", "./", 301}, - {"/sub/index.html", "", "./", 301}, - {"/sub/", "", "../sub", 301}, - {"/footer.html", "Footer", "", 200}, - {"/css/main.css", "Css", "", 200}, - {"/css", "404 page not found", "", 404}, - {"/css/", "404 page not found", "", 404}, - } - - for _, tc := range testcases { - t.Run("path"+tc.URL, func(t *testing.T) { - req, err := http.NewRequest("GET", tc.URL, nil) - r.NoError(err) - res := httptest.NewRecorder() - mux.ServeHTTP(res, req) - - r.Equal(tc.Code, res.Code) - r.Equal(tc.Location, res.Header().Get("location")) - r.Equal(tc.Content, strings.TrimSpace(res.Body.String())) - }) - } -} diff --git a/v2/internal/envy.go b/v2/internal/envy.go deleted file mode 100644 index 30cf7b5..0000000 --- a/v2/internal/envy.go +++ /dev/null @@ -1,37 +0,0 @@ -package internal - -import ( - "os" - "runtime" - "strings" -) - -// Mods returns true when go modules supports is enabled -func Mods() bool { - go111 := os.Getenv("GO111MODULE") - - if !inGoPath() { - return go111 != "off" - } - - return go111 == "on" -} - -func inGoPath() bool { - pwd, _ := os.Getwd() - for _, p := range GoPaths() { - if strings.HasPrefix(pwd, p) { - return true - } - } - return false -} - -// GoPaths return the defined gopath list. -func GoPaths() []string { - gp := os.Getenv("GOPATH") - if runtime.GOOS == "windows" { - return strings.Split(gp, ";") // Windows uses a different separator - } - return strings.Split(gp, ":") -} diff --git a/v2/packr.go b/v2/packr.go deleted file mode 100644 index f0f88f1..0000000 --- a/v2/packr.go +++ /dev/null @@ -1,56 +0,0 @@ -package packr - -import ( - "fmt" - - "github.com/gobuffalo/packr/v2/file/resolver" - "github.com/gobuffalo/packr/v2/jam/parser" - "github.com/gobuffalo/packr/v2/plog" - "github.com/markbates/safe" -) - -var boxes = &boxMap{} - -var _ = safe.Run(func() { - p, err := parser.NewFromRoots([]string{}, nil) - if err != nil { - plog.Logger.Error(err) - return - } - boxes, err := p.Run() - if err != nil { - plog.Logger.Error(err) - return - } - for _, box := range boxes { - b := construct(box.Name, box.AbsPath) - _, err = placeBox(b) - if err != nil { - plog.Logger.Error(err) - return - } - } - -}) - -func findBox(name string) (*Box, error) { - key := resolver.Key(name) - plog.Debug("packr", "findBox", "name", name, "key", key) - - b, ok := boxes.Load(key) - if !ok { - plog.Debug("packr", "findBox", "name", name, "key", key, "found", ok) - return nil, fmt.Errorf("could not find box %s", name) - } - - plog.Debug(b, "found", "box", b) - return b, nil -} - -func placeBox(b *Box) (*Box, error) { - key := resolver.Key(b.Name) - eb, _ := boxes.LoadOrStore(key, b) - - plog.Debug("packr", "placeBox", "name", eb.Name, "path", eb.Path, "resolution directory", eb.ResolutionDir) - return eb, nil -} diff --git a/v2/packr_test.go b/v2/packr_test.go deleted file mode 100644 index adc6b33..0000000 --- a/v2/packr_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package packr - -import "github.com/gobuffalo/packr/v2/file" - -func qfile(name string, body string) File { - f, err := file.NewFile(name, []byte(body)) - if err != nil { - panic(err) - } - return f -} diff --git a/v2/version.go b/v2/version.go deleted file mode 100644 index 58e0065..0000000 --- a/v2/version.go +++ /dev/null @@ -1,4 +0,0 @@ -package packr - -// Version of Packr -const Version = "v2.8.1" diff --git a/v2/walk.go b/v2/walk.go deleted file mode 100644 index 514631c..0000000 --- a/v2/walk.go +++ /dev/null @@ -1,80 +0,0 @@ -package packr - -import ( - "sort" - "strings" - - "github.com/gobuffalo/packd" - "github.com/gobuffalo/packr/v2/file" - "github.com/gobuffalo/packr/v2/file/resolver" - "github.com/gobuffalo/packr/v2/plog" -) - -// WalkFunc is used to walk a box -type WalkFunc = packd.WalkFunc - -// Walk will traverse the box and call the WalkFunc for each file in the box/folder. -func (b *Box) Walk(wf WalkFunc) error { - m := map[string]file.File{} - - dr := b.DefaultResolver - if dr == nil { - cd := resolver.OsPath(b.ResolutionDir) - dr = &resolver.Disk{Root: cd} - } - if fm, ok := dr.(file.FileMappable); ok { - for n, f := range fm.FileMap() { - m[n] = f - } - } - var err error - b.resolvers.Range(func(n string, r resolver.Resolver) bool { - var f file.File - f, err = r.Resolve("", n) - if err != nil { - return false - } - keep := true - for k := range m { - if strings.EqualFold(k, n) { - keep = false - } - } - if keep { - m[n] = f - } - return true - }) - if err != nil { - return err - } - - var keys = make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - - for _, k := range keys { - osPath := resolver.OsPath(k) - plog.Debug(b, "Walk", "path", k, "osPath", osPath) - if err := wf(osPath, m[k]); err != nil { - return err - } - } - return nil -} - -// WalkPrefix will call box.Walk and call the WalkFunc when it finds paths that have a matching prefix -func (b *Box) WalkPrefix(prefix string, wf WalkFunc) error { - ipref := resolver.OsPath(prefix) - return b.Walk(func(path string, f File) error { - ipath := resolver.OsPath(path) - if strings.HasPrefix(ipath, ipref) { - if err := wf(path, f); err != nil { - return err - } - } - return nil - }) -} diff --git a/v2/walk_test.go b/v2/walk_test.go deleted file mode 100644 index f9bb25a..0000000 --- a/v2/walk_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package packr - -import ( - "path/filepath" - "testing" - - "github.com/gobuffalo/packr/v2/file" - "github.com/stretchr/testify/require" -) - -func Test_Box_Walk(t *testing.T) { - r := require.New(t) - - box := NewBox(filepath.Join("_fixtures", "list_test")) - r.NoError(box.AddString(filepath.Join("d", "d.txt"), "D")) - - var act []string - r.NoError(box.Walk(func(path string, f file.File) error { - act = append(act, path) - return nil - })) - exp := []string{"a.txt", filepath.Join("b", "b.txt"), filepath.Join("b", "b2.txt"), filepath.Join("c", "c.txt"), filepath.Join("d", "d.txt")} - r.Equal(exp, act) -} - -func Test_Box_WalkPrefix(t *testing.T) { - r := require.New(t) - - box := NewBox(filepath.Join("_fixtures", "list_test")) - r.NoError(box.AddString(filepath.Join("d", "d.txt"), "D")) - - var act []string - r.NoError(box.WalkPrefix("b/", func(path string, f file.File) error { - act = append(act, path) - return nil - })) - exp := []string{filepath.Join("b", "b.txt"), filepath.Join("b", "b2.txt")} - r.Equal(exp, act) -} diff --git a/version.go b/version.go index db84824..58e0065 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,4 @@ package packr -const Version = "v2.5.3" +// Version of Packr +const Version = "v2.8.1" diff --git a/walk.go b/walk.go index f03f196..514631c 100644 --- a/walk.go +++ b/walk.go @@ -1,48 +1,64 @@ package packr import ( - "os" - "path/filepath" + "sort" "strings" "github.com/gobuffalo/packd" + "github.com/gobuffalo/packr/v2/file" + "github.com/gobuffalo/packr/v2/file/resolver" + "github.com/gobuffalo/packr/v2/plog" ) +// WalkFunc is used to walk a box type WalkFunc = packd.WalkFunc // Walk will traverse the box and call the WalkFunc for each file in the box/folder. -func (b Box) Walk(wf WalkFunc) error { - if data[b.Path] == nil { - base, err := filepath.EvalSymlinks(filepath.Join(b.callingDir, b.Path)) +func (b *Box) Walk(wf WalkFunc) error { + m := map[string]file.File{} + + dr := b.DefaultResolver + if dr == nil { + cd := resolver.OsPath(b.ResolutionDir) + dr = &resolver.Disk{Root: cd} + } + if fm, ok := dr.(file.FileMappable); ok { + for n, f := range fm.FileMap() { + m[n] = f + } + } + var err error + b.resolvers.Range(func(n string, r resolver.Resolver) bool { + var f file.File + f, err = r.Resolve("", n) if err != nil { - return err + return false } - return filepath.Walk(base, func(path string, info os.FileInfo, err error) error { - cleanName, err := filepath.Rel(base, path) - if err != nil { - cleanName = strings.TrimPrefix(path, base) - } - cleanName = filepath.ToSlash(filepath.Clean(cleanName)) - cleanName = strings.TrimPrefix(cleanName, "/") - cleanName = filepath.FromSlash(cleanName) - if info == nil || info.IsDir() { - return nil + keep := true + for k := range m { + if strings.EqualFold(k, n) { + keep = false } + } + if keep { + m[n] = f + } + return true + }) + if err != nil { + return err + } - file, err := fileFor(path, cleanName) - if err != nil { - return err - } - return wf(cleanName, file) - }) + var keys = make([]string, 0, len(m)) + for k := range m { + keys = append(keys, k) } - for n := range data[b.Path] { - f, err := b.find(n) - if err != nil { - return err - } - err = wf(n, f) - if err != nil { + sort.Strings(keys) + + for _, k := range keys { + osPath := resolver.OsPath(k) + plog.Debug(b, "Walk", "path", k, "osPath", osPath) + if err := wf(osPath, m[k]); err != nil { return err } } @@ -50,10 +66,11 @@ func (b Box) Walk(wf WalkFunc) error { } // WalkPrefix will call box.Walk and call the WalkFunc when it finds paths that have a matching prefix -func (b Box) WalkPrefix(prefix string, wf WalkFunc) error { - opre := osPath(prefix) +func (b *Box) WalkPrefix(prefix string, wf WalkFunc) error { + ipref := resolver.OsPath(prefix) return b.Walk(func(path string, f File) error { - if strings.HasPrefix(osPath(path), opre) { + ipath := resolver.OsPath(path) + if strings.HasPrefix(ipath, ipref) { if err := wf(path, f); err != nil { return err } diff --git a/walk_test.go b/walk_test.go index 2645437..f9bb25a 100644 --- a/walk_test.go +++ b/walk_test.go @@ -1,55 +1,39 @@ package packr import ( + "path/filepath" "testing" + "github.com/gobuffalo/packr/v2/file" "github.com/stretchr/testify/require" ) -func Test_Box_Walk_Physical(t *testing.T) { +func Test_Box_Walk(t *testing.T) { r := require.New(t) - count := 0 - err := testBox.Walk(func(path string, f File) error { - count++ - return nil - }) - r.NoError(err) - r.Equal(3, count) -} -func Test_Box_Walk_Virtual(t *testing.T) { - r := require.New(t) - count := 0 - err := virtualBox.Walk(func(path string, f File) error { - count++ - return nil - }) - r.NoError(err) - r.Equal(4, count) -} + box := NewBox(filepath.Join("_fixtures", "list_test")) + r.NoError(box.AddString(filepath.Join("d", "d.txt"), "D")) -func Test_Box_WalkPrefix_Physical(t *testing.T) { - r := require.New(t) - var files []string - b := NewBox("../packr/fixtures") - err := b.WalkPrefix("foo/", func(path string, f File) error { - files = append(files, path) + var act []string + r.NoError(box.Walk(func(path string, f file.File) error { + act = append(act, path) return nil - }) - r.NoError(err) - r.Equal(2, len(files)) - mustHave := osPaths("foo/a.txt", "foo/bar/b.txt") - r.Equal(mustHave, files) + })) + exp := []string{"a.txt", filepath.Join("b", "b.txt"), filepath.Join("b", "b2.txt"), filepath.Join("c", "c.txt"), filepath.Join("d", "d.txt")} + r.Equal(exp, act) } -func Test_Box_WalkPrefix_Virtual(t *testing.T) { +func Test_Box_WalkPrefix(t *testing.T) { r := require.New(t) - var files []string - err := virtualBox.WalkPrefix("d", func(path string, f File) error { - files = append(files, path) + + box := NewBox(filepath.Join("_fixtures", "list_test")) + r.NoError(box.AddString(filepath.Join("d", "d.txt"), "D")) + + var act []string + r.NoError(box.WalkPrefix("b/", func(path string, f file.File) error { + act = append(act, path) return nil - }) - r.NoError(err) - r.Equal(1, len(files)) - r.Equal([]string{"d/a"}, files) + })) + exp := []string{filepath.Join("b", "b.txt"), filepath.Join("b", "b2.txt")} + r.Equal(exp, act) }