From 07d2d17306f4133799c54bba51d47da0d4817cfd Mon Sep 17 00:00:00 2001 From: Andrei Mihu Date: Sun, 30 Dec 2018 15:42:47 +0000 Subject: [PATCH] Update 'packr' dependency. --- Gopkg.lock | 58 +- Gopkg.toml | 2 +- migrate/migrate.go | 4 +- vendor/github.com/gobuffalo/envy/.env | 5 + vendor/github.com/gobuffalo/envy/.gitignore | 29 + .../gobuffalo/envy/.gometalinter.json | 3 + vendor/github.com/gobuffalo/envy/.travis.yml | 36 + vendor/github.com/gobuffalo/envy/LICENSE.txt | 8 + vendor/github.com/gobuffalo/envy/Makefile | 46 + vendor/github.com/gobuffalo/envy/README.md | 93 ++ vendor/github.com/gobuffalo/envy/envy.go | 257 ++++++ vendor/github.com/gobuffalo/envy/envy_test.go | 208 +++++ vendor/github.com/gobuffalo/envy/go.mod | 13 + vendor/github.com/gobuffalo/envy/go.sum | 346 +++++++ .../gobuffalo/envy/packrd/packed-packr.go | 21 + vendor/github.com/gobuffalo/envy/shoulders.md | 16 + .../github.com/gobuffalo/envy/test_env/.env | 3 + .../gobuffalo/envy/test_env/.env.prod | 1 + vendor/github.com/gobuffalo/envy/version.go | 3 + vendor/github.com/gobuffalo/packd/.gitignore | 30 + .../gobuffalo/packd/.gometalinter.json | 3 + vendor/github.com/gobuffalo/packd/.travis.yml | 36 + vendor/github.com/gobuffalo/packd/LICENSE | 21 + vendor/github.com/gobuffalo/packd/Makefile | 57 ++ vendor/github.com/gobuffalo/packd/README.md | 24 + vendor/github.com/gobuffalo/packd/file.go | 128 +++ .../gobuffalo/{packr => packd}/file_info.go | 13 +- .../github.com/gobuffalo/packd/file_test.go | 106 +++ vendor/github.com/gobuffalo/packd/go.mod | 7 + vendor/github.com/gobuffalo/packd/go.sum | 10 + .../github.com/gobuffalo/packd/interfaces.go | 83 ++ .../github.com/gobuffalo/packd/memory_box.go | 157 ++++ .../gobuffalo/packd/memory_box_test.go | 165 ++++ .../github.com/gobuffalo/packd/skip_walker.go | 45 + .../gobuffalo/packd/skip_walker_test.go | 42 + vendor/github.com/gobuffalo/packd/version.go | 4 + vendor/github.com/gobuffalo/packr/.gitignore | 3 + .../gobuffalo/packr/.gometalinter.json | 3 + .../gobuffalo/packr/.goreleaser.yml | 89 +- .../gobuffalo/packr/.goreleaser.yml.plush | 29 + vendor/github.com/gobuffalo/packr/.travis.yml | 38 +- vendor/github.com/gobuffalo/packr/Makefile | 64 ++ vendor/github.com/gobuffalo/packr/README.md | 102 +- .../github.com/gobuffalo/packr/SHOULDERS.md | 26 + vendor/github.com/gobuffalo/packr/box.go | 110 +-- vendor/github.com/gobuffalo/packr/box_test.go | 62 +- .../gobuffalo/packr/builder/builder.go | 9 +- .../gobuffalo/packr/builder/builder_test.go | 28 +- .../gobuffalo/packr/builder/clean.go | 46 +- .../gobuffalo/packr/builder/tmpl.go | 4 +- vendor/github.com/gobuffalo/packr/env.go | 20 +- .../gobuffalo/packr/example/bar/sub/sub.html | 0 .../gobuffalo/packr/example/example.go | 1 - vendor/github.com/gobuffalo/packr/file.go | 14 +- .../gobuffalo/packr/fixtures/MyFile.txt | 1 + .../gobuffalo/packr/fixtures/foo/a.txt | 0 .../gobuffalo/packr/fixtures/foo/bar/b.txt | 0 vendor/github.com/gobuffalo/packr/go.mod | 12 +- vendor/github.com/gobuffalo/packr/go.sum | 388 ++++++++ .../gobuffalo/packr/grifts/release.go | 51 - .../gobuffalo/packr/http_box_test.go | 23 + vendor/github.com/gobuffalo/packr/packr.go | 19 + .../gobuffalo/packr/packr/cmd/version.go | 20 + .../github.com/gobuffalo/packr/packr_test.go | 8 +- .../gobuffalo/packr/physical_file.go | 13 - vendor/github.com/gobuffalo/packr/travis.sh | 8 + .../gobuffalo/packr/v2/.gometalinter.json | 3 + .../gobuffalo/packr/v2/.goreleaser.yml | 27 + .../gobuffalo/packr/v2/.goreleaser.yml.plush | 29 + .../github.com/gobuffalo/packr/v2/LICENSE.txt | 8 + vendor/github.com/gobuffalo/packr/v2/Makefile | 47 + .../github.com/gobuffalo/packr/v2/README.md | 172 ++++ .../gobuffalo/packr/v2/SHOULDERS.md | 84 ++ .../packr/v2/_fixtures/list_test/a.txt | 0 .../packr/v2/_fixtures/list_test/b/b.txt | 0 .../packr/v2/_fixtures/list_test/b/b2.txt | 0 .../packr/v2/_fixtures/list_test/c/c.txt | 0 .../packr/v2/_fixtures/templates/foo.txt | 1 + vendor/github.com/gobuffalo/packr/v2/box.go | 247 +++++ .../github.com/gobuffalo/packr/v2/box_map.go | 73 ++ .../gobuffalo/packr/v2/box_map_test.go | 55 ++ .../github.com/gobuffalo/packr/v2/box_test.go | 209 +++++ .../gobuffalo/packr/v2/deprecated.go | 79 ++ .../gobuffalo/packr/v2/deprecated_test.go | 46 + .../gobuffalo/packr/v2/file/file.go | 32 + .../gobuffalo/packr/v2/file/info.go | 38 + .../file/resolver/_fixtures/templates/foo.txt | 1 + .../gobuffalo/packr/v2/file/resolver/disk.go | 81 ++ .../packr/v2/file/resolver/disk_test.go | 28 + .../v2/file/resolver/encoding/hex/hex.go | 315 +++++++ .../packr/v2/file/resolver/hex_gzip.go | 113 +++ .../packr/v2/file/resolver/hex_gzip_test.go | 40 + .../gobuffalo/packr/v2/file/resolver/ident.go | 21 + .../packr/v2/file/resolver/ident_test.go | 33 + .../packr/v2/file/resolver/in_memory.go | 64 ++ .../packr/v2/file/resolver/in_memory_test.go | 30 + .../packr/v2/file/resolver/packable.go | 7 + .../packr/v2/file/resolver/resolver.go | 33 + .../packr/v2/file/resolver/resolver_test.go | 11 + vendor/github.com/gobuffalo/packr/v2/go.mod | 19 + vendor/github.com/gobuffalo/packr/v2/go.sum | 387 ++++++++ .../gobuffalo/packr/v2/http_box_test.go | 110 +++ .../parser/_fixtures/new_from_roots/_r/r.go | 7 + .../parser/_fixtures/new_from_roots/e/e.go | 8 + .../jam/parser/_fixtures/new_from_roots/q.go | 7 + .../parser/_fixtures/new_from_roots/w/w.go | 5 + .../gobuffalo/packr/v2/jam/parser/args.go | 53 ++ .../gobuffalo/packr/v2/jam/parser/box.go | 40 + .../gobuffalo/packr/v2/jam/parser/file.go | 54 ++ .../gobuffalo/packr/v2/jam/parser/finder.go | 101 ++ .../gobuffalo/packr/v2/jam/parser/parser.go | 47 + .../packr/v2/jam/parser/parser_test.go | 64 ++ .../gobuffalo/packr/v2/jam/parser/prospect.go | 77 ++ .../packr/v2/jam/parser/prospect_test.go | 38 + .../gobuffalo/packr/v2/jam/parser/roots.go | 90 ++ .../gobuffalo/packr/v2/jam/parser/visitor.go | 326 +++++++ .../packr/v2/jam/parser/visitor_test.go | 76 ++ .../v2/jam/store/_fixtures/disk-pack/a/a.go | 7 + .../v2/jam/store/_fixtures/disk-pack/b/b.go | 8 + .../v2/jam/store/_fixtures/disk-pack/c/d.txt | 1 + .../v2/jam/store/_fixtures/disk-pack/c/e.txt | 1 + .../v2/jam/store/_fixtures/disk-pack/c/f.txt | 1 + .../v2/jam/store/_fixtures/disk-pack/go.mod | 6 + .../v2/jam/store/_fixtures/disk-pack/go.sum | 291 ++++++ .../packr/v2/jam/store/_fixtures/disk/_r/r.go | 7 + .../packr/v2/jam/store/_fixtures/disk/e/e.go | 8 + .../disk/e/heartbreakers/refugee.txt | 1 + .../store/_fixtures/disk/e/petty/fallin.txt | 1 + .../store/_fixtures/disk/franklin/aretha.txt | 1 + .../store/_fixtures/disk/franklin/think.txt | 1 + .../packr/v2/jam/store/_fixtures/disk/q.go | 7 + .../packr/v2/jam/store/_fixtures/disk/w/w.go | 5 + .../gobuffalo/packr/v2/jam/store/clean.go | 76 ++ .../gobuffalo/packr/v2/jam/store/disk.go | 323 +++++++ .../packr/v2/jam/store/disk_packed_test.go | 32 + .../gobuffalo/packr/v2/jam/store/disk_test.go | 142 +++ .../gobuffalo/packr/v2/jam/store/disk_tmpl.go | 50 + .../gobuffalo/packr/v2/jam/store/env.go | 39 + .../gobuffalo/packr/v2/jam/store/fn.go | 44 + .../gobuffalo/packr/v2/jam/store/legacy.go | 140 +++ .../packr/v2/jam/store/legacy_test.go | 67 ++ .../gobuffalo/packr/v2/jam/store/store.go | 12 + .../packr/v2/jam/store/store_test.go | 1 + vendor/github.com/gobuffalo/packr/v2/packr.go | 55 ++ .../gobuffalo/packr/v2/packr2/LICENSE | 21 + .../gobuffalo/packr/v2/packr2/cmd/build.go | 30 + .../gobuffalo/packr/v2/packr2/cmd/clean.go | 35 + .../gobuffalo/packr/v2/packr2/cmd/fix.go | 23 + .../gobuffalo/packr/v2/packr2/cmd/fix/fix.go | 53 ++ .../packr/v2/packr2/cmd/fix/imports.go | 252 +++++ .../packr/v2/packr2/cmd/fix/runner.go | 48 + .../gobuffalo/packr/v2/packr2/cmd/gocmd.go | 64 ++ .../gobuffalo/packr/v2/packr2/cmd/install.go | 30 + .../gobuffalo/packr/v2/packr2/cmd/pack.go | 80 ++ .../gobuffalo/packr/v2/packr2/cmd/root.go | 63 ++ .../gobuffalo/packr/v2/packr2/cmd/version.go | 21 + .../gobuffalo/packr/v2/packr2/main.go | 7 + .../gobuffalo/packr/v2/packr_test.go | 11 + .../gobuffalo/packr/v2/plog/plog.go | 41 + .../github.com/gobuffalo/packr/v2/pointer.go | 29 + .../gobuffalo/packr/v2/pointer_test.go | 24 + .../github.com/gobuffalo/packr/v2/travis.sh | 7 + .../github.com/gobuffalo/packr/v2/version.go | 3 + vendor/github.com/gobuffalo/packr/v2/walk.go | 77 ++ .../gobuffalo/packr/v2/walk_test.go | 39 + vendor/github.com/gobuffalo/packr/version.go | 3 + .../gobuffalo/packr/virtual_file.go | 57 -- vendor/github.com/gobuffalo/packr/walk.go | 64 ++ .../github.com/gobuffalo/packr/walk_test.go | 55 ++ vendor/github.com/gobuffalo/syncx/.gitignore | 29 + .../gobuffalo/syncx/.gometalinter.json | 3 + vendor/github.com/gobuffalo/syncx/.travis.yml | 36 + vendor/github.com/gobuffalo/syncx/LICENSE | 21 + vendor/github.com/gobuffalo/syncx/Makefile | 52 ++ vendor/github.com/gobuffalo/syncx/README.md | 18 + vendor/github.com/gobuffalo/syncx/byte_map.go | 73 ++ .../gobuffalo/syncx/byte_map_test.go | 55 ++ vendor/github.com/gobuffalo/syncx/go.mod | 7 + vendor/github.com/gobuffalo/syncx/go.sum | 6 + vendor/github.com/gobuffalo/syncx/int_map.go | 73 ++ .../gobuffalo/syncx/int_map_test.go | 55 ++ .../gobuffalo/syncx/interface_map.go | 73 ++ .../gobuffalo/syncx/interface_map_test.go | 55 ++ .../github.com/gobuffalo/syncx/string_map.go | 73 ++ .../gobuffalo/syncx/string_map_test.go | 55 ++ vendor/github.com/gobuffalo/syncx/version.go | 4 + vendor/github.com/joho/godotenv/.gitignore | 1 + vendor/github.com/joho/godotenv/.travis.yml | 8 + vendor/github.com/joho/godotenv/LICENCE | 23 + vendor/github.com/joho/godotenv/README.md | 163 ++++ .../joho/godotenv/autoload/autoload.go | 15 + .../joho/godotenv/cmd/godotenv/cmd.go | 54 ++ .../joho/godotenv/fixtures/equals.env | 2 + .../joho/godotenv/fixtures/exported.env | 2 + .../joho/godotenv/fixtures/invalid1.env | 2 + .../joho/godotenv/fixtures/plain.env | 7 + .../joho/godotenv/fixtures/quoted.env | 9 + .../joho/godotenv/fixtures/substitutions.env | 5 + vendor/github.com/joho/godotenv/godotenv.go | 346 +++++++ .../github.com/joho/godotenv/godotenv_test.go | 456 +++++++++ vendor/github.com/markbates/oncer/.gitignore | 29 + vendor/github.com/markbates/oncer/LICENSE | 21 + vendor/github.com/markbates/oncer/Makefile | 40 + .../github.com/markbates/oncer/deprecate.go | 20 + .../markbates/oncer/deprecate_test.go | 32 + vendor/github.com/markbates/oncer/go.mod | 7 + vendor/github.com/markbates/oncer/go.sum | 6 + vendor/github.com/markbates/oncer/log.go | 7 + .../github.com/markbates/oncer/log_debug.go | 19 + vendor/github.com/markbates/oncer/oncer.go | 26 + .../github.com/markbates/oncer/oncer_test.go | 61 ++ .../rogpeppe/go-internal/.travis.yml | 12 + .../github.com/rogpeppe/go-internal/README.md | 16 + .../go-internal/cmd/txtar-addmod/addmod.go | 160 ++++ .../cmd/txtar-addmod/script_test.go | 49 + ...com_gobin-testrepos_simple-main_v1.0.0.txt | 16 + .../testdata/txtar-addmod-self.txt | 5 + .../go-internal/cmd/txtar-goproxy/main.go | 47 + .../go-internal/cmd/txtar-savedir/savedir.go | 84 ++ .../cmd/txtar-savedir/script_test.go | 19 + .../testdata/txtar-savedir-self.txt | 19 + .../rogpeppe/go-internal/dirhash/hash.go | 103 +++ .../rogpeppe/go-internal/dirhash/hash_test.go | 135 +++ vendor/github.com/rogpeppe/go-internal/go.mod | 3 + vendor/github.com/rogpeppe/go-internal/go.sum | 9 + .../go-internal/goproxytest/allhex.go | 19 + .../rogpeppe/go-internal/goproxytest/proxy.go | 287 ++++++ .../go-internal/goproxytest/pseudo.go | 21 + .../rogpeppe/go-internal/gotooltest/setup.go | 140 +++ .../rogpeppe/go-internal/imports/build.go | 211 +++++ .../rogpeppe/go-internal/imports/read.go | 249 +++++ .../rogpeppe/go-internal/imports/read_test.go | 228 +++++ .../rogpeppe/go-internal/imports/scan.go | 96 ++ .../rogpeppe/go-internal/imports/scan_test.go | 68 ++ .../go-internal/imports/testdata/import1/x.go | 3 + .../imports/testdata/import1/x1.go | 9 + .../imports/testdata/import1/x_darwin.go | 3 + .../imports/testdata/import1/x_windows.go | 3 + .../rogpeppe/go-internal/modfile/gopkgin.go | 47 + .../rogpeppe/go-internal/modfile/print.go | 164 ++++ .../rogpeppe/go-internal/modfile/read.go | 869 ++++++++++++++++++ .../rogpeppe/go-internal/modfile/read_test.go | 365 ++++++++ .../rogpeppe/go-internal/modfile/rule.go | 724 +++++++++++++++ .../rogpeppe/go-internal/modfile/rule_test.go | 90 ++ .../go-internal/modfile/testdata/block.golden | 29 + .../go-internal/modfile/testdata/block.in | 29 + .../modfile/testdata/comment.golden | 10 + .../go-internal/modfile/testdata/comment.in | 8 + .../go-internal/modfile/testdata/empty.golden | 0 .../go-internal/modfile/testdata/empty.in | 0 .../modfile/testdata/gopkg.in.golden | 6 + .../modfile/testdata/module.golden | 1 + .../go-internal/modfile/testdata/module.in | 1 + .../modfile/testdata/replace.golden | 5 + .../go-internal/modfile/testdata/replace.in | 5 + .../modfile/testdata/replace2.golden | 10 + .../go-internal/modfile/testdata/replace2.in | 10 + .../go-internal/modfile/testdata/rule1.golden | 7 + .../rogpeppe/go-internal/module/module.go | 540 +++++++++++ .../go-internal/module/module_test.go | 318 +++++++ .../rogpeppe/go-internal/par/work.go | 149 +++ .../rogpeppe/go-internal/par/work_test.go | 77 ++ .../rogpeppe/go-internal/semver/semver.go | 388 ++++++++ .../go-internal/semver/semver_test.go | 182 ++++ .../rogpeppe/go-internal/testenv/testenv.go | 248 +++++ .../go-internal/testenv/testenv_cgo.go | 11 + .../go-internal/testenv/testenv_notwin.go | 20 + .../go-internal/testenv/testenv_windows.go | 48 + .../rogpeppe/go-internal/testscript/cmd.go | 377 ++++++++ .../rogpeppe/go-internal/testscript/cover.go | 272 ++++++ .../rogpeppe/go-internal/testscript/doc.go | 282 ++++++ .../rogpeppe/go-internal/testscript/exe.go | 203 ++++ .../testscript/scripts/command.txt | 2 + .../testscript/scripts/commandstatus.txt | 3 + .../testscript/scripts/execguard.txt | 6 + .../go-internal/testscript/scripts/exists.txt | 12 + .../go-internal/testscript/scripts/hello.txt | 7 + .../go-internal/testscript/testscript.go | 577 ++++++++++++ .../go-internal/testscript/testscript_test.go | 71 ++ .../rogpeppe/go-internal/txtar/archive.go | 140 +++ .../go-internal/txtar/archive_test.go | 67 ++ 281 files changed, 19210 insertions(+), 407 deletions(-) create mode 100644 vendor/github.com/gobuffalo/envy/.env create mode 100644 vendor/github.com/gobuffalo/envy/.gitignore create mode 100644 vendor/github.com/gobuffalo/envy/.gometalinter.json create mode 100644 vendor/github.com/gobuffalo/envy/.travis.yml create mode 100644 vendor/github.com/gobuffalo/envy/LICENSE.txt create mode 100644 vendor/github.com/gobuffalo/envy/Makefile create mode 100644 vendor/github.com/gobuffalo/envy/README.md create mode 100644 vendor/github.com/gobuffalo/envy/envy.go create mode 100644 vendor/github.com/gobuffalo/envy/envy_test.go create mode 100644 vendor/github.com/gobuffalo/envy/go.mod create mode 100644 vendor/github.com/gobuffalo/envy/go.sum create mode 100644 vendor/github.com/gobuffalo/envy/packrd/packed-packr.go create mode 100644 vendor/github.com/gobuffalo/envy/shoulders.md create mode 100644 vendor/github.com/gobuffalo/envy/test_env/.env create mode 100644 vendor/github.com/gobuffalo/envy/test_env/.env.prod create mode 100644 vendor/github.com/gobuffalo/envy/version.go create mode 100644 vendor/github.com/gobuffalo/packd/.gitignore create mode 100644 vendor/github.com/gobuffalo/packd/.gometalinter.json create mode 100644 vendor/github.com/gobuffalo/packd/.travis.yml create mode 100644 vendor/github.com/gobuffalo/packd/LICENSE create mode 100644 vendor/github.com/gobuffalo/packd/Makefile create mode 100644 vendor/github.com/gobuffalo/packd/README.md create mode 100644 vendor/github.com/gobuffalo/packd/file.go rename vendor/github.com/gobuffalo/{packr => packd}/file_info.go (77%) create mode 100644 vendor/github.com/gobuffalo/packd/file_test.go create mode 100644 vendor/github.com/gobuffalo/packd/go.mod create mode 100644 vendor/github.com/gobuffalo/packd/go.sum create mode 100644 vendor/github.com/gobuffalo/packd/interfaces.go create mode 100644 vendor/github.com/gobuffalo/packd/memory_box.go create mode 100644 vendor/github.com/gobuffalo/packd/memory_box_test.go create mode 100644 vendor/github.com/gobuffalo/packd/skip_walker.go create mode 100644 vendor/github.com/gobuffalo/packd/skip_walker_test.go create mode 100644 vendor/github.com/gobuffalo/packd/version.go create mode 100644 vendor/github.com/gobuffalo/packr/.gometalinter.json create mode 100644 vendor/github.com/gobuffalo/packr/.goreleaser.yml.plush create mode 100644 vendor/github.com/gobuffalo/packr/Makefile create mode 100644 vendor/github.com/gobuffalo/packr/SHOULDERS.md create mode 100644 vendor/github.com/gobuffalo/packr/example/bar/sub/sub.html create mode 100644 vendor/github.com/gobuffalo/packr/fixtures/MyFile.txt create mode 100644 vendor/github.com/gobuffalo/packr/fixtures/foo/a.txt create mode 100644 vendor/github.com/gobuffalo/packr/fixtures/foo/bar/b.txt create mode 100644 vendor/github.com/gobuffalo/packr/go.sum delete mode 100644 vendor/github.com/gobuffalo/packr/grifts/release.go create mode 100644 vendor/github.com/gobuffalo/packr/packr/cmd/version.go delete mode 100644 vendor/github.com/gobuffalo/packr/physical_file.go create mode 100755 vendor/github.com/gobuffalo/packr/travis.sh create mode 100644 vendor/github.com/gobuffalo/packr/v2/.gometalinter.json create mode 100644 vendor/github.com/gobuffalo/packr/v2/.goreleaser.yml create mode 100644 vendor/github.com/gobuffalo/packr/v2/.goreleaser.yml.plush create mode 100644 vendor/github.com/gobuffalo/packr/v2/LICENSE.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/Makefile create mode 100644 vendor/github.com/gobuffalo/packr/v2/README.md create mode 100644 vendor/github.com/gobuffalo/packr/v2/SHOULDERS.md create mode 100644 vendor/github.com/gobuffalo/packr/v2/_fixtures/list_test/a.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/_fixtures/list_test/b/b.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/_fixtures/list_test/b/b2.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/_fixtures/list_test/c/c.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/_fixtures/templates/foo.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/box.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/box_map.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/box_map_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/box_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/deprecated.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/deprecated_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/file.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/info.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/_fixtures/templates/foo.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/disk.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/disk_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/encoding/hex/hex.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/hex_gzip.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/hex_gzip_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/ident.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/ident_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/in_memory.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/in_memory_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/packable.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/resolver.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/file/resolver/resolver_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/go.mod create mode 100644 vendor/github.com/gobuffalo/packr/v2/go.sum create mode 100644 vendor/github.com/gobuffalo/packr/v2/http_box_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/_r/r.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/e/e.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/q.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/w/w.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/args.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/box.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/file.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/finder.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/parser.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/parser_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/prospect.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/prospect_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/roots.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/visitor.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/parser/visitor_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/a/a.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/b/b.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/c/d.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/c/e.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/c/f.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/go.mod create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/go.sum create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/_r/r.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/e/e.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/e/heartbreakers/refugee.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/e/petty/fallin.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/franklin/aretha.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/franklin/think.txt create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/q.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/w/w.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/clean.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/disk.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/disk_packed_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/disk_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/disk_tmpl.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/env.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/fn.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/legacy.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/legacy_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/store.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/jam/store/store_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/LICENSE create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/cmd/build.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/cmd/clean.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix/fix.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix/imports.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix/runner.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/cmd/gocmd.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/cmd/install.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/cmd/pack.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/cmd/root.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/cmd/version.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr2/main.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/packr_test.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/plog/plog.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/pointer.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/pointer_test.go create mode 100755 vendor/github.com/gobuffalo/packr/v2/travis.sh create mode 100644 vendor/github.com/gobuffalo/packr/v2/version.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/walk.go create mode 100644 vendor/github.com/gobuffalo/packr/v2/walk_test.go create mode 100644 vendor/github.com/gobuffalo/packr/version.go delete mode 100644 vendor/github.com/gobuffalo/packr/virtual_file.go create mode 100644 vendor/github.com/gobuffalo/packr/walk.go create mode 100644 vendor/github.com/gobuffalo/packr/walk_test.go create mode 100644 vendor/github.com/gobuffalo/syncx/.gitignore create mode 100644 vendor/github.com/gobuffalo/syncx/.gometalinter.json create mode 100644 vendor/github.com/gobuffalo/syncx/.travis.yml create mode 100644 vendor/github.com/gobuffalo/syncx/LICENSE create mode 100644 vendor/github.com/gobuffalo/syncx/Makefile create mode 100644 vendor/github.com/gobuffalo/syncx/README.md create mode 100644 vendor/github.com/gobuffalo/syncx/byte_map.go create mode 100644 vendor/github.com/gobuffalo/syncx/byte_map_test.go create mode 100644 vendor/github.com/gobuffalo/syncx/go.mod create mode 100644 vendor/github.com/gobuffalo/syncx/go.sum create mode 100644 vendor/github.com/gobuffalo/syncx/int_map.go create mode 100644 vendor/github.com/gobuffalo/syncx/int_map_test.go create mode 100644 vendor/github.com/gobuffalo/syncx/interface_map.go create mode 100644 vendor/github.com/gobuffalo/syncx/interface_map_test.go create mode 100644 vendor/github.com/gobuffalo/syncx/string_map.go create mode 100644 vendor/github.com/gobuffalo/syncx/string_map_test.go create mode 100644 vendor/github.com/gobuffalo/syncx/version.go create mode 100644 vendor/github.com/joho/godotenv/.gitignore create mode 100644 vendor/github.com/joho/godotenv/.travis.yml create mode 100644 vendor/github.com/joho/godotenv/LICENCE create mode 100644 vendor/github.com/joho/godotenv/README.md create mode 100644 vendor/github.com/joho/godotenv/autoload/autoload.go create mode 100644 vendor/github.com/joho/godotenv/cmd/godotenv/cmd.go create mode 100644 vendor/github.com/joho/godotenv/fixtures/equals.env create mode 100644 vendor/github.com/joho/godotenv/fixtures/exported.env create mode 100644 vendor/github.com/joho/godotenv/fixtures/invalid1.env create mode 100644 vendor/github.com/joho/godotenv/fixtures/plain.env create mode 100644 vendor/github.com/joho/godotenv/fixtures/quoted.env create mode 100644 vendor/github.com/joho/godotenv/fixtures/substitutions.env create mode 100644 vendor/github.com/joho/godotenv/godotenv.go create mode 100644 vendor/github.com/joho/godotenv/godotenv_test.go create mode 100644 vendor/github.com/markbates/oncer/.gitignore create mode 100644 vendor/github.com/markbates/oncer/LICENSE create mode 100644 vendor/github.com/markbates/oncer/Makefile create mode 100644 vendor/github.com/markbates/oncer/deprecate.go create mode 100644 vendor/github.com/markbates/oncer/deprecate_test.go create mode 100644 vendor/github.com/markbates/oncer/go.mod create mode 100644 vendor/github.com/markbates/oncer/go.sum create mode 100644 vendor/github.com/markbates/oncer/log.go create mode 100644 vendor/github.com/markbates/oncer/log_debug.go create mode 100644 vendor/github.com/markbates/oncer/oncer.go create mode 100644 vendor/github.com/markbates/oncer/oncer_test.go create mode 100644 vendor/github.com/rogpeppe/go-internal/.travis.yml create mode 100644 vendor/github.com/rogpeppe/go-internal/README.md create mode 100644 vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/addmod.go create mode 100644 vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/script_test.go create mode 100644 vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/testdata/mod/github.com_gobin-testrepos_simple-main_v1.0.0.txt create mode 100644 vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/testdata/txtar-addmod-self.txt create mode 100644 vendor/github.com/rogpeppe/go-internal/cmd/txtar-goproxy/main.go create mode 100644 vendor/github.com/rogpeppe/go-internal/cmd/txtar-savedir/savedir.go create mode 100644 vendor/github.com/rogpeppe/go-internal/cmd/txtar-savedir/script_test.go create mode 100644 vendor/github.com/rogpeppe/go-internal/cmd/txtar-savedir/testdata/txtar-savedir-self.txt create mode 100644 vendor/github.com/rogpeppe/go-internal/dirhash/hash.go create mode 100644 vendor/github.com/rogpeppe/go-internal/dirhash/hash_test.go create mode 100644 vendor/github.com/rogpeppe/go-internal/go.mod create mode 100644 vendor/github.com/rogpeppe/go-internal/go.sum create mode 100644 vendor/github.com/rogpeppe/go-internal/goproxytest/allhex.go create mode 100644 vendor/github.com/rogpeppe/go-internal/goproxytest/proxy.go create mode 100644 vendor/github.com/rogpeppe/go-internal/goproxytest/pseudo.go create mode 100644 vendor/github.com/rogpeppe/go-internal/gotooltest/setup.go create mode 100644 vendor/github.com/rogpeppe/go-internal/imports/build.go create mode 100644 vendor/github.com/rogpeppe/go-internal/imports/read.go create mode 100644 vendor/github.com/rogpeppe/go-internal/imports/read_test.go create mode 100644 vendor/github.com/rogpeppe/go-internal/imports/scan.go create mode 100644 vendor/github.com/rogpeppe/go-internal/imports/scan_test.go create mode 100644 vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x.go create mode 100644 vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x1.go create mode 100644 vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x_darwin.go create mode 100644 vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x_windows.go create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/gopkgin.go create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/print.go create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/read.go create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/read_test.go create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/rule.go create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/rule_test.go create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/block.golden create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/block.in create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/comment.golden create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/comment.in create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/empty.golden create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/empty.in create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/gopkg.in.golden create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/module.golden create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/module.in create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace.golden create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace.in create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace2.golden create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace2.in create mode 100644 vendor/github.com/rogpeppe/go-internal/modfile/testdata/rule1.golden create mode 100644 vendor/github.com/rogpeppe/go-internal/module/module.go create mode 100644 vendor/github.com/rogpeppe/go-internal/module/module_test.go create mode 100644 vendor/github.com/rogpeppe/go-internal/par/work.go create mode 100644 vendor/github.com/rogpeppe/go-internal/par/work_test.go create mode 100644 vendor/github.com/rogpeppe/go-internal/semver/semver.go create mode 100644 vendor/github.com/rogpeppe/go-internal/semver/semver_test.go create mode 100644 vendor/github.com/rogpeppe/go-internal/testenv/testenv.go create mode 100644 vendor/github.com/rogpeppe/go-internal/testenv/testenv_cgo.go create mode 100644 vendor/github.com/rogpeppe/go-internal/testenv/testenv_notwin.go create mode 100644 vendor/github.com/rogpeppe/go-internal/testenv/testenv_windows.go create mode 100644 vendor/github.com/rogpeppe/go-internal/testscript/cmd.go create mode 100644 vendor/github.com/rogpeppe/go-internal/testscript/cover.go create mode 100644 vendor/github.com/rogpeppe/go-internal/testscript/doc.go create mode 100644 vendor/github.com/rogpeppe/go-internal/testscript/exe.go create mode 100644 vendor/github.com/rogpeppe/go-internal/testscript/scripts/command.txt create mode 100644 vendor/github.com/rogpeppe/go-internal/testscript/scripts/commandstatus.txt create mode 100644 vendor/github.com/rogpeppe/go-internal/testscript/scripts/execguard.txt create mode 100644 vendor/github.com/rogpeppe/go-internal/testscript/scripts/exists.txt create mode 100644 vendor/github.com/rogpeppe/go-internal/testscript/scripts/hello.txt create mode 100644 vendor/github.com/rogpeppe/go-internal/testscript/testscript.go create mode 100644 vendor/github.com/rogpeppe/go-internal/testscript/testscript_test.go create mode 100644 vendor/github.com/rogpeppe/go-internal/txtar/archive.go create mode 100644 vendor/github.com/rogpeppe/go-internal/txtar/archive_test.go diff --git a/Gopkg.lock b/Gopkg.lock index 661cbc839..728adec4f 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -160,12 +160,36 @@ revision = "51d6538a90f86fe93ac480b35f37b2be17fef232" [[projects]] - digest = "1:94ab904da3a528888677f39d32f9625ea8b2d639146af9c79ff97bda3e8554ae" + digest = "1:b0989e1ceaa5fb28ad7dcb6f21da9386124942f24e5d8e5807f967f6f56ae2b0" + name = "github.com/gobuffalo/envy" + packages = ["."] + pruneopts = "" + revision = "801d7253ade1f895f74596b9a96147ed2d3b087e" + version = "v1.6.11" + +[[projects]] + branch = "master" + digest = "1:3637ea23c1d8720d62f8400f4b3b5750b11c35baa093a97856bc6295c77cf372" + name = "github.com/gobuffalo/packd" + packages = ["."] + pruneopts = "" + revision = "eca3b8fd66872a76119b189bbe0f58f776a2a39f" + +[[projects]] + digest = "1:82c8a32555836303cadb66876d39e3adae68c969cf9de02dd6cf989ddd8823b3" name = "github.com/gobuffalo/packr" packages = ["."] pruneopts = "" - revision = "147bee9cde84aeca6693d1b1aedc595298f24d5b" - version = "v1.12.0" + revision = "679459352e18b4c74274a979d695fe13b68730c1" + version = "v1.21.9" + +[[projects]] + branch = "master" + digest = "1:6098f692e043c3ee2612f47f214d169a3bdeb13ee37f946d10353b5e37aa702b" + name = "github.com/gobuffalo/syncx" + packages = ["."] + pruneopts = "" + revision = "558ac7de985fc4f4057bff27c7bdf99e92fe0750" [[projects]] digest = "1:660175e70abad3868119f2c29f43339608d7d3b93c8eb178b812ed330be6c07b" @@ -261,6 +285,14 @@ revision = "92583770e3f01b09a0d3e9bdf64321d8bebd48f2" version = "v1.4.1" +[[projects]] + digest = "1:7df5a9695a743c3e1626b28bb8741602c8c15527e1efaeaec48ab2ff9a23f74c" + name = "github.com/joho/godotenv" + packages = ["."] + pruneopts = "" + revision = "23d116af351c84513e1946b527c88823e476be13" + version = "v1.3.0" + [[projects]] digest = "1:bc36cd980d0069137800b505af4937c6109f4dc7cefe39d7c2efc7c8d51528d6" name = "github.com/lib/pq" @@ -271,6 +303,14 @@ pruneopts = "" revision = "9eb73efc1fcc404148b56765b0d3f61d9a5ef8ee" +[[projects]] + branch = "master" + digest = "1:ff3d3a7e367bf58b25e3c9203b7e82a02b2bfa220eacb2b362c0dbc3fcffa15b" + name = "github.com/markbates/oncer" + packages = ["."] + pruneopts = "" + revision = "bf2de49a0be218916e69a11d22866e6cd0a560f2" + [[projects]] digest = "1:63722a4b1e1717be7b98fc686e0b30d5e7f734b9e93d7dee86293b6deab7ea28" name = "github.com/matttproud/golang_protobuf_extensions" @@ -354,6 +394,18 @@ pruneopts = "" revision = "05ee40e3a273f7245e8777337fc7b46e533a9a92" +[[projects]] + digest = "1:e47e8da3ae71a043c8ad101dea4e96580aaa613ff766150b799221e6c021508f" + name = "github.com/rogpeppe/go-internal" + packages = [ + "modfile", + "module", + "semver", + ] + pruneopts = "" + revision = "d87f08a7d80821c797ffc8eb8f4e01675f378736" + version = "v1.0.0" + [[projects]] digest = "1:de54c071d521d5adb97ba259392faefffc3b702f08323601fc3a7ac873a717d7" name = "github.com/rubenv/sql-migrate" diff --git a/Gopkg.toml b/Gopkg.toml index 45dd80f5e..fa91b03c8 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -52,7 +52,7 @@ [[constraint]] name = "github.com/gobuffalo/packr" - version = "~1.12.0" + version = "~1.21.9" [[override]] name = "github.com/prometheus/client_golang" diff --git a/migrate/migrate.go b/migrate/migrate.go index a5770dc47..660609145 100644 --- a/migrate/migrate.go +++ b/migrate/migrate.go @@ -55,7 +55,7 @@ func StartupCheck(logger *zap.Logger, db *sql.DB) { migrationBox := packr.NewBox("./sql") // path must be string not a variable for packr to understand ms := &migrate.AssetMigrationSource{ - Asset: migrationBox.MustBytes, + Asset: migrationBox.Find, AssetDir: func(path string) ([]string, error) { return migrationBox.List(), nil }, @@ -89,7 +89,7 @@ func Parse(args []string, logger *zap.Logger) { ms := &migrationService{ logger: logger, migrations: &migrate.AssetMigrationSource{ - Asset: migrationBox.MustBytes, + Asset: migrationBox.Find, AssetDir: func(path string) ([]string, error) { return migrationBox.List(), nil }, diff --git a/vendor/github.com/gobuffalo/envy/.env b/vendor/github.com/gobuffalo/envy/.env new file mode 100644 index 000000000..33eeb3b13 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/.env @@ -0,0 +1,5 @@ +# This is a comment +# We can use equal or colon notation +DIR: root +FLAVOUR: none +INSIDE_FOLDER=false \ No newline at end of file diff --git a/vendor/github.com/gobuffalo/envy/.gitignore b/vendor/github.com/gobuffalo/envy/.gitignore new file mode 100644 index 000000000..368971859 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/.gitignore @@ -0,0 +1,29 @@ +*.log +.DS_Store +doc +tmp +pkg +*.gem +*.pid +coverage +coverage.data +build/* +*.pbxuser +*.mode1v3 +.svn +profile +.console_history +.sass-cache/* +.rake_tasks~ +*.log.lck +solr/ +.jhw-cache/ +jhw.* +*.sublime* +node_modules/ +dist/ +generated/ +.vendor/ +bin/* +gin-bin +.idea/ diff --git a/vendor/github.com/gobuffalo/envy/.gometalinter.json b/vendor/github.com/gobuffalo/envy/.gometalinter.json new file mode 100644 index 000000000..e4f65a36e --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/.gometalinter.json @@ -0,0 +1,3 @@ +{ + "Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"] +} diff --git a/vendor/github.com/gobuffalo/envy/.travis.yml b/vendor/github.com/gobuffalo/envy/.travis.yml new file mode 100644 index 000000000..1fb041a25 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/.travis.yml @@ -0,0 +1,36 @@ +language: go + +sudo: false + +matrix: + include: + - os: linux + go: "1.9.x" + - os: windows + go: "1.9.x" + - os: linux + go: "1.10.x" + - os: windows + go: "1.10.x" + - os: linux + go: "1.11.x" + env: + - GO111MODULE=off + - os: windows + go: "1.11.x" + env: + - GO111MODULE=off + - os: linux + go: "1.11.x" + env: + - GO111MODULE=on + - os: windows + go: "1.11.x" + env: + - GO111MODULE=on + +install: false + +script: + - go get -v -t ./... + - go test -v -timeout=5s -race ./... diff --git a/vendor/github.com/gobuffalo/envy/LICENSE.txt b/vendor/github.com/gobuffalo/envy/LICENSE.txt new file mode 100644 index 000000000..123ddc0d8 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/LICENSE.txt @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2018 Mark Bates + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/gobuffalo/envy/Makefile b/vendor/github.com/gobuffalo/envy/Makefile new file mode 100644 index 000000000..b0db1c4f8 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/Makefile @@ -0,0 +1,46 @@ +TAGS ?= "sqlite" +GO_BIN ?= go + +install: + packr + $(GO_BIN) install -v . + +deps: + $(GO_BIN) get github.com/gobuffalo/release + $(GO_BIN) get github.com/gobuffalo/packr/packr + $(GO_BIN) get -tags ${TAGS} -t ./... +ifeq ($(GO111MODULE),on) + $(GO_BIN) mod tidy +endif + +build: + packr + $(GO_BIN) build -v . + +test: + packr + $(GO_BIN) test -tags ${TAGS} ./... + +ci-test: + $(GO_BIN) test -tags ${TAGS} -race ./... + +lint: + gometalinter --vendor ./... --deadline=1m --skip=internal + +update: + $(GO_BIN) get -u -tags ${TAGS} +ifeq ($(GO111MODULE),on) + $(GO_BIN) mod tidy +endif + packr + make test + make install +ifeq ($(GO111MODULE),on) + $(GO_BIN) mod tidy +endif + +release-test: + $(GO_BIN) test -tags ${TAGS} -race ./... + +release: + release -y -f version.go diff --git a/vendor/github.com/gobuffalo/envy/README.md b/vendor/github.com/gobuffalo/envy/README.md new file mode 100644 index 000000000..f54462a77 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/README.md @@ -0,0 +1,93 @@ +# envy +[![Build Status](https://travis-ci.org/gobuffalo/envy.svg?branch=master)](https://travis-ci.org/gobuffalo/envy) + +Envy makes working with ENV variables in Go trivial. + +* Get ENV variables with default values. +* Set ENV variables safely without affecting the underlying system. +* Temporarily change ENV vars; useful for testing. +* Map all of the key/values in the ENV. +* Loads .env files (by using [godotenv](https://github.com/joho/godotenv/)) +* More! + +## Installation + +```text +$ go get -u github.com/gobuffalo/envy +``` + +## Usage + +```go +func Test_Get(t *testing.T) { + r := require.New(t) + r.NotZero(os.Getenv("GOPATH")) + r.Equal(os.Getenv("GOPATH"), envy.Get("GOPATH", "foo")) + r.Equal("bar", envy.Get("IDONTEXIST", "bar")) +} + +func Test_MustGet(t *testing.T) { + r := require.New(t) + r.NotZero(os.Getenv("GOPATH")) + v, err := envy.MustGet("GOPATH") + r.NoError(err) + r.Equal(os.Getenv("GOPATH"), v) + + _, err = envy.MustGet("IDONTEXIST") + r.Error(err) +} + +func Test_Set(t *testing.T) { + r := require.New(t) + _, err := envy.MustGet("FOO") + r.Error(err) + + envy.Set("FOO", "foo") + r.Equal("foo", envy.Get("FOO", "bar")) +} + +func Test_Temp(t *testing.T) { + r := require.New(t) + + _, err := envy.MustGet("BAR") + r.Error(err) + + envy.Temp(func() { + envy.Set("BAR", "foo") + r.Equal("foo", envy.Get("BAR", "bar")) + _, err = envy.MustGet("BAR") + r.NoError(err) + }) + + _, err = envy.MustGet("BAR") + r.Error(err) +} +``` +## .env files support + +Envy now supports loading `.env` files by using the [godotenv library](https://github.com/joho/godotenv/). +That means one can use and define multiple `.env` files which will be loaded on-demand. By default, no env files will be loaded. To load one or more, you need to call the `envy.Load` function in one of the following ways: + +```go +envy.Load() // 1 + +envy.Load("MY_ENV_FILE") // 2 + +envy.Load(".env", ".env.prod") // 3 + +envy.Load(".env", "NON_EXISTING_FILE") // 4 + +// 5 +envy.Load(".env") +envy.Load("NON_EXISTING_FILE") + +// 6 +envy.Load(".env", "NON_EXISTING_FILE", ".env.prod") +``` + +1. Will load the default `.env` file +2. Will load the file `MY_ENV_FILE`, **but not** `.env` +3. Will load the file `.env`, and after that will load the `.env.prod` file. If any variable is redefined in `. env.prod` it will be overwritten (will contain the `env.prod` value) +4. Will load the `.env` file and return an error as the second file does not exist. The values in `.env` will be loaded and available. +5. Same as 4 +6. Will load the `.env` file and return an error as the second file does not exist. The values in `.env` will be loaded and available, **but the ones in** `.env.prod` **won't**. diff --git a/vendor/github.com/gobuffalo/envy/envy.go b/vendor/github.com/gobuffalo/envy/envy.go new file mode 100644 index 000000000..026d0167a --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/envy.go @@ -0,0 +1,257 @@ +/* +package envy makes working with ENV variables in Go trivial. + +* Get ENV variables with default values. +* Set ENV variables safely without affecting the underlying system. +* Temporarily change ENV vars; useful for testing. +* Map all of the key/values in the ENV. +* Loads .env files (by using [godotenv](https://github.com/joho/godotenv/)) +* More! +*/ +package envy + +import ( + "errors" + "flag" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "sync" + + "github.com/joho/godotenv" + "github.com/rogpeppe/go-internal/modfile" +) + +var gil = &sync.RWMutex{} +var env = map[string]string{} + +// GO111MODULE is ENV for turning mods on/off +const GO111MODULE = "GO111MODULE" + +func init() { + Load() + loadEnv() +} + +// Load the ENV variables to the env map +func loadEnv() { + gil.Lock() + defer gil.Unlock() + + if os.Getenv("GO_ENV") == "" { + // if the flag "test.v" is *defined*, we're running as a unit test. Note that we don't care + // about v.Value (verbose test mode); we just want to know if the test environment has defined + // it. It's also possible that the flags are not yet fully parsed (i.e. flag.Parsed() == false), + // so we could not depend on v.Value anyway. + // + if v := flag.Lookup("test.v"); v != nil { + env["GO_ENV"] = "test" + } + } + + // set the GOPATH if using >= 1.8 and the GOPATH isn't set + if os.Getenv("GOPATH") == "" { + out, err := exec.Command("go", "env", "GOPATH").Output() + if err == nil { + gp := strings.TrimSpace(string(out)) + os.Setenv("GOPATH", gp) + } + } + + for _, e := range os.Environ() { + pair := strings.Split(e, "=") + env[pair[0]] = os.Getenv(pair[0]) + } +} + +func Mods() bool { + return Get(GO111MODULE, "off") == "on" +} + +// Reload the ENV variables. Useful if +// an external ENV manager has been used +func Reload() { + env = map[string]string{} + loadEnv() +} + +// Load .env files. Files will be loaded in the same order that are received. +// Redefined vars will override previously existing values. +// IE: envy.Load(".env", "test_env/.env") will result in DIR=test_env +// If no arg passed, it will try to load a .env file. +func Load(files ...string) error { + + // If no files received, load the default one + if len(files) == 0 { + err := godotenv.Overload() + if err == nil { + Reload() + } + return err + } + + // We received a list of files + for _, file := range files { + + // Check if it exists or we can access + if _, err := os.Stat(file); err != nil { + // It does not exist or we can not access. + // Return and stop loading + return err + } + + // It exists and we have permission. Load it + if err := godotenv.Overload(file); err != nil { + return err + } + + // Reload the env so all new changes are noticed + Reload() + + } + return nil +} + +// Get a value from the ENV. If it doesn't exist the +// default value will be returned. +func Get(key string, value string) string { + gil.RLock() + defer gil.RUnlock() + if v, ok := env[key]; ok { + return v + } + return value +} + +// Get a value from the ENV. If it doesn't exist +// an error will be returned +func MustGet(key string) (string, error) { + gil.RLock() + defer gil.RUnlock() + if v, ok := env[key]; ok { + return v, nil + } + return "", fmt.Errorf("could not find ENV var with %s", key) +} + +// Set a value into the ENV. This is NOT permanent. It will +// only affect values accessed through envy. +func Set(key string, value string) { + gil.Lock() + defer gil.Unlock() + env[key] = value +} + +// MustSet the value into the underlying ENV, as well as envy. +// This may return an error if there is a problem setting the +// underlying ENV value. +func MustSet(key string, value string) error { + gil.Lock() + defer gil.Unlock() + err := os.Setenv(key, value) + if err != nil { + return err + } + env[key] = value + return nil +} + +// Map all of the keys/values set in envy. +func Map() map[string]string { + gil.RLock() + defer gil.RUnlock() + cp := map[string]string{} + for k, v := range env { + cp[k] = v + } + return env +} + +// Temp makes a copy of the values and allows operation on +// those values temporarily during the run of the function. +// At the end of the function run the copy is discarded and +// the original values are replaced. This is useful for testing. +// Warning: This function is NOT safe to use from a goroutine or +// from code which may access any Get or Set function from a goroutine +func Temp(f func()) { + oenv := env + env = map[string]string{} + for k, v := range oenv { + env[k] = v + } + defer func() { env = oenv }() + f() +} + +func GoPath() string { + return Get("GOPATH", "") +} + +func GoBin() string { + return Get("GO_BIN", "go") +} + +// GoPaths returns all possible GOPATHS that are set. +func GoPaths() []string { + gp := Get("GOPATH", "") + if runtime.GOOS == "windows" { + return strings.Split(gp, ";") // Windows uses a different separator + } + return strings.Split(gp, ":") +} + +func importPath(path string) string { + for _, gopath := range GoPaths() { + srcpath := filepath.Join(gopath, "src") + rel, err := filepath.Rel(srcpath, path) + if err == nil { + return filepath.ToSlash(rel) + } + } + + // fallback to trim + rel := strings.TrimPrefix(path, filepath.Join(GoPath(), "src")) + rel = strings.TrimPrefix(rel, string(filepath.Separator)) + return filepath.ToSlash(rel) +} + +// CurrentModule will attempt to return the module name from `go.mod` if +// modules are enabled. +// If modules are not enabled it will fallback to using CurrentPackage instead. +func CurrentModule() (string, error) { + if !Mods() { + return CurrentPackage(), nil + } + moddata, err := ioutil.ReadFile("go.mod") + if err != nil { + return "", errors.New("go.mod cannot be read or does not exist while go module is enabled") + } + packagePath := modfile.ModulePath(moddata) + if packagePath == "" { + return "", errors.New("go.mod is malformed") + } + return packagePath, nil +} + +// CurrentPackage attempts to figure out the current package name from the PWD +// Use CurrentModule for a more accurate package name. +func CurrentPackage() string { + if Mods() { + } + pwd, _ := os.Getwd() + return importPath(pwd) +} + +func Environ() []string { + gil.RLock() + defer gil.RUnlock() + var e []string + for k, v := range env { + e = append(e, fmt.Sprintf("%s=%s", k, v)) + } + return e +} diff --git a/vendor/github.com/gobuffalo/envy/envy_test.go b/vendor/github.com/gobuffalo/envy/envy_test.go new file mode 100644 index 000000000..5262befb3 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/envy_test.go @@ -0,0 +1,208 @@ +package envy + +import ( + "os" + "runtime" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_Mods(t *testing.T) { + r := require.New(t) + Temp(func() { + Set(GO111MODULE, "off") + r.False(Mods()) + Set(GO111MODULE, "on") + r.True(Mods()) + }) +} + +// envy should detect when running as a unit test and return GO_ENV=test if otherwise undefined +func Test_GO_ENVUnitTest(t *testing.T) { + r := require.New(t) + r.Zero(os.Getenv("GO_ENV")) + r.Equal("test", Get("GO_ENV", "foo")) +} + +func Test_Get(t *testing.T) { + r := require.New(t) + r.NotZero(os.Getenv("GOPATH")) + r.Equal(os.Getenv("GOPATH"), Get("GOPATH", "foo")) + r.Equal("bar", Get("IDONTEXIST", "bar")) +} + +func Test_MustGet(t *testing.T) { + r := require.New(t) + r.NotZero(os.Getenv("GOPATH")) + v, err := MustGet("GOPATH") + r.NoError(err) + r.Equal(os.Getenv("GOPATH"), v) + + _, err = MustGet("IDONTEXIST") + r.Error(err) +} + +func Test_Set(t *testing.T) { + r := require.New(t) + _, err := MustGet("FOO") + r.Error(err) + + Set("FOO", "foo") + r.Equal("foo", Get("FOO", "bar")) +} + +func Test_MustSet(t *testing.T) { + r := require.New(t) + + r.Zero(os.Getenv("FOO")) + + err := MustSet("FOO", "BAR") + r.NoError(err) + + r.Equal("BAR", os.Getenv("FOO")) +} + +func Test_Temp(t *testing.T) { + r := require.New(t) + + _, err := MustGet("BAR") + r.Error(err) + + Temp(func() { + Set("BAR", "foo") + r.Equal("foo", Get("BAR", "bar")) + _, err = MustGet("BAR") + r.NoError(err) + }) + + _, err = MustGet("BAR") + r.Error(err) +} + +func Test_GoPath(t *testing.T) { + r := require.New(t) + Temp(func() { + Set("GOPATH", "/foo") + r.Equal("/foo", GoPath()) + }) +} + +func Test_GoPaths(t *testing.T) { + r := require.New(t) + Temp(func() { + if runtime.GOOS == "windows" { + Set("GOPATH", "/foo;/bar") + } else { + Set("GOPATH", "/foo:/bar") + } + r.Equal([]string{"/foo", "/bar"}, GoPaths()) + }) +} + +func Test_CurrentPackage(t *testing.T) { + r := require.New(t) + r.Equal("github.com/gobuffalo/envy", CurrentPackage()) +} + +// Env files loading +func Test_LoadEnvLoadsEnvFile(t *testing.T) { + r := require.New(t) + Temp(func() { + r.Equal("root", Get("DIR", "")) + r.Equal("none", Get("FLAVOUR", "")) + r.Equal("false", Get("INSIDE_FOLDER", "")) + }) +} + +func Test_LoadDefaultEnvWhenNoArgsPassed(t *testing.T) { + r := require.New(t) + Temp(func() { + err := Load() + r.NoError(err) + + r.Equal("root", Get("DIR", "")) + r.Equal("none", Get("FLAVOUR", "")) + r.Equal("false", Get("INSIDE_FOLDER", "")) + }) +} + +func Test_DoNotLoadDefaultEnvWhenArgsPassed(t *testing.T) { + r := require.New(t) + Temp(func() { + err := Load("test_env/.env") + r.NoError(err) + + r.Equal("test_env", Get("DIR", "")) + r.Equal("none", Get("FLAVOUR", "")) + r.Equal("true", Get("INSIDE_FOLDER", "")) + }) +} + +func Test_OverloadParams(t *testing.T) { + r := require.New(t) + Temp(func() { + err := Load("test_env/.env.test", "test_env/.env.prod") + r.NoError(err) + + r.Equal("production", Get("FLAVOUR", "")) + }) +} + +func Test_ErrorWhenSingleFileLoadDoesNotExist(t *testing.T) { + r := require.New(t) + Temp(func() { + delete(env, "FLAVOUR") + err := Load(".env.fake") + + r.Error(err) + r.Equal("FAILED", Get("FLAVOUR", "FAILED")) + }) +} + +func Test_KeepEnvWhenFileInListFails(t *testing.T) { + r := require.New(t) + Temp(func() { + err := Load(".env", ".env.FAKE") + r.Error(err) + r.Equal("none", Get("FLAVOUR", "FAILED")) + r.Equal("root", Get("DIR", "FAILED")) + }) +} + +func Test_KeepEnvWhenSecondLoadFails(t *testing.T) { + r := require.New(t) + Temp(func() { + err := Load(".env") + r.NoError(err) + r.Equal("none", Get("FLAVOUR", "FAILED")) + r.Equal("root", Get("DIR", "FAILED")) + + err = Load(".env.FAKE") + + r.Equal("none", Get("FLAVOUR", "FAILED")) + r.Equal("root", Get("DIR", "FAILED")) + }) +} + +func Test_StopLoadingWhenFileInListFails(t *testing.T) { + r := require.New(t) + Temp(func() { + err := Load(".env", ".env.FAKE", "test_env/.env.prod") + r.Error(err) + r.Equal("none", Get("FLAVOUR", "FAILED")) + r.Equal("root", Get("DIR", "FAILED")) + }) +} + +func Test_GOPATH_Not_Set(t *testing.T) { + r := require.New(t) + + Temp(func() { + MustSet("GOPATH", "/go") + loadEnv() + r.Equal("/go", Get("GOPATH", "notset")) + }) + + r.Equal("github.com/gobuffalo/envy", CurrentPackage()) +} diff --git a/vendor/github.com/gobuffalo/envy/go.mod b/vendor/github.com/gobuffalo/envy/go.mod new file mode 100644 index 000000000..75573b672 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/go.mod @@ -0,0 +1,13 @@ +module github.com/gobuffalo/envy + +require ( + github.com/gobuffalo/packr/v2 v2.0.0-rc.11 + github.com/joho/godotenv v1.3.0 + github.com/kr/pty v1.1.3 // indirect + github.com/markbates/deplist v1.0.5 // indirect + github.com/mitchellh/mapstructure v1.1.2 // indirect + github.com/rogpeppe/go-internal v1.0.0 + github.com/spf13/cast v1.3.0 // indirect + github.com/spf13/pflag v1.0.3 // indirect + github.com/stretchr/testify v1.2.2 +) diff --git a/vendor/github.com/gobuffalo/envy/go.sum b/vendor/github.com/gobuffalo/envy/go.sum new file mode 100644 index 000000000..851edb7e3 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/go.sum @@ -0,0 +1,346 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/ajg/form v0.0.0-20160822230020-523a5da1a92f/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= +github.com/codegangsta/negroni v1.0.0/go.mod h1:v0y3T5G7Y1UlFfyxFn/QLRU4a2EuNau2iZY63YTKWo0= +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/dustin/go-humanize v0.0.0-20180713052910-9f541cc9db5d/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/gobuffalo/buffalo v0.12.8-0.20181004233540-fac9bb505aa8/go.mod h1:sLyT7/dceRXJUxSsE813JTQtA3Eb1vjxWfo/N//vXIY= +github.com/gobuffalo/buffalo v0.13.0/go.mod h1:Mjn1Ba9wpIbpbrD+lIDMy99pQ0H0LiddMIIDGse7qT4= +github.com/gobuffalo/buffalo-plugins v1.0.2/go.mod h1:pOp/uF7X3IShFHyobahTkTLZaeUXwb0GrUTb9ngJWTs= +github.com/gobuffalo/buffalo-plugins v1.0.4/go.mod h1:pWS1vjtQ6uD17MVFWf7i3zfThrEKWlI5+PYLw/NaDB4= +github.com/gobuffalo/buffalo-plugins v1.4.3/go.mod h1:uCzTY0woez4nDMdQjkcOYKanngeUVRO2HZi7ezmAjWY= +github.com/gobuffalo/buffalo-plugins v1.5.1/go.mod h1:jbmwSZK5+PiAP9cC09VQOrGMZFCa/P0UMlIS3O12r5w= +github.com/gobuffalo/buffalo-plugins v1.6.4/go.mod h1:/+N1aophkA2jZ1ifB2O3Y9yGwu6gKOVMtUmJnbg+OZI= +github.com/gobuffalo/buffalo-plugins v1.6.5/go.mod h1:0HVkbgrVs/MnPZ/FOseDMVanCTm2RNcdM0PuXcL1NNI= +github.com/gobuffalo/buffalo-plugins v1.6.7/go.mod h1:ZGZRkzz2PiKWHs0z7QsPBOTo2EpcGRArMEym6ghKYgk= +github.com/gobuffalo/buffalo-plugins v1.6.9/go.mod h1:yYlYTrPdMCz+6/+UaXg5Jm4gN3xhsvsQ2ygVatZV5vw= +github.com/gobuffalo/buffalo-plugins v1.6.11/go.mod h1:eAA6xJIL8OuynJZ8amXjRmHND6YiusVAaJdHDN1Lu8Q= +github.com/gobuffalo/buffalo-plugins v1.8.2 h1:yA/adm1SRp8qZSHKMd0LH5+rhSez1DjY2uQSmhMZrLo= +github.com/gobuffalo/buffalo-plugins v1.8.2/go.mod h1:9te6/VjEQ7pKp7lXlDIMqzxgGpjlKoAcAANdCgoR960= +github.com/gobuffalo/buffalo-pop v1.0.5/go.mod h1:Fw/LfFDnSmB/vvQXPvcXEjzP98Tc+AudyNWUBWKCwQ8= +github.com/gobuffalo/envy v1.6.4/go.mod h1:Abh+Jfw475/NWtYMEt+hnJWRiC8INKWibIMyNt1w2Mc= +github.com/gobuffalo/envy v1.6.5/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.6/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.7/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.8/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.9/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.10/go.mod h1:X0CFllQjTV5ogsnUrg+Oks2yTI+PU2dGYBJOEI2D1Uo= +github.com/gobuffalo/events v1.0.3/go.mod h1:Txo8WmqScapa7zimEQIwgiJBvMECMe9gJjsKNPN3uZw= +github.com/gobuffalo/events v1.0.7/go.mod h1:z8txf6H9jWhQ5Scr7YPLWg/cgXBRj8Q4uYI+rsVCCSQ= +github.com/gobuffalo/events v1.0.8/go.mod h1:A5KyqT1sA+3GJiBE4QKZibse9mtOcI9nw8gGrDdqYGs= +github.com/gobuffalo/events v1.1.3/go.mod h1:9yPGWYv11GENtzrIRApwQRMYSbUgCsZ1w6R503fCfrk= +github.com/gobuffalo/events v1.1.4/go.mod h1:09/YRRgZHEOts5Isov+g9X2xajxdvOAcUuAHIX/O//A= +github.com/gobuffalo/events v1.1.5/go.mod h1:3YUSzgHfYctSjEjLCWbkXP6djH2M+MLaVRzb4ymbAK0= +github.com/gobuffalo/events v1.1.7/go.mod h1:6fGqxH2ing5XMb3EYRq9LEkVlyPGs4oO/eLzh+S8CxY= +github.com/gobuffalo/events v1.1.8 h1:T9SXUVyO1kF61uns5a8cpqsSPj5txZgIplbOoNNltqk= +github.com/gobuffalo/events v1.1.8/go.mod h1:UFy+W6X6VbCWS8k2iT81HYX65dMtiuVycMy04cplt/8= +github.com/gobuffalo/fizz v1.0.12/go.mod h1:C0sltPxpYK8Ftvf64kbsQa2yiCZY4RZviurNxXdAKwc= +github.com/gobuffalo/flect v0.0.0-20180907193754-dc14d8acaf9f/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181002182613-4571df4b1daf/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181007231023-ae7ed6bfe683/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181018182602-fd24a256709f/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181019110701-3d6f0b585514/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181024204909-8f6be1a8c6c2/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181104133451-1f6e9779237a/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181114183036-47375f6d8328 h1:nvA0/snr4wQeCwBYmrbftniJun/kxOjK/Pz3ivb7wis= +github.com/gobuffalo/flect v0.0.0-20181114183036-47375f6d8328/go.mod h1:0HvNbHdfh+WOvDSIASqJOSxTOWSxCCUF++k/Y53v9rI= +github.com/gobuffalo/genny v0.0.0-20180924032338-7af3a40f2252/go.mod h1:tUTQOogrr7tAQnhajMSH6rv1BVev34H2sa1xNHMy94g= +github.com/gobuffalo/genny v0.0.0-20181003150629-3786a0744c5d/go.mod h1:WAd8HmjMVrnkAZbmfgH5dLBUchsZfqzp/WS5sQz+uTM= +github.com/gobuffalo/genny v0.0.0-20181005145118-318a41a134cc/go.mod h1:WAd8HmjMVrnkAZbmfgH5dLBUchsZfqzp/WS5sQz+uTM= +github.com/gobuffalo/genny v0.0.0-20181007153042-b8de7d566757/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA= +github.com/gobuffalo/genny v0.0.0-20181012161047-33e5f43d83a6/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA= +github.com/gobuffalo/genny v0.0.0-20181017160347-90a774534246/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA= +github.com/gobuffalo/genny v0.0.0-20181024195656-51392254bf53/go.mod h1:o9GEH5gn5sCKLVB5rHFC4tq40rQ3VRUzmx6WwmaqISE= +github.com/gobuffalo/genny v0.0.0-20181025145300-af3f81d526b8/go.mod h1:uZ1fFYvdcP8mu0B/Ynarf6dsGvp7QFIpk/QACUuFUVI= +github.com/gobuffalo/genny v0.0.0-20181027191429-94d6cfb5c7fc/go.mod h1:x7SkrQQBx204Y+O9EwRXeszLJDTaWN0GnEasxgLrQTA= +github.com/gobuffalo/genny v0.0.0-20181027195209-3887b7171c4f/go.mod h1:JbKx8HSWICu5zyqWOa0dVV1pbbXOHusrSzQUprW6g+w= +github.com/gobuffalo/genny v0.0.0-20181106193839-7dcb0924caf1/go.mod h1:x61yHxvbDCgQ/7cOAbJCacZQuHgB0KMSzoYcw5debjU= +github.com/gobuffalo/genny v0.0.0-20181107223128-f18346459dbe/go.mod h1:utQD3aKKEsdb03oR+Vi/6ztQb1j7pO10N3OBoowRcSU= +github.com/gobuffalo/genny v0.0.0-20181114215459-0a4decd77f5d/go.mod h1:kN2KZ8VgXF9VIIOj/GM0Eo7YK+un4Q3tTreKOf0q1ng= +github.com/gobuffalo/genny v0.0.0-20181119162812-e8ff4adce8bb/go.mod h1:BA9htSe4bZwBDJLe8CUkoqkypq3hn3+CkoHqVOW718E= +github.com/gobuffalo/genny v0.0.0-20181127225641-2d959acc795b/go.mod h1:l54xLXNkteX/PdZ+HlgPk1qtcrgeOr3XUBBPDbH+7CQ= +github.com/gobuffalo/genny v0.0.0-20181128191930-77e34f71ba2a/go.mod h1:FW/D9p7cEEOqxYA71/hnrkOWm62JZ5ZNxcNIVJEaWBU= +github.com/gobuffalo/genny v0.0.0-20181203165245-fda8bcce96b1/go.mod h1:wpNSANu9UErftfiaAlz1pDZclrYzLtO5lALifODyjuM= +github.com/gobuffalo/genny v0.0.0-20181203201232-849d2c9534ea/go.mod h1:wpNSANu9UErftfiaAlz1pDZclrYzLtO5lALifODyjuM= +github.com/gobuffalo/genny v0.0.0-20181206121324-d6fb8a0dbe36/go.mod h1:wpNSANu9UErftfiaAlz1pDZclrYzLtO5lALifODyjuM= +github.com/gobuffalo/genny v0.0.0-20181207164119-84844398a37d h1:hMNkpdZDaQ3ZHEmdrSPLFfgBbWRZsjgjX5DHoIP9w2I= +github.com/gobuffalo/genny v0.0.0-20181207164119-84844398a37d/go.mod h1:y0ysCHGGQf2T3vOhCrGHheYN54Y/REj0ayd0Suf4C/8= +github.com/gobuffalo/github_flavored_markdown v1.0.4/go.mod h1:uRowCdK+q8d/RF0Kt3/DSalaIXbb0De/dmTqMQdkQ4I= +github.com/gobuffalo/github_flavored_markdown v1.0.5/go.mod h1:U0643QShPF+OF2tJvYNiYDLDGDuQmJZXsf/bHOJPsMY= +github.com/gobuffalo/github_flavored_markdown v1.0.7/go.mod h1:w93Pd9Lz6LvyQXEG6DktTPHkOtCbr+arAD5mkwMzXLI= +github.com/gobuffalo/httptest v1.0.2/go.mod h1:7T1IbSrg60ankme0aDLVnEY0h056g9M1/ZvpVThtB7E= +github.com/gobuffalo/licenser v0.0.0-20180924033006-eae28e638a42/go.mod h1:Ubo90Np8gpsSZqNScZZkVXXAo5DGhTb+WYFIjlnog8w= +github.com/gobuffalo/licenser v0.0.0-20181025145548-437d89de4f75/go.mod h1:x3lEpYxkRG/XtGCUNkio+6RZ/dlOvLzTI9M1auIwFcw= +github.com/gobuffalo/licenser v0.0.0-20181027200154-58051a75da95/go.mod h1:BzhaaxGd1tq1+OLKObzgdCV9kqVhbTulxOpYbvMQWS0= +github.com/gobuffalo/licenser v0.0.0-20181109171355-91a2a7aac9a7/go.mod h1:m+Ygox92pi9bdg+gVaycvqE8RVSjZp7mWw75+K5NPHk= +github.com/gobuffalo/licenser v0.0.0-20181128165715-cc7305f8abed/go.mod h1:oU9F9UCE+AzI/MueCKZamsezGOOHfSirltllOVeRTAE= +github.com/gobuffalo/licenser v0.0.0-20181203160806-fe900bbede07/go.mod h1:ph6VDNvOzt1CdfaWC+9XwcBnlSTBz2j49PBwum6RFaU= +github.com/gobuffalo/logger v0.0.0-20181022175615-46cfb361fc27/go.mod h1:8sQkgyhWipz1mIctHF4jTxmJh1Vxhp7mP8IqbljgJZo= +github.com/gobuffalo/logger v0.0.0-20181027144941-73d08d2bb969/go.mod h1:7uGg2duHKpWnN4+YmyKBdLXfhopkAdVM6H3nKbyFbz8= +github.com/gobuffalo/logger v0.0.0-20181027193913-9cf4dd0efe46/go.mod h1:7uGg2duHKpWnN4+YmyKBdLXfhopkAdVM6H3nKbyFbz8= +github.com/gobuffalo/logger v0.0.0-20181109185836-3feeab578c17/go.mod h1:oNErH0xLe+utO+OW8ptXMSA5DkiSEDW1u3zGIt8F9Ew= +github.com/gobuffalo/logger v0.0.0-20181117211126-8e9b89b7c264/go.mod h1:5etB91IE0uBlw9k756fVKZJdS+7M7ejVhmpXXiSFj0I= +github.com/gobuffalo/logger v0.0.0-20181127160119-5b956e21995c h1:Z/ppYX6EtPEysbW4VEGz2dO+4F4VTthWp2sWRUCANdU= +github.com/gobuffalo/logger v0.0.0-20181127160119-5b956e21995c/go.mod h1:+HxKANrR9VGw9yN3aOAppJKvhO05ctDi63w4mDnKv2U= +github.com/gobuffalo/makr v1.1.5/go.mod h1:Y+o0btAH1kYAMDJW/TX3+oAXEu0bmSLLoC9mIFxtzOw= +github.com/gobuffalo/mapi v1.0.0/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/mapi v1.0.1 h1:JRuTiZzDEZhBHkFiHTxJkYRT6CbYuL0K/rn+1byJoEA= +github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/meta v0.0.0-20181018155829-df62557efcd3/go.mod h1:XTTOhwMNryif3x9LkTTBO/Llrveezd71u3quLd0u7CM= +github.com/gobuffalo/meta v0.0.0-20181018192820-8c6cef77dab3/go.mod h1:E94EPzx9NERGCY69UWlcj6Hipf2uK/vnfrF4QD0plVE= +github.com/gobuffalo/meta v0.0.0-20181025145500-3a985a084b0a/go.mod h1:YDAKBud2FP7NZdruCSlmTmDOZbVSa6bpK7LJ/A/nlKg= +github.com/gobuffalo/meta v0.0.0-20181114191255-b130ebedd2f7/go.mod h1:K6cRZ29ozr4Btvsqkjvg5nDFTLOgTqf03KA70Ks0ypE= +github.com/gobuffalo/meta v0.0.0-20181127070345-0d7e59dd540b h1:TP4reYa74tCqKmeisA9aULXzcb1fHIM3bi7PdoDxpuQ= +github.com/gobuffalo/meta v0.0.0-20181127070345-0d7e59dd540b/go.mod h1:RLO7tMvE0IAKAM8wny1aN12pvEKn7EtkBLkUZR00Qf8= +github.com/gobuffalo/mw-basicauth v1.0.3/go.mod h1:dg7+ilMZOKnQFHDefUzUHufNyTswVUviCBgF244C1+0= +github.com/gobuffalo/mw-contenttype v0.0.0-20180802152300-74f5a47f4d56/go.mod h1:7EvcmzBbeCvFtQm5GqF9ys6QnCxz2UM1x0moiWLq1No= +github.com/gobuffalo/mw-csrf v0.0.0-20180802151833-446ff26e108b/go.mod h1:sbGtb8DmDZuDUQoxjr8hG1ZbLtZboD9xsn6p77ppcHo= +github.com/gobuffalo/mw-forcessl v0.0.0-20180802152810-73921ae7a130/go.mod h1:JvNHRj7bYNAMUr/5XMkZaDcw3jZhUZpsmzhd//FFWmQ= +github.com/gobuffalo/mw-i18n v0.0.0-20180802152014-e3060b7e13d6/go.mod h1:91AQfukc52A6hdfIfkxzyr+kpVYDodgAeT5cjX1UIj4= +github.com/gobuffalo/mw-paramlogger v0.0.0-20181005191442-d6ee392ec72e/go.mod h1:6OJr6VwSzgJMqWMj7TYmRUqzNe2LXu/W1rRW4MAz/ME= +github.com/gobuffalo/mw-tokenauth v0.0.0-20181001105134-8545f626c189/go.mod h1:UqBF00IfKvd39ni5+yI5MLMjAf4gX7cDKN/26zDOD6c= +github.com/gobuffalo/packd v0.0.0-20181027182251-01ad393492c8/go.mod h1:SmdBdhj6uhOsg1Ui4SFAyrhuc7U4VCildosO5IDJ3lc= +github.com/gobuffalo/packd v0.0.0-20181027190505-aafc0d02c411/go.mod h1:SmdBdhj6uhOsg1Ui4SFAyrhuc7U4VCildosO5IDJ3lc= +github.com/gobuffalo/packd v0.0.0-20181027194105-7ae579e6d213/go.mod h1:SmdBdhj6uhOsg1Ui4SFAyrhuc7U4VCildosO5IDJ3lc= +github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181104210303-d376b15f8e96/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181111195323-b2e760a5f0ff/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181114190715-f25c5d2471d7/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181124090624-311c6248e5fb/go.mod h1:Foenia9ZvITEvG05ab6XpiD5EfBHPL8A6hush8SJ0o8= +github.com/gobuffalo/packd v0.0.0-20181207120301-c49825f8f6f4 h1:bxxuyBF+Wl5me1hFJoSaXlvvtTXhIBhbKK0J7ZbcG8Y= +github.com/gobuffalo/packd v0.0.0-20181207120301-c49825f8f6f4/go.mod h1:LYc0TGKFBBFTRC9dg2pcRcMqGCTMD7T2BIMP7OBuQAA= +github.com/gobuffalo/packr v1.13.7/go.mod h1:KkinLIn/n6+3tVXMwg6KkNvWwVsrRAz4ph+jgpk3Z24= +github.com/gobuffalo/packr v1.15.0/go.mod h1:t5gXzEhIviQwVlNx/+3SfS07GS+cZ2hn76WLzPp6MGI= +github.com/gobuffalo/packr v1.15.1/go.mod h1:IeqicJ7jm8182yrVmNbM6PR4g79SjN9tZLH8KduZZwE= +github.com/gobuffalo/packr v1.19.0/go.mod h1:MstrNkfCQhd5o+Ct4IJ0skWlxN8emOq8DsoT1G98VIU= +github.com/gobuffalo/packr v1.20.0/go.mod h1:JDytk1t2gP+my1ig7iI4NcVaXr886+N0ecUga6884zw= +github.com/gobuffalo/packr v1.21.0/go.mod h1:H00jGfj1qFKxscFJSw8wcL4hpQtPe1PfU2wa6sg/SR0= +github.com/gobuffalo/packr/v2 v2.0.0-rc.8/go.mod h1:y60QCdzwuMwO2R49fdQhsjCPv7tLQFR0ayzxxla9zes= +github.com/gobuffalo/packr/v2 v2.0.0-rc.10/go.mod h1:4CWWn4I5T3v4c1OsJ55HbHlUEKNWMITG5iIkdr4Px4w= +github.com/gobuffalo/packr/v2 v2.0.0-rc.11 h1:LiPw9qlr/rzI620wcffyQ6AG4uEHYFFV2VpUQ1BIEEk= +github.com/gobuffalo/packr/v2 v2.0.0-rc.11/go.mod h1:JoieH/3h3U4UmatmV93QmqyPUdf4wVM9HELaHEu+3fk= +github.com/gobuffalo/plush v3.7.16+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.20+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.21+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.22+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.23+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.30+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.32+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plushgen v0.0.0-20181128164830-d29dcb966cb2/go.mod h1:r9QwptTFnuvSaSRjpSp4S2/4e2D3tJhARYbvEBcKSb4= +github.com/gobuffalo/plushgen v0.0.0-20181203163832-9fc4964505c2/go.mod h1:opEdT33AA2HdrIwK1aibqnTJDVVKXC02Bar/GT1YRVs= +github.com/gobuffalo/plushgen v0.0.0-20181207152837-eedb135bd51b/go.mod h1:Lcw7HQbEVm09sAQrCLzIxuhFbB3nAgp4c55E+UlynR0= +github.com/gobuffalo/pop v4.8.2+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/pop v4.8.3+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/pop v4.8.4+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/release v1.0.35/go.mod h1:VtHFAKs61vO3wboCec5xr9JPTjYyWYcvaM3lclkc4x4= +github.com/gobuffalo/release v1.0.38/go.mod h1:VtHFAKs61vO3wboCec5xr9JPTjYyWYcvaM3lclkc4x4= +github.com/gobuffalo/release v1.0.42/go.mod h1:RPs7EtafH4oylgetOJpGP0yCZZUiO4vqHfTHJjSdpug= +github.com/gobuffalo/release v1.0.52/go.mod h1:RPs7EtafH4oylgetOJpGP0yCZZUiO4vqHfTHJjSdpug= +github.com/gobuffalo/release v1.0.53/go.mod h1:FdF257nd8rqhNaqtDWFGhxdJ/Ig4J7VcS3KL7n/a+aA= +github.com/gobuffalo/release v1.0.54/go.mod h1:Pe5/RxRa/BE8whDpGfRqSI7D1a0evGK1T4JDm339tJc= +github.com/gobuffalo/release v1.0.61/go.mod h1:mfIO38ujUNVDlBziIYqXquYfBF+8FDHUjKZgYC1Hj24= +github.com/gobuffalo/release v1.0.72/go.mod h1:NP5NXgg/IX3M5XmHmWR99D687/3Dt9qZtTK/Lbwc1hU= +github.com/gobuffalo/release v1.1.1/go.mod h1:Sluak1Xd6kcp6snkluR1jeXAogdJZpFFRzTYRs/2uwg= +github.com/gobuffalo/shoulders v1.0.1/go.mod h1:V33CcVmaQ4gRUmHKwq1fiTXuf8Gp/qjQBUL5tHPmvbA= +github.com/gobuffalo/syncx v0.0.0-20181120191700-98333ab04150/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/gobuffalo/syncx v0.0.0-20181120194010-558ac7de985f h1:S5EeH1reN93KR0L6TQvkRpu9YggCYXrUqFh1iEgvdC0= +github.com/gobuffalo/syncx v0.0.0-20181120194010-558ac7de985f/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/gobuffalo/tags v2.0.11+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY= +github.com/gobuffalo/tags v2.0.14+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY= +github.com/gobuffalo/uuid v2.0.3+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/uuid v2.0.4+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/uuid v2.0.5+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/validate v2.0.3+incompatible/go.mod h1:N+EtDe0J8252BgfzQUChBgfd6L93m9weay53EWFVsMM= +github.com/gobuffalo/x v0.0.0-20181003152136-452098b06085/go.mod h1:WevpGD+5YOreDJznWevcn8NTmQEW5STSBgIkpkjzqXc= +github.com/gobuffalo/x v0.0.0-20181007152206-913e47c59ca7/go.mod h1:9rDPXaB3kXdKWzMc4odGQQdG2e2DIEmANy5aSJ9yesY= +github.com/gofrs/uuid v3.1.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1/go.mod h1:YeAe0gNeiNT5hoiZRI4yiOky6jVdNvfO2N6Kav/HmxY= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.1.2/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/gorilla/sessions v1.1.3/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ= +github.com/jackc/pgx v3.2.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= +github.com/jmoiron/sqlx v0.0.0-20180614180643-0dae4fefe7c0/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU= +github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +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.7.5/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46shStcFDJ34= +github.com/karrick/godirwalk v1.7.7 h1:lLkPCA+C0u1pI4fLFseaupvh5/THlPJIqSPmnGGViKs= +github.com/karrick/godirwalk v1.7.7/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46shStcFDJ34= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +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/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/markbates/deplist v1.0.4/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM= +github.com/markbates/deplist v1.0.5/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM= +github.com/markbates/going v1.0.2/go.mod h1:UWCk3zm0UKefHZ7l8BNqi26UyiEMniznk8naLdTcy6c= +github.com/markbates/grift v1.0.4/go.mod h1:wbmtW74veyx+cgfwFhlnnMWqhoz55rnHR47oMXzsyVs= +github.com/markbates/hmax v1.0.0/go.mod h1:cOkR9dktiESxIMu+65oc/r/bdY4bE8zZw3OLhLx0X2c= +github.com/markbates/inflect v1.0.0/go.mod h1:oTeZL2KHA7CUX6X+fovmK9OvIOFuqu0TwdQrZjLTh88= +github.com/markbates/inflect v1.0.1/go.mod h1:uv3UVNBe5qBIfCm8O8Q+DW+S1EopeyINj+Ikhc7rnCk= +github.com/markbates/inflect v1.0.3/go.mod h1:1fR9+pO2KHEO9ZRtto13gDwwZaAKstQzferVeWqbgNs= +github.com/markbates/inflect v1.0.4/go.mod h1:1fR9+pO2KHEO9ZRtto13gDwwZaAKstQzferVeWqbgNs= +github.com/markbates/oncer v0.0.0-20180924031910-e862a676800b/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/oncer v0.0.0-20180924034138-723ad0170a46/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/oncer v0.0.0-20181014194634-05fccaae8fc4/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2 h1:JgVTCPf0uBVcUSWpyXmGpgOc62nK5HWUBKAGc3Qqa5k= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/refresh v1.4.10/go.mod h1:NDPHvotuZmTmesXxr95C9bjlw1/0frJwtME2dzcVKhc= +github.com/markbates/safe v1.0.0/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +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/markbates/sigtx v1.0.0/go.mod h1:QF1Hv6Ic6Ca6W+T+DL0Y/ypborFKyvUY9HmuCD4VeTc= +github.com/markbates/willie v1.0.9/go.mod h1:fsrFVWl91+gXpx/6dv715j7i11fYPfZ9ZGfH0DQzY7w= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/monoculum/formam v0.0.0-20180901015400-4e68be1d79ba/go.mod h1:RKgILGEJq24YyJ2ban8EO0RUVSJlF1pGsEvoLEACr/Q= +github.com/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2xBGjv0j365Q= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.0.0 h1:o4VLZ5jqHE+HahLT6drNtSGTrrUA3wPBmtpgqtdbClo= +github.com/rogpeppe/go-internal v1.0.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= +github.com/shurcooL/highlight_go v0.0.0-20170515013102-78fb10f4a5f8/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= +github.com/shurcooL/octicon v0.0.0-20180602230221-c42b0e3b24d9/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= +github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.1.0/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= +github.com/sirupsen/logrus v1.1.1/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= +github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= +github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +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.2.1/go.mod h1:P4AexN0a+C9tGAnUFNwDMYYZv3pjFuvmeiMyKRaNVlI= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/unrolled/secure v0.0.0-20180918153822-f340ee86eb8b/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA= +github.com/unrolled/secure v0.0.0-20181005190816-ff9db2ff917f/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181015023909-0c41d7ab0a0e/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181024171144-74cb1d3d52f4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181025113841-85e1b3f9139a/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181025213731-e84da0312774/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180816102801-aaf60122140d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180921000356-2f5d2388922f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181017193950-04a2e542c03f/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-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181106065722-10aee1819953/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-20181207154023-610586996380/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +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/sys v0.0.0-20180816055513-1c9583448a9c/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-20180906133057-8cf3aee42992/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180921163948-d47a0f339242/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180927150500-dad3d9fb7b6e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181011152604-fa43e7bc11ba/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181022134430-8a28ead16f52/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181024145615-5cd93ef61a7c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181025063200-d989b31c8746/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026064943-731415f00dce/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-20181106135930-3a76605856fd/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-20181206074257-70b957f3b65e h1:njOxP/wVblhCLIUhjHXf6X+dzTt5OQ3vMQo9mkOIKIo= +golang.org/x/sys v0.0.0-20181206074257-70b957f3b65e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181003024731-2f84ea8ef872/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181006002542-f60d9635b16a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181008205924-a2b3f7f249e9/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181013182035-5e66757b835f/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181017214349-06f26fdaaa28/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181024171208-a2dc47679d30/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181026183834-f60e5f99f081/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181105230042-78dc5bac0cac/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181107215632-34b416bd17b3/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181114190951-94339b83286c/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181119130350-139d099f6620/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181127195227-b4e97c0ed882/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181127232545-e782529d0ddd/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181205224935-3576414c54a4/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181206194817-bcd4e47d0288 h1:uFWEpVI5nk2F/22rsVg40mbEixNPRNrL/d/Qea/VtQk= +golang.org/x/tools v0.0.0-20181206194817-bcd4e47d0288/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +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/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw= +gopkg.in/mail.v2 v2.0.0-20180731213649-a0242b2233b4/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/gobuffalo/envy/packrd/packed-packr.go b/vendor/github.com/gobuffalo/envy/packrd/packed-packr.go new file mode 100644 index 000000000..749b8f45e --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/packrd/packed-packr.go @@ -0,0 +1,21 @@ +// Code generated by github.com/gobuffalo/packr/v2. DO NOT EDIT. + +// You can use the "packr2 clean" command to clean up this, +// and any other packr generated files. +package packrd + +import ( + "github.com/gobuffalo/packr/v2" + "github.com/gobuffalo/packr/v2/file/resolver" +) + +var _ = func() error { + const gk = "e6ec151be31ed8358de3665e7be5891d" + g := packr.New(gk, "") + hgr, err := resolver.NewHexGzip(map[string]string{}) + if err != nil { + panic(err) + } + g.DefaultResolver = hgr + return nil +}() diff --git a/vendor/github.com/gobuffalo/envy/shoulders.md b/vendor/github.com/gobuffalo/envy/shoulders.md new file mode 100644 index 000000000..120330be3 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/shoulders.md @@ -0,0 +1,16 @@ +# github.com/gobuffalo/envy Stands on the Shoulders of Giants + +github.com/gobuffalo/envy 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/joho/godotenv](https://godoc.org/github.com/joho/godotenv) + +* [github.com/rogpeppe/go-internal/modfile](https://godoc.org/github.com/rogpeppe/go-internal/modfile) + +* [github.com/rogpeppe/go-internal/module](https://godoc.org/github.com/rogpeppe/go-internal/module) + +* [github.com/rogpeppe/go-internal/semver](https://godoc.org/github.com/rogpeppe/go-internal/semver) diff --git a/vendor/github.com/gobuffalo/envy/test_env/.env b/vendor/github.com/gobuffalo/envy/test_env/.env new file mode 100644 index 000000000..5a1de3092 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/test_env/.env @@ -0,0 +1,3 @@ +DIR=test_env +FLAVOUR=none +INSIDE_FOLDER=true \ No newline at end of file diff --git a/vendor/github.com/gobuffalo/envy/test_env/.env.prod b/vendor/github.com/gobuffalo/envy/test_env/.env.prod new file mode 100644 index 000000000..6de884238 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/test_env/.env.prod @@ -0,0 +1 @@ +FLAVOUR=production \ No newline at end of file diff --git a/vendor/github.com/gobuffalo/envy/version.go b/vendor/github.com/gobuffalo/envy/version.go new file mode 100644 index 000000000..a6177fb40 --- /dev/null +++ b/vendor/github.com/gobuffalo/envy/version.go @@ -0,0 +1,3 @@ +package envy + +const Version = "v1.6.11" diff --git a/vendor/github.com/gobuffalo/packd/.gitignore b/vendor/github.com/gobuffalo/packd/.gitignore new file mode 100644 index 000000000..08a5f35a8 --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/.gitignore @@ -0,0 +1,30 @@ +*.log +.DS_Store +doc +tmp +pkg +*.gem +*.pid +coverage +coverage.data +build/* +*.pbxuser +*.mode1v3 +.svn +profile +.console_history +.sass-cache/* +.rake_tasks~ +*.log.lck +solr/ +.jhw-cache/ +jhw.* +*.sublime* +node_modules/ +dist/ +generated/ +.vendor/ +bin/* +gin-bin +.idea/ +Dockerfile.gocker diff --git a/vendor/github.com/gobuffalo/packd/.gometalinter.json b/vendor/github.com/gobuffalo/packd/.gometalinter.json new file mode 100644 index 000000000..e4f65a36e --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/.gometalinter.json @@ -0,0 +1,3 @@ +{ + "Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"] +} diff --git a/vendor/github.com/gobuffalo/packd/.travis.yml b/vendor/github.com/gobuffalo/packd/.travis.yml new file mode 100644 index 000000000..a85edd37a --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/.travis.yml @@ -0,0 +1,36 @@ +language: go + +sudo: false + +matrix: + include: + - os: linux + go: "1.9.x" + - os: windows + go: "1.9.x" + - os: linux + go: "1.10.x" + - os: windows + go: "1.10.x" + - os: linux + go: "1.11.x" + env: + - GO111MODULE=off + - os: windows + go: "1.11.x" + env: + - GO111MODULE=off + - os: linux + go: "1.11.x" + env: + - GO111MODULE=on + - os: windows + go: "1.11.x" + env: + - GO111MODULE=on + +install: false + +script: + - go get -v -t ./... + - go test -v -timeout=5s -race ./... diff --git a/vendor/github.com/gobuffalo/packd/LICENSE b/vendor/github.com/gobuffalo/packd/LICENSE new file mode 100644 index 000000000..a538bcbf2 --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Mark Bates + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/gobuffalo/packd/Makefile b/vendor/github.com/gobuffalo/packd/Makefile new file mode 100644 index 000000000..399269e3e --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/Makefile @@ -0,0 +1,57 @@ +TAGS ?= "sqlite" +GO_BIN ?= go + +install: + packr + $(GO_BIN) install -tags ${TAGS} -v . + make tidy + +tidy: +ifeq ($(GO111MODULE),on) + $(GO_BIN) mod tidy +else + echo skipping go mod tidy +endif + +deps: + $(GO_BIN) get github.com/gobuffalo/release + $(GO_BIN) get github.com/gobuffalo/packr/packr + $(GO_BIN) get -tags ${TAGS} -t ./... + make tidy + +build: + packr + $(GO_BIN) build -v . + make tidy + +test: + packr + $(GO_BIN) test -tags ${TAGS} ./... + make tidy + +ci-deps: + $(GO_BIN) get -v -tags ${TAGS} -t ./... + +ci-test: + $(GO_BIN) test -v -tags ${TAGS} -timeout=5s -race ./... + +lint: + gometalinter --vendor ./... --deadline=1m --skip=internal + make tidy + +update: + $(GO_BIN) get -u -tags ${TAGS} + make tidy + packr + make test + make install + make tidy + +release-test: + $(GO_BIN) test -tags ${TAGS} -race ./... + make tidy + +release: + make tidy + release -y -f version.go + make tidy diff --git a/vendor/github.com/gobuffalo/packd/README.md b/vendor/github.com/gobuffalo/packd/README.md new file mode 100644 index 000000000..1c534cdd5 --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/README.md @@ -0,0 +1,24 @@ +

+ +

+GoDoc +Build Status +Go Report Card +

+ +# github.com/gobuffalo/packd + +This is a collection of interfaces designed to make using [github.com/gobuffalo/packr](https://github.com/gobuffalo/packr) easier, and to make the transition between v1 and v2 as seamless as possible. + +They can, and should, be used for testing, alternate Box implementations, etc... + + +## Installation + +```bash +$ go get -u -v github.com/gobuffalo/packd +``` + +## Memory Box + +The [`packd#MemoryBox`](https://godoc.org/github.com/gobuffalo/packd#MemoryBox) is a complete, thread-safe, implementation of [`packd#Box`](https://godoc.org/github.com/gobuffalo/packd#Box) diff --git a/vendor/github.com/gobuffalo/packd/file.go b/vendor/github.com/gobuffalo/packd/file.go new file mode 100644 index 000000000..ee9f95c28 --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/file.go @@ -0,0 +1,128 @@ +package packd + +import ( + "bytes" + "fmt" + "io" + "os" + "time" + + "github.com/pkg/errors" +) + +var _ File = &virtualFile{} +var _ io.Reader = &virtualFile{} +var _ io.Writer = &virtualFile{} +var _ fmt.Stringer = &virtualFile{} + +type virtualFile struct { + io.Reader + name string + info fileInfo + original []byte +} + +func (f virtualFile) Name() string { + return f.name +} + +func (f *virtualFile) Seek(offset int64, whence int) (int64, error) { + return f.Reader.(*bytes.Reader).Seek(offset, whence) +} + +func (f virtualFile) FileInfo() (os.FileInfo, error) { + return f.info, nil +} + +func (f *virtualFile) Close() error { + return nil +} + +func (f virtualFile) Readdir(count int) ([]os.FileInfo, error) { + return []os.FileInfo{f.info}, nil +} + +func (f virtualFile) Stat() (os.FileInfo, error) { + return f.info, nil +} + +func (f virtualFile) String() string { + return string(f.original) +} + +// Read reads the next len(p) bytes from the virtualFile and +// rewind read offset to 0 when it met EOF. +func (f *virtualFile) Read(p []byte) (int, error) { + i, err := f.Reader.Read(p) + + if i == 0 || err == io.EOF { + f.Seek(0, io.SeekStart) + } + return i, err +} + +// Write copies byte slice p to content of virtualFile. +func (f *virtualFile) Write(p []byte) (int, error) { + return f.write(p) +} + +// write copies byte slice or data from io.Reader to content of the +// virtualFile and update related information of the virtualFile. +func (f *virtualFile) write(d interface{}) (c int, err error) { + bb := &bytes.Buffer{} + switch d.(type) { + case []byte: + c, err = bb.Write(d.([]byte)) + case io.Reader: + if d != nil { + i64, e := io.Copy(bb, d.(io.Reader)) + c = int(i64) + err = e + } + default: + err = errors.New("unknown type of argument") + } + + if err != nil { + return c, errors.WithStack(err) + } + + f.info.size = int64(c) + f.info.modTime = time.Now() + f.original = bb.Bytes() + f.Reader = bytes.NewReader(f.original) + return c, nil +} + +// NewFile returns a new "virtual" file +func NewFile(name string, r io.Reader) (File, error) { + return buildFile(name, r) +} + +// NewDir returns a new "virtual" directory +func NewDir(name string) (File, error) { + v, err := buildFile(name, nil) + if err != nil { + return v, errors.WithStack(err) + } + v.info.isDir = true + return v, nil +} + +func buildFile(name string, r io.Reader) (*virtualFile, error) { + vf := &virtualFile{ + name: name, + info: fileInfo{ + Path: name, + modTime: time.Now(), + }, + } + + var err error + if r != nil { + _, err = vf.write(r) + } else { + _, err = vf.write([]byte{}) // for safety + } + return vf, errors.Wrap(err, "could not make virtual file") +} diff --git a/vendor/github.com/gobuffalo/packr/file_info.go b/vendor/github.com/gobuffalo/packd/file_info.go similarity index 77% rename from vendor/github.com/gobuffalo/packr/file_info.go rename to vendor/github.com/gobuffalo/packd/file_info.go index e7931d297..8bed0b903 100644 --- a/vendor/github.com/gobuffalo/packr/file_info.go +++ b/vendor/github.com/gobuffalo/packd/file_info.go @@ -1,16 +1,17 @@ -package packr +package packd import ( "os" "time" ) +var _ os.FileInfo = fileInfo{} + type fileInfo struct { - Path string - Contents []byte - size int64 - modTime time.Time - isDir bool + Path string + size int64 + modTime time.Time + isDir bool } func (f fileInfo) Name() string { diff --git a/vendor/github.com/gobuffalo/packd/file_test.go b/vendor/github.com/gobuffalo/packd/file_test.go new file mode 100644 index 000000000..1da6f6ca6 --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/file_test.go @@ -0,0 +1,106 @@ +package packd + +import ( + "bytes" + "io" + "io/ioutil" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_NewFile(t *testing.T) { + r := require.New(t) + + input := "hi" + f, err := NewFile("foo.txt", strings.NewReader(input)) + r.NoError(err) + r.NotNil(f) + r.Equal("foo.txt", f.Name()) + b, err := ioutil.ReadAll(f) + r.NoError(err) + r.Equal(input, string(b)) +} + +func Test_File_Reader(t *testing.T) { + r := require.New(t) + + input := "hi" + f, err := NewFile("foo.txt", strings.NewReader(input)) + r.NoError(err) + r.Equal(input, f.String()) + + bb := &bytes.Buffer{} + i, err := io.Copy(bb, f) + r.NoError(err) + r.Equal(int64(2), i) + r.Equal(input, bb.String()) + r.Equal(input, f.String()) + + // read again + bb2 := &bytes.Buffer{} + i, err = io.Copy(bb2, f) + r.NoError(err) + r.Equal(int64(2), i) + r.Equal(input, bb2.String()) + r.Equal(input, f.String()) +} + +func Test_File_Writer(t *testing.T) { + r := require.New(t) + + input := "hi" + f, err := NewFile("foo.txt", strings.NewReader(input)) + r.NoError(err) + r.Equal(input, f.String()) + i, err := io.Copy(f, strings.NewReader("HELLO")) + r.NoError(err) + r.Equal(int64(5), i) + + r.Equal("HELLO", f.String()) +} + +func Test_File_Seek(t *testing.T) { + r := require.New(t) + input := "Aliqua adipisicing ullamco anim culpa minim labore sunt nostrud et exercitation veniam amet." + f, err := NewFile("foo.txt", strings.NewReader(input)) + r.NoError(err) + r.Equal(input, f.String()) + + // Perform first read + buf := make([]byte, 6) + n, err := f.Read(buf) + r.NoError(err) + r.Equal(6, n) + r.Equal("Aliqua", string(buf)) + + // Seek back to beginning + i, err := f.Seek(0, io.SeekStart) + r.NoError(err) + r.Equal(int64(0), i) + + // read again + buf = make([]byte, 6) + n, err = f.Read(buf) + r.NoError(err) + r.Equal(6, n) + r.Equal("Aliqua", string(buf)) + + i, err = f.Seek(-3, io.SeekCurrent) + r.NoError(err) + r.Equal(int64(3), i) + + i, err = f.Seek(12, io.SeekCurrent) + r.NoError(err) + r.Equal(int64(15), i) +} + +func Test_File_BadWrite(t *testing.T) { + r := require.New(t) + f, err := NewFile("foo.txt", nil) + r.NoError(err) + c, err := f.(*virtualFile).write("string") + r.Error(err) + r.Equal(0, c) +} diff --git a/vendor/github.com/gobuffalo/packd/go.mod b/vendor/github.com/gobuffalo/packd/go.mod new file mode 100644 index 000000000..6732bbf59 --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/go.mod @@ -0,0 +1,7 @@ +module github.com/gobuffalo/packd + +require ( + github.com/gobuffalo/syncx v0.0.0-20181120194010-558ac7de985f + github.com/pkg/errors v0.8.0 + github.com/stretchr/testify v1.2.2 +) diff --git a/vendor/github.com/gobuffalo/packd/go.sum b/vendor/github.com/gobuffalo/packd/go.sum new file mode 100644 index 000000000..910029f15 --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/go.sum @@ -0,0 +1,10 @@ +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/gobuffalo/syncx v0.0.0-20181120194010-558ac7de985f h1:S5EeH1reN93KR0L6TQvkRpu9YggCYXrUqFh1iEgvdC0= +github.com/gobuffalo/syncx v0.0.0-20181120194010-558ac7de985f/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= diff --git a/vendor/github.com/gobuffalo/packd/interfaces.go b/vendor/github.com/gobuffalo/packd/interfaces.go new file mode 100644 index 000000000..e8475f0aa --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/interfaces.go @@ -0,0 +1,83 @@ +package packd + +import ( + "fmt" + "io" + "net/http" + "os" +) + +type WalkFunc func(string, File) error + +// Box represents the entirety of the necessary +// interfaces to form a "full" box. +// github.com/gobuffalo/packr#Box is an example of this interface. +type Box interface { + HTTPBox + Lister + Addable + Finder + Walkable + Haser +} + +type Haser interface { + Has(string) bool +} + +type Walker interface { + Walk(wf WalkFunc) error +} + +type Walkable interface { + Walker + WalkPrefix(prefix string, wf WalkFunc) error +} + +type Finder interface { + Find(string) ([]byte, error) + FindString(name string) (string, error) +} + +type HTTPBox interface { + Open(name string) (http.File, error) +} + +type Lister interface { + List() []string +} + +type Addable interface { + AddString(path string, t string) error + AddBytes(path string, t []byte) error +} + +type SimpleFile interface { + fmt.Stringer + io.Reader + io.Writer + Name() string +} + +type HTTPFile interface { + SimpleFile + io.Closer + io.Seeker + Readdir(count int) ([]os.FileInfo, error) + Stat() (os.FileInfo, error) +} + +type File interface { + HTTPFile + FileInfo() (os.FileInfo, error) +} + +// LegacyBox represents deprecated methods +// that older Box implementations might have had. +// github.com/gobuffalo/packr v1 is an example of a LegacyBox. +type LegacyBox interface { + String(name string) string + MustString(name string) (string, error) + Bytes(name string) []byte + MustBytes(name string) ([]byte, error) +} diff --git a/vendor/github.com/gobuffalo/packd/memory_box.go b/vendor/github.com/gobuffalo/packd/memory_box.go new file mode 100644 index 000000000..ccc4590ad --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/memory_box.go @@ -0,0 +1,157 @@ +package packd + +import ( + "bytes" + "net/http" + "os" + "path/filepath" + "sort" + "strings" + + "github.com/gobuffalo/syncx" + "github.com/pkg/errors" +) + +var _ Addable = NewMemoryBox() +var _ Finder = NewMemoryBox() +var _ Lister = NewMemoryBox() +var _ HTTPBox = NewMemoryBox() +var _ Haser = NewMemoryBox() +var _ Walkable = NewMemoryBox() +var _ Box = NewMemoryBox() + +// MemoryBox is a thread-safe, in-memory, implementation of the Box interface. +type MemoryBox struct { + files *syncx.ByteMap +} + +func (m *MemoryBox) Has(path string) bool { + _, ok := m.files.Load(path) + return ok +} + +func (m *MemoryBox) List() []string { + var names []string + m.files.Range(func(key string, value []byte) bool { + names = append(names, key) + return true + }) + + sort.Strings(names) + return names +} + +func (m *MemoryBox) Open(path string) (http.File, error) { + cpath := strings.TrimPrefix(path, "/") + + if filepath.Ext(cpath) == "" { + // it's a directory + return NewDir(path) + } + + if len(cpath) == 0 { + cpath = "index.html" + } + + b, err := m.Find(cpath) + if err != nil { + return nil, err + } + + cpath = filepath.FromSlash(cpath) + + f, err := NewFile(cpath, bytes.NewReader(b)) + if err != nil { + return nil, err + } + return f, nil +} + +func (m *MemoryBox) FindString(path string) (string, error) { + bb, err := m.Find(path) + return string(bb), err +} + +func (m *MemoryBox) Find(path string) (ret []byte, e error) { + res, ok := m.files.Load(path) + if !ok { + + var b []byte + lpath := strings.ToLower(path) + err := m.Walk(func(p string, file File) error { + lp := strings.ToLower(p) + if lp != lpath { + return nil + } + + res := file.String() + b = []byte(res) + return nil + }) + if err != nil { + return b, os.ErrNotExist + } + if len(b) == 0 { + return b, os.ErrNotExist + } + return b, nil + } + return res, nil +} + +func (m *MemoryBox) AddString(path string, t string) error { + return m.AddBytes(path, []byte(t)) +} + +func (m *MemoryBox) AddBytes(path string, t []byte) error { + m.files.Store(path, t) + return nil +} + +func (m *MemoryBox) Walk(wf WalkFunc) error { + var err error + m.files.Range(func(path string, b []byte) bool { + var f File + f, err = NewFile(path, bytes.NewReader(b)) + if err != nil { + return false + } + + err = wf(path, f) + if err != nil { + if errors.Cause(err) == filepath.SkipDir { + err = nil + return true + } + return false + } + + return true + }) + + if errors.Cause(err) == filepath.SkipDir { + return nil + } + return err +} + +func (m *MemoryBox) WalkPrefix(pre string, wf WalkFunc) error { + return m.Walk(func(path string, file File) error { + if strings.HasPrefix(path, pre) { + return wf(path, file) + } + return nil + }) +} + +func (m *MemoryBox) Remove(path string) { + m.files.Delete(path) + m.files.Delete(strings.ToLower(path)) +} + +// NewMemoryBox returns a configured *MemoryBox +func NewMemoryBox() *MemoryBox { + return &MemoryBox{ + files: &syncx.ByteMap{}, + } +} diff --git a/vendor/github.com/gobuffalo/packd/memory_box_test.go b/vendor/github.com/gobuffalo/packd/memory_box_test.go new file mode 100644 index 000000000..4d14428cf --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/memory_box_test.go @@ -0,0 +1,165 @@ +package packd + +import ( + "bytes" + "io" + "net/http" + "net/http/httptest" + "sort" + "strconv" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +var bigString = func() string { + bb := &bytes.Buffer{} + for i := 0; i < 100; i++ { + bb.WriteString("xxxxx") + } + return bb.String() +}() + +func Test_MemoryBox(t *testing.T) { + r := require.New(t) + + box := NewMemoryBox() + + r.False(box.Has("a/a.txt")) + r.NoError(box.AddString("b/b.txt", "B")) + r.NoError(box.AddBytes("a/a.txt", []byte("A"))) + r.True(box.Has("a/a.txt")) + + b, err := box.Find("b/b.txt") + r.NoError(err) + r.Equal([]byte("B"), b) + + s, err := box.FindString("a/a.txt") + r.NoError(err) + r.Equal("A", s) + + r.Equal([]string{"a/a.txt", "b/b.txt"}, box.List()) + + wm := map[string]string{} + box.Walk(func(path string, file File) error { + bb := &bytes.Buffer{} + io.Copy(bb, file) + wm[path] = bb.String() + return nil + }) + + r.Len(wm, 2) + r.Equal("A", wm["a/a.txt"]) + r.Equal("B", wm["b/b.txt"]) + + box.Remove("b/b.txt") + + _, err = box.Find("b/b.txt") + r.Error(err) +} + +func Test_MemoryBox_Caps(t *testing.T) { + r := require.New(t) + + box := NewMemoryBox() + r.NoError(box.AddString("Makefile", "make")) + r.NoError(box.AddString("LICENSE", "MIT")) + r.NoError(box.AddString("main.go", "package main")) + + var names []string + box.Walk(func(path string, f File) error { + names = append(names, path) + return nil + }) + sort.Strings(names) + + exp := []string{"main.go", "LICENSE", "Makefile"} + sort.Strings(exp) + + r.Equal(exp, names) +} + +var httpBox = func() *MemoryBox { + box := NewMemoryBox() + box.AddString("hello.txt", "hello world!") + box.AddString("index.html", "

Index!

") + box.AddString("bigger.txt", bigString) + 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", "/bigger.txt", nil) + r.NoError(err) + + res := httptest.NewRecorder() + + mux.ServeHTTP(res, req) + + r.Equal(200, res.Code) + r.Equal(bigString, strings.TrimSpace(res.Body.String())) + l := res.Header().Get("Content-Length") + r.Equal(strconv.Itoa(len(bigString)), l) +} + +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(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) + res.Flush() + + r.Equal(200, res.Code) + r.Equal("this is my file", strings.TrimSpace(res.Body.String())) + }) + } +} diff --git a/vendor/github.com/gobuffalo/packd/skip_walker.go b/vendor/github.com/gobuffalo/packd/skip_walker.go new file mode 100644 index 000000000..7a297af20 --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/skip_walker.go @@ -0,0 +1,45 @@ +package packd + +import ( + "path/filepath" + "strings" + + "github.com/pkg/errors" +) + +var CommonSkipPrefixes = []string{".", "_", "node_modules", "vendor"} + +// SkipWalker will walk the Walker and call the WalkFunc for files who's directories +// do no match any of the skipPrefixes. If no skipPrefixes are passed, then +// CommonSkipPrefixes is used +func SkipWalker(walker Walker, skipPrefixes []string, wf WalkFunc) error { + if len(skipPrefixes) == 0 { + skipPrefixes = append(skipPrefixes, CommonSkipPrefixes...) + } + return walker.Walk(func(path string, file File) error { + fi, err := file.FileInfo() + if err != nil { + return errors.WithStack(err) + } + + path = strings.Replace(path, "\\", "/", -1) + + parts := strings.Split(path, "/") + if !fi.IsDir() { + parts = parts[:len(parts)-1] + } + + for _, base := range parts { + if base != "." { + for _, skip := range skipPrefixes { + skip = strings.ToLower(skip) + lbase := strings.ToLower(base) + if strings.HasPrefix(lbase, skip) { + return filepath.SkipDir + } + } + } + } + return wf(path, file) + }) +} diff --git a/vendor/github.com/gobuffalo/packd/skip_walker_test.go b/vendor/github.com/gobuffalo/packd/skip_walker_test.go new file mode 100644 index 000000000..7180e2c0a --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/skip_walker_test.go @@ -0,0 +1,42 @@ +package packd + +import ( + "sort" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_SkipWalker(t *testing.T) { + r := require.New(t) + + box := NewMemoryBox() + files := []string{ + "node_modules/foo.js", + ".idea/something", + "main.go", + "actions/app.go", + "_example/foo.go", + "_example/bar.go", + "_EXAMPLE/bar.go", + "actions/app_test.go", + "/go/src/hello_world/node_modules/ejs/README.md", + "/go/src/hello_world/NODE_MODULES/ejs/README.md", + } + + for _, f := range files { + box.AddString(f, f) + } + + var found []string + err := SkipWalker(box, CommonSkipPrefixes, func(path string, file File) error { + found = append(found, path) + return nil + }) + + r.NoError(err) + r.Len(found, 3) + + sort.Strings(found) + r.Equal([]string{"actions/app.go", "actions/app_test.go", "main.go"}, found) +} diff --git a/vendor/github.com/gobuffalo/packd/version.go b/vendor/github.com/gobuffalo/packd/version.go new file mode 100644 index 000000000..4b359093a --- /dev/null +++ b/vendor/github.com/gobuffalo/packd/version.go @@ -0,0 +1,4 @@ +package packd + +// Version of packd +const Version = "v0.0.1" diff --git a/vendor/github.com/gobuffalo/packr/.gitignore b/vendor/github.com/gobuffalo/packr/.gitignore index ee560f72d..157ef96e3 100644 --- a/vendor/github.com/gobuffalo/packr/.gitignore +++ b/vendor/github.com/gobuffalo/packr/.gitignore @@ -1,4 +1,5 @@ *.log +./packr2 .DS_Store doc tmp @@ -31,3 +32,5 @@ gin-bin .vscode/ debug.test .grifter/ +*-packr.go + diff --git a/vendor/github.com/gobuffalo/packr/.gometalinter.json b/vendor/github.com/gobuffalo/packr/.gometalinter.json new file mode 100644 index 000000000..e4f65a36e --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/.gometalinter.json @@ -0,0 +1,3 @@ +{ + "Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"] +} diff --git a/vendor/github.com/gobuffalo/packr/.goreleaser.yml b/vendor/github.com/gobuffalo/packr/.goreleaser.yml index 8bf1b3b34..288f4d5e4 100644 --- a/vendor/github.com/gobuffalo/packr/.goreleaser.yml +++ b/vendor/github.com/gobuffalo/packr/.goreleaser.yml @@ -1,61 +1,32 @@ -project_name: packr -release: - github: - owner: gobuffalo - name: packr - name_template: '{{.Tag}}' -brew: - commit_author: - name: goreleaserbot - email: goreleaser@carlosbecker.com - install: bin.install "packr" +# Code generated by github.com/gobuffalo/release. DO NOT EDIT. +# Edit .goreleaser.yml.plush instead + builds: - - - goos: - - linux - - darwin - - windows - goarch: - - amd64 - - "386" - goarm: - - "6" - main: ./packr/main.go - binary: packr - hooks: - pre: packr - post: packr clean -archive: - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm - }}v{{ .Arm }}{{ end }}' - format: tar.gz - files: - - licence* - - LICENCE* - - license* - - LICENSE* - - readme* - - README* - - changelog* - - CHANGELOG* -fpm: - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm - }}v{{ .Arm }}{{ end }}' - bindir: /usr/local/bin -snapcraft: - name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm - }}v{{ .Arm }}{{ end }}' -snapshot: - name_template: SNAPSHOT-{{ .Commit }} +- + goos: + - darwin + - linux + - windows + env: + - CGO_ENABLED=0 + main: ./packr/main.go + binary: packr + checksum: - name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt' -dist: dist -sign: - cmd: gpg - args: - - --output - - $signature - - --detach-sig - - $artifact - signature: ${artifact}.sig - artifacts: none + name_template: 'checksums.txt' + +snapshot: + name_template: "{{ .Tag }}-next" + +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + +brew: + github: + owner: gobuffalo + name: homebrew-tap + diff --git a/vendor/github.com/gobuffalo/packr/.goreleaser.yml.plush b/vendor/github.com/gobuffalo/packr/.goreleaser.yml.plush new file mode 100644 index 000000000..1d25c9a74 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/.goreleaser.yml.plush @@ -0,0 +1,29 @@ +builds: +- + goos: + - darwin + - linux + - windows + env: + - CGO_ENABLED=0 + main: ./packr/main.go + binary: packr + +checksum: + name_template: 'checksums.txt' + +snapshot: + name_template: "{{ .Tag }}-next" + +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' +<%= if (brew) { %> +brew: + github: + owner: gobuffalo + name: homebrew-tap +<% } %> diff --git a/vendor/github.com/gobuffalo/packr/.travis.yml b/vendor/github.com/gobuffalo/packr/.travis.yml index 5241498bb..e3b7179cb 100644 --- a/vendor/github.com/gobuffalo/packr/.travis.yml +++ b/vendor/github.com/gobuffalo/packr/.travis.yml @@ -2,14 +2,36 @@ language: go sudo: false -go: - - 1.8 - - 1.9 - - tip - matrix: - allow_failures: - - go: 'tip' + include: + - os: linux + go: "1.9.x" + - os: windows + go: "1.9.x" + - os: linux + go: "1.10.x" + - os: windows + go: "1.10.x" + - os: linux + go: "1.11.x" + env: + - GO111MODULE=off + - os: windows + go: "1.11.x" + env: + - GO111MODULE=off + - os: linux + go: "1.11.x" + env: + - GO111MODULE=on + - os: windows + go: "1.11.x" + env: + - GO111MODULE=on + +install: false script: - - go test -v ./... + - ./travis.sh + - cd v2 && ./travis.sh + diff --git a/vendor/github.com/gobuffalo/packr/Makefile b/vendor/github.com/gobuffalo/packr/Makefile new file mode 100644 index 000000000..b60c437dc --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/Makefile @@ -0,0 +1,64 @@ +TAGS ?= "sqlite" +GO_BIN ?= go + +install: deps + echo "installing packr v1" + packr + $(GO_BIN) install -v ./packr + +tidy: +ifeq ($(GO111MODULE),on) + $(GO_BIN) mod tidy +else + echo skipping go mod tidy +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 + make tidy + +build: deps + packr + $(GO_BIN) build -v . + make tidy + +test: + packr clean + $(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} + make tidy + packr + make test + make install + make tidy + +release-test: + $(GO_BIN) test -tags ${TAGS} -race ./... + +release: + release -y -f version.go + make tidy diff --git a/vendor/github.com/gobuffalo/packr/README.md b/vendor/github.com/gobuffalo/packr/README.md index d1144b1c4..f7b50b905 100644 --- a/vendor/github.com/gobuffalo/packr/README.md +++ b/vendor/github.com/gobuffalo/packr/README.md @@ -1,7 +1,11 @@ -# packr +# 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. + +--- + 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 @@ -10,8 +14,16 @@ To get an idea of the what and why of packr, please enjoy this short video: [htt ## Installation +To install Packr utility + ```text -$ go get -u github.com/gobuffalo/packr/... +$ go get -u github.com/gobuffalo/packr/packr +``` + +To get the dependency + +```text +$ go get -u github.com/gobuffalo/packr ``` ## Usage @@ -24,17 +36,11 @@ The first step in using Packr is to create a new box. A box represents a folder // set up a new box by giving it a (relative) path to a folder on disk: box := packr.NewBox("./templates") -// Get the string representation of a file: -html := box.String("index.html") - // Get the string representation of a file, or an error if it doesn't exist: -html, err := box.MustString("index.html") - -// Get the []byte representation of a file: -html := box.Bytes("index.html") +html, err := box.FindString("index.html") // Get the []byte representation of a file, or an error if it doesn't exist: -html, err := box.MustBytes("index.html") +html, err := box.FindBytes("index.html") ``` ### What is a Box? @@ -59,16 +65,19 @@ The following program will read the `./templates/admin/index.html` file and prin package main import ( - "fmt" + "fmt" - "github.com/gobuffalo/packr" + "github.com/gobuffalo/packr" ) func main() { - box := packr.NewBox("./templates") + box := packr.NewBox("./templates") - s := box.String("admin/index.html") - fmt.Println(s) + s, err := box.FindString("admin/index.html") + if err != nil { + log.Fatal(err) + } + fmt.Println(s) } ``` @@ -85,7 +94,7 @@ Packr uses the following resolution rules when looking for a file: 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 recieves 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. +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. --- @@ -97,16 +106,16 @@ 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" ) func main() { - box := packr.NewBox("./templates") + box := packr.NewBox("./templates") - http.Handle("/", http.FileServer(box)) - http.ListenAndServe(":3000", nil) + http.Handle("/", http.FileServer(box)) + http.ListenAndServe(":3000", nil) } ``` @@ -140,6 +149,57 @@ Why do you want to do this? Packr first looks to the information stored in these --- +## Building/Moving a portable release + +When it comes to building multiple releases you typically want that release to be built in a specific directory. + +For example: `./releases` + +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 +``` + +Now your `project_name` binary will be built at the root of your project dir. Great! + +All that is left to do is to move that binary to your release dir: + +Linux/macOS/Windows (bash) + +```bash +mv ./project_name ./releases +``` + +Windows (cmd): + +```cmd +move ./project_name ./releases +``` + +Powershell: + +```powershell +Move-Item -Path .\project_name -Destination .\releases\ +``` + +If you _target_ for Windows when building don't forget that it's `project_name.exe` + +Now you can make multiple releases and all of your needed static files will be available! + +#### Summing it up: + +Example Script for building to 3 common targets: + +```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 +``` + +--- + ## Debugging 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. diff --git a/vendor/github.com/gobuffalo/packr/SHOULDERS.md b/vendor/github.com/gobuffalo/packr/SHOULDERS.md new file mode 100644 index 000000000..50318cc44 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/SHOULDERS.md @@ -0,0 +1,26 @@ +# github.com/gobuffalo/packr 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. + +Thank you to the following **GIANTS**: + + +* [github.com/gobuffalo/envy](https://godoc.org/github.com/gobuffalo/envy) + +* [github.com/gobuffalo/packd](https://godoc.org/github.com/gobuffalo/packd) + +* [github.com/gobuffalo/packr](https://godoc.org/github.com/gobuffalo/packr) + +* [github.com/gobuffalo/syncx](https://godoc.org/github.com/gobuffalo/syncx) + +* [github.com/joho/godotenv](https://godoc.org/github.com/joho/godotenv) + +* [github.com/markbates/oncer](https://godoc.org/github.com/markbates/oncer) + +* [github.com/pkg/errors](https://godoc.org/github.com/pkg/errors) + +* [github.com/rogpeppe/go-internal/modfile](https://godoc.org/github.com/rogpeppe/go-internal/modfile) + +* [github.com/rogpeppe/go-internal/module](https://godoc.org/github.com/rogpeppe/go-internal/module) + +* [github.com/rogpeppe/go-internal/semver](https://godoc.org/github.com/rogpeppe/go-internal/semver) diff --git a/vendor/github.com/gobuffalo/packr/box.go b/vendor/github.com/gobuffalo/packr/box.go index 30eb6e203..0c9396efa 100644 --- a/vendor/github.com/gobuffalo/packr/box.go +++ b/vendor/github.com/gobuffalo/packr/box.go @@ -11,13 +11,24 @@ import ( "runtime" "strings" + "github.com/gobuffalo/packd" + "github.com/markbates/oncer" "github.com/pkg/errors" ) var ( + // ErrResOutsideBox gets returned in case of the requested resources being outside the box ErrResOutsideBox = errors.New("Can't find a resource outside the 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{} + // NewBox returns a Box that can be used to // retrieve files from either disk or the embedded // binary. @@ -51,35 +62,54 @@ type Box struct { directories map[string]bool } -func (b Box) AddString(path string, t string) { +// 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 } -func (b Box) AddBytes(path string, t []byte) { +// 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 } -// String of the file asked for or an empty string. +// String is deprecated. Use Find instead func (b Box) String(name string) string { - return string(b.Bytes(name)) + oncer.Deprecate(0, "github.com/gobuffalo/packr#Box.String", "Use github.com/gobuffalo/packr#Box.FindString instead.") + bb, _ := b.FindString(name) + return bb } -// MustString returns either the string of the requested -// file or an error if it can not be found. +// MustString is deprecated. Use FindString instead func (b Box) MustString(name string) (string, error) { - bb, err := b.MustBytes(name) - return string(bb), err + oncer.Deprecate(0, "github.com/gobuffalo/packr#Box.MustString", "Use github.com/gobuffalo/packr#Box.FindString instead.") + return b.FindString(name) } -// Bytes of the file asked for or an empty byte slice. +// Bytes is deprecated. Use Find instead func (b Box) Bytes(name string) []byte { - bb, _ := b.MustBytes(name) + oncer.Deprecate(0, "github.com/gobuffalo/packr#Box.Bytes", "Use github.com/gobuffalo/packr#Box.Find instead.") + bb, _ := b.Find(name) return bb } -// MustBytes returns either the byte slice of the requested -// file or an error if it can not be found. +// Bytes is deprecated. Use Find instead func (b Box) MustBytes(name string) ([]byte, error) { + oncer.Deprecate(0, "github.com/gobuffalo/packr#Box.MustBytes", "Use github.com/gobuffalo/packr#Box.Find instead.") + return b.Find(name) +} + +// 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.find(name) if err == nil { bb := &bytes.Buffer{} @@ -112,8 +142,9 @@ func (b Box) decompress(bb []byte) []byte { func (b Box) find(name string) (File, error) { if bb, ok := b.data[name]; ok { - return newVirtualFile(name, bb), nil + return packd.NewFile(name, bytes.NewReader(bb)) } + if b.directories == nil { b.indexDirectories() } @@ -126,20 +157,19 @@ func (b Box) find(name string) (File, error) { // Absolute name is considered as relative to the box root cleanName = strings.TrimPrefix(cleanName, "/") - // Try to get the resource from the box if _, ok := data[b.Path]; ok { if bb, ok := data[b.Path][cleanName]; ok { bb = b.decompress(bb) - return newVirtualFile(cleanName, bb), nil + 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 } - if _, ok := b.directories[cleanName]; ok { - return newVirtualDir(cleanName), nil - } return nil, os.ErrNotExist } @@ -149,46 +179,6 @@ func (b Box) find(name string) (File, error) { return fileFor(p, cleanName) } -type WalkFunc func(string, File) error - -func (b Box) Walk(wf WalkFunc) error { - if data[b.Path] == nil { - base, err := filepath.EvalSymlinks(filepath.Join(b.callingDir, b.Path)) - if err != nil { - return errors.WithStack(err) - } - 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 - } - - file, err := fileFor(path, cleanName) - if err != nil { - return err - } - return wf(cleanName, file) - }) - } - for n := range data[b.Path] { - f, err := b.find(n) - if err != nil { - return err - } - err = wf(n, f) - if err != nil { - return err - } - } - return nil -} - // Open returns a File using the http.File interface func (b Box) Open(name string) (http.File, error) { return b.find(name) @@ -232,10 +222,10 @@ func fileFor(p string, name string) (File, error) { return nil, err } if fi.IsDir() { - return newVirtualDir(p), nil + return packd.NewDir(p) } if bb, err := ioutil.ReadFile(p); err == nil { - return newVirtualFile(name, bb), nil + return packd.NewFile(name, bytes.NewReader(bb)) } return nil, os.ErrNotExist } diff --git a/vendor/github.com/gobuffalo/packr/box_test.go b/vendor/github.com/gobuffalo/packr/box_test.go index 22de39f21..c5cf9cac3 100644 --- a/vendor/github.com/gobuffalo/packr/box_test.go +++ b/vendor/github.com/gobuffalo/packr/box_test.go @@ -12,27 +12,23 @@ import ( "github.com/stretchr/testify/require" ) -func Test_Box_String(t *testing.T) { +func Test_Box_FindString(t *testing.T) { r := require.New(t) - s := testBox.String("hello.txt") + s, err := testBox.FindString("hello.txt") + r.NoError(err) r.Equal("hello world!", strings.TrimSpace(s)) -} -func Test_Box_MustString(t *testing.T) { - r := require.New(t) - _, err := testBox.MustString("idontexist.txt") + _, err = testBox.Find("idontexist.txt") r.Error(err) } -func Test_Box_Bytes(t *testing.T) { +func Test_Box_FindBytes(t *testing.T) { r := require.New(t) - s := testBox.Bytes("hello.txt") + s, err := testBox.Find("hello.txt") + r.NoError(err) r.Equal([]byte("hello world!"), bytes.TrimSpace(s)) -} -func Test_Box_MustBytes(t *testing.T) { - r := require.New(t) - _, err := testBox.MustBytes("idontexist.txt") + _, err = testBox.Find("idontexist.txt") r.Error(err) } @@ -42,28 +38,6 @@ func Test_Box_Has(t *testing.T) { r.False(testBox.Has("idontexist.txt")) } -func Test_Box_Walk_Physical(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) -} - func Test_List_Virtual(t *testing.T) { r := require.New(t) mustHave := []string{"a", "b", "c", "d/a"} @@ -74,7 +48,7 @@ func Test_List_Virtual(t *testing.T) { func Test_List_Physical(t *testing.T) { r := require.New(t) - mustHave := []string{"goodbye.txt", "hello.txt", "index.html"} + mustHave := osPaths("MyFile.txt", "foo/a.txt", "foo/bar/b.txt", "goodbye.txt", "hello.txt", "index.html") actual := testBox.List() r.Equal(mustHave, actual) } @@ -84,7 +58,7 @@ func Test_Outside_Box(t *testing.T) { f, err := ioutil.TempFile("", "") r.NoError(err) defer os.RemoveAll(f.Name()) - _, err = testBox.MustString(f.Name()) + _, err = testBox.FindString(f.Name()) r.Error(err) } @@ -99,6 +73,10 @@ func Test_Box_find(t *testing.T) { {"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}, } for _, tt := range table { @@ -127,25 +105,25 @@ func Test_Virtual_Directory_Not_Found(t *testing.T) { func Test_AddString(t *testing.T) { r := require.New(t) - _, err := virtualBox.find("string") + _, err := virtualBox.Find("string") r.Error(err) virtualBox.AddString("string", "hello") - _, err = virtualBox.find("string") + s, err := virtualBox.FindString("string") r.NoError(err) - r.Equal("hello", virtualBox.String("string")) + r.Equal("hello", s) } func Test_AddBytes(t *testing.T) { r := require.New(t) - _, err := virtualBox.find("bytes") + _, err := virtualBox.Find("bytes") r.Error(err) virtualBox.AddBytes("bytes", []byte("hello")) - _, err = virtualBox.find("bytes") + s, err := virtualBox.Find("bytes") r.NoError(err) - r.Equal("hello", virtualBox.String("bytes")) + r.Equal([]byte("hello"), s) } diff --git a/vendor/github.com/gobuffalo/packr/builder/builder.go b/vendor/github.com/gobuffalo/packr/builder/builder.go index e3ddb3e16..1e0023908 100644 --- a/vendor/github.com/gobuffalo/packr/builder/builder.go +++ b/vendor/github.com/gobuffalo/packr/builder/builder.go @@ -47,9 +47,16 @@ func (b *Builder) Run() error { } base := strings.ToLower(filepath.Base(path)) + if strings.HasPrefix(base, "_") { + return filepath.SkipDir + } for _, f := range b.IgnoredFolders { if strings.ToLower(f) == base { - return filepath.SkipDir + if info.IsDir() { + return filepath.SkipDir + } else { + return nil + } } } if !info.IsDir() { diff --git a/vendor/github.com/gobuffalo/packr/builder/builder_test.go b/vendor/github.com/gobuffalo/packr/builder/builder_test.go index 97b5b7c89..b67f6e121 100644 --- a/vendor/github.com/gobuffalo/packr/builder/builder_test.go +++ b/vendor/github.com/gobuffalo/packr/builder/builder_test.go @@ -5,11 +5,9 @@ import ( "context" "io/ioutil" "os" - "os/exec" "path/filepath" "testing" - "github.com/gobuffalo/packr" "github.com/stretchr/testify/require" ) @@ -17,13 +15,12 @@ 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") - r.False(fileExists(exPackr)) fooPackr := filepath.Join(root, "foo", "a_foo-packr.go") - r.False(fileExists(fooPackr)) b := New(context.Background(), root) err := b.Run() @@ -52,10 +49,8 @@ func Test_Builder_Run_Compress(t *testing.T) { defer Clean(root) exPackr := filepath.Join(root, "a_example-packr.go") - r.False(fileExists(exPackr)) fooPackr := filepath.Join(root, "foo", "a_foo-packr.go") - r.False(fileExists(fooPackr)) b := New(context.Background(), root) b.Compress = true @@ -77,27 +72,6 @@ func Test_Builder_Run_Compress(t *testing.T) { r.True(bytes.Contains(bb, []byte(`packr.PackJSONBytes("../templates", "index.html", "\"H4sIAAAAAAAA`))) } -func Test_Binary_Builds(t *testing.T) { - r := require.New(t) - pwd, _ := os.Getwd() - defer os.Chdir(pwd) - - root := "../example" - defer Clean(root) - defer os.RemoveAll(filepath.Join(root, "bin")) - - b := New(context.Background(), root) - err := b.Run() - r.NoError(err) - - os.Chdir(root) - cmd := exec.Command(packr.GoBin(), "build", "-v", "-o", "bin/example") - err = cmd.Run() - r.NoError(err) - - r.True(fileExists("bin/example")) -} - func fileExists(path string) bool { _, err := os.Stat(path) return err == nil diff --git a/vendor/github.com/gobuffalo/packr/builder/clean.go b/vendor/github.com/gobuffalo/packr/builder/clean.go index 688ebf5de..e68b39810 100644 --- a/vendor/github.com/gobuffalo/packr/builder/clean.go +++ b/vendor/github.com/gobuffalo/packr/builder/clean.go @@ -1,32 +1,38 @@ package builder import ( - "fmt" "os" "path/filepath" - "strings" + "github.com/gobuffalo/packr/v2/jam/parser" + "github.com/gobuffalo/packr/v2/jam/store" "github.com/pkg/errors" ) // Clean up an *-packr.go files -func Clean(root string) { - root, _ = filepath.EvalSymlinks(root) - filepath.Walk(root, func(path string, info os.FileInfo, err error) error { - base := filepath.Base(path) - if base == ".git" || base == "vendor" || base == "node_modules" { - return filepath.SkipDir - } - if info == nil || info.IsDir() { - return nil - } - if strings.Contains(base, "-packr.go") { - err := os.Remove(path) - if err != nil { - fmt.Println(err) - return errors.WithStack(err) - } - } - return nil +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 errors.WithStack(err) + } + + boxes, err := p.Run() + if err != nil { + return errors.WithStack(err) + } + + d := store.NewDisk("", "") + for _, box := range boxes { + if err := d.Clean(box); err != nil { + return errors.WithStack(err) + } + } + return nil } diff --git a/vendor/github.com/gobuffalo/packr/builder/tmpl.go b/vendor/github.com/gobuffalo/packr/builder/tmpl.go index ffe47c19b..2b335adc3 100644 --- a/vendor/github.com/gobuffalo/packr/builder/tmpl.go +++ b/vendor/github.com/gobuffalo/packr/builder/tmpl.go @@ -1,6 +1,6 @@ package builder -var tmpl = `// Code generated by github.com/gobuffalo/packr. DO NOT EDIT +var tmpl = `// Code generated by github.com/gobuffalo/packr. DO NOT EDIT. package {{.Name}} @@ -11,7 +11,7 @@ import "github.com/gobuffalo/packr" func init() { {{- range $box := .Boxes }} {{- range .Files }} - packr.PackJSONBytes("{{$box.Name}}", "{{.Name}}", "{{.Contents}}") + packr.PackJSONBytes("{{$box.Name}}", "{{.Name}}", "{{.Contents}}") {{- end }} {{- end }} } diff --git a/vendor/github.com/gobuffalo/packr/env.go b/vendor/github.com/gobuffalo/packr/env.go index 2c744e71a..8ec70b56e 100644 --- a/vendor/github.com/gobuffalo/packr/env.go +++ b/vendor/github.com/gobuffalo/packr/env.go @@ -1,27 +1,13 @@ package packr import ( - "go/build" - "os" - "strings" + "github.com/gobuffalo/envy" ) // GoPath returns the current GOPATH env var // or if it's missing, the default. -func GoPath() string { - go_path := strings.Split(os.Getenv("GOPATH"), string(os.PathListSeparator)) - if len(go_path) == 0 || go_path[0] == "" { - return build.Default.GOPATH - } - return go_path[0] -} +var GoPath = envy.GoPath // GoBin returns the current GO_BIN env var // or if it's missing, a default of "go" -func GoBin() string { - go_bin := os.Getenv("GO_BIN") - if go_bin == "" { - return "go" - } - return go_bin -} +var GoBin = envy.GoBin diff --git a/vendor/github.com/gobuffalo/packr/example/bar/sub/sub.html b/vendor/github.com/gobuffalo/packr/example/bar/sub/sub.html new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/gobuffalo/packr/example/example.go b/vendor/github.com/gobuffalo/packr/example/example.go index 835f49477..96a798100 100644 --- a/vendor/github.com/gobuffalo/packr/example/example.go +++ b/vendor/github.com/gobuffalo/packr/example/example.go @@ -13,7 +13,6 @@ type S struct{} func (S) f(packr.Box) {} func init() { - // packr.NewBox("../idontexists") b := "./variable" packr.NewBox(b) diff --git a/vendor/github.com/gobuffalo/packr/file.go b/vendor/github.com/gobuffalo/packr/file.go index 8337d6210..8d24b7303 100644 --- a/vendor/github.com/gobuffalo/packr/file.go +++ b/vendor/github.com/gobuffalo/packr/file.go @@ -1,15 +1,5 @@ package packr -import ( - "io" - "os" -) +import "github.com/gobuffalo/packd" -type File interface { - io.ReadCloser - io.Writer - FileInfo() (os.FileInfo, error) - Readdir(count int) ([]os.FileInfo, error) - Seek(offset int64, whence int) (int64, error) - Stat() (os.FileInfo, error) -} +type File = packd.File diff --git a/vendor/github.com/gobuffalo/packr/fixtures/MyFile.txt b/vendor/github.com/gobuffalo/packr/fixtures/MyFile.txt new file mode 100644 index 000000000..61aae3e95 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/fixtures/MyFile.txt @@ -0,0 +1 @@ +this is my file diff --git a/vendor/github.com/gobuffalo/packr/fixtures/foo/a.txt b/vendor/github.com/gobuffalo/packr/fixtures/foo/a.txt new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/gobuffalo/packr/fixtures/foo/bar/b.txt b/vendor/github.com/gobuffalo/packr/fixtures/foo/bar/b.txt new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/gobuffalo/packr/go.mod b/vendor/github.com/gobuffalo/packr/go.mod index 482c1a877..c795b3f18 100644 --- a/vendor/github.com/gobuffalo/packr/go.mod +++ b/vendor/github.com/gobuffalo/packr/go.mod @@ -1,3 +1,13 @@ module github.com/gobuffalo/packr -require github.com/pkg/errors v0.8.0 +require ( + github.com/gobuffalo/envy v1.6.11 + github.com/gobuffalo/packd v0.0.0-20181212173646-eca3b8fd6687 + github.com/gobuffalo/packr/v2 v2.0.0-rc.13 + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2 + github.com/pkg/errors v0.8.0 + github.com/spf13/cobra v0.0.3 + github.com/stretchr/testify v1.2.2 + golang.org/x/sync v0.0.0-20181108010431-42b317875d0f +) diff --git a/vendor/github.com/gobuffalo/packr/go.sum b/vendor/github.com/gobuffalo/packr/go.sum new file mode 100644 index 000000000..2d2e988b3 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/go.sum @@ -0,0 +1,388 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= +github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/ajg/form v0.0.0-20160822230020-523a5da1a92f/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= +github.com/codegangsta/negroni v1.0.0/go.mod h1:v0y3T5G7Y1UlFfyxFn/QLRU4a2EuNau2iZY63YTKWo0= +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/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/dustin/go-humanize v0.0.0-20180713052910-9f541cc9db5d/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/gobuffalo/buffalo v0.12.8-0.20181004233540-fac9bb505aa8/go.mod h1:sLyT7/dceRXJUxSsE813JTQtA3Eb1vjxWfo/N//vXIY= +github.com/gobuffalo/buffalo v0.13.0/go.mod h1:Mjn1Ba9wpIbpbrD+lIDMy99pQ0H0LiddMIIDGse7qT4= +github.com/gobuffalo/buffalo-plugins v1.0.2/go.mod h1:pOp/uF7X3IShFHyobahTkTLZaeUXwb0GrUTb9ngJWTs= +github.com/gobuffalo/buffalo-plugins v1.0.4/go.mod h1:pWS1vjtQ6uD17MVFWf7i3zfThrEKWlI5+PYLw/NaDB4= +github.com/gobuffalo/buffalo-plugins v1.4.3/go.mod h1:uCzTY0woez4nDMdQjkcOYKanngeUVRO2HZi7ezmAjWY= +github.com/gobuffalo/buffalo-plugins v1.5.1/go.mod h1:jbmwSZK5+PiAP9cC09VQOrGMZFCa/P0UMlIS3O12r5w= +github.com/gobuffalo/buffalo-plugins v1.6.4/go.mod h1:/+N1aophkA2jZ1ifB2O3Y9yGwu6gKOVMtUmJnbg+OZI= +github.com/gobuffalo/buffalo-plugins v1.6.5/go.mod h1:0HVkbgrVs/MnPZ/FOseDMVanCTm2RNcdM0PuXcL1NNI= +github.com/gobuffalo/buffalo-plugins v1.6.7/go.mod h1:ZGZRkzz2PiKWHs0z7QsPBOTo2EpcGRArMEym6ghKYgk= +github.com/gobuffalo/buffalo-plugins v1.6.9/go.mod h1:yYlYTrPdMCz+6/+UaXg5Jm4gN3xhsvsQ2ygVatZV5vw= +github.com/gobuffalo/buffalo-plugins v1.6.11/go.mod h1:eAA6xJIL8OuynJZ8amXjRmHND6YiusVAaJdHDN1Lu8Q= +github.com/gobuffalo/buffalo-plugins v1.8.2/go.mod h1:9te6/VjEQ7pKp7lXlDIMqzxgGpjlKoAcAANdCgoR960= +github.com/gobuffalo/buffalo-plugins v1.8.3 h1:LEbQCqCKSSQgX8Sfq2dGs2o7bDT4s6TZJWwWUNQKsF0= +github.com/gobuffalo/buffalo-plugins v1.8.3/go.mod h1:IAWq6vjZJVXebIq2qGTLOdlXzmpyTZ5iJG5b59fza5U= +github.com/gobuffalo/buffalo-pop v1.0.5/go.mod h1:Fw/LfFDnSmB/vvQXPvcXEjzP98Tc+AudyNWUBWKCwQ8= +github.com/gobuffalo/envy v1.6.4/go.mod h1:Abh+Jfw475/NWtYMEt+hnJWRiC8INKWibIMyNt1w2Mc= +github.com/gobuffalo/envy v1.6.5/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.6/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.7/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.8/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.9/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.10/go.mod h1:X0CFllQjTV5ogsnUrg+Oks2yTI+PU2dGYBJOEI2D1Uo= +github.com/gobuffalo/envy v1.6.11 h1:dCKSFypLRvqaaUtyzkfKKF2j35ce5agsqfyIrRmm02E= +github.com/gobuffalo/envy v1.6.11/go.mod h1:Fiq52W7nrHGDggFPhn2ZCcHw4u/rqXkqo+i7FB6EAcg= +github.com/gobuffalo/events v1.0.3/go.mod h1:Txo8WmqScapa7zimEQIwgiJBvMECMe9gJjsKNPN3uZw= +github.com/gobuffalo/events v1.0.7/go.mod h1:z8txf6H9jWhQ5Scr7YPLWg/cgXBRj8Q4uYI+rsVCCSQ= +github.com/gobuffalo/events v1.0.8/go.mod h1:A5KyqT1sA+3GJiBE4QKZibse9mtOcI9nw8gGrDdqYGs= +github.com/gobuffalo/events v1.1.3/go.mod h1:9yPGWYv11GENtzrIRApwQRMYSbUgCsZ1w6R503fCfrk= +github.com/gobuffalo/events v1.1.4/go.mod h1:09/YRRgZHEOts5Isov+g9X2xajxdvOAcUuAHIX/O//A= +github.com/gobuffalo/events v1.1.5/go.mod h1:3YUSzgHfYctSjEjLCWbkXP6djH2M+MLaVRzb4ymbAK0= +github.com/gobuffalo/events v1.1.7/go.mod h1:6fGqxH2ing5XMb3EYRq9LEkVlyPGs4oO/eLzh+S8CxY= +github.com/gobuffalo/events v1.1.8 h1:T9SXUVyO1kF61uns5a8cpqsSPj5txZgIplbOoNNltqk= +github.com/gobuffalo/events v1.1.8/go.mod h1:UFy+W6X6VbCWS8k2iT81HYX65dMtiuVycMy04cplt/8= +github.com/gobuffalo/fizz v1.0.12/go.mod h1:C0sltPxpYK8Ftvf64kbsQa2yiCZY4RZviurNxXdAKwc= +github.com/gobuffalo/flect v0.0.0-20180907193754-dc14d8acaf9f/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181002182613-4571df4b1daf/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181007231023-ae7ed6bfe683/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181018182602-fd24a256709f/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181019110701-3d6f0b585514/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181024204909-8f6be1a8c6c2/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181104133451-1f6e9779237a/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181114183036-47375f6d8328 h1:nvA0/snr4wQeCwBYmrbftniJun/kxOjK/Pz3ivb7wis= +github.com/gobuffalo/flect v0.0.0-20181114183036-47375f6d8328/go.mod h1:0HvNbHdfh+WOvDSIASqJOSxTOWSxCCUF++k/Y53v9rI= +github.com/gobuffalo/genny v0.0.0-20180924032338-7af3a40f2252/go.mod h1:tUTQOogrr7tAQnhajMSH6rv1BVev34H2sa1xNHMy94g= +github.com/gobuffalo/genny v0.0.0-20181003150629-3786a0744c5d/go.mod h1:WAd8HmjMVrnkAZbmfgH5dLBUchsZfqzp/WS5sQz+uTM= +github.com/gobuffalo/genny v0.0.0-20181005145118-318a41a134cc/go.mod h1:WAd8HmjMVrnkAZbmfgH5dLBUchsZfqzp/WS5sQz+uTM= +github.com/gobuffalo/genny v0.0.0-20181007153042-b8de7d566757/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA= +github.com/gobuffalo/genny v0.0.0-20181012161047-33e5f43d83a6/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA= +github.com/gobuffalo/genny v0.0.0-20181017160347-90a774534246/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA= +github.com/gobuffalo/genny v0.0.0-20181024195656-51392254bf53/go.mod h1:o9GEH5gn5sCKLVB5rHFC4tq40rQ3VRUzmx6WwmaqISE= +github.com/gobuffalo/genny v0.0.0-20181025145300-af3f81d526b8/go.mod h1:uZ1fFYvdcP8mu0B/Ynarf6dsGvp7QFIpk/QACUuFUVI= +github.com/gobuffalo/genny v0.0.0-20181027191429-94d6cfb5c7fc/go.mod h1:x7SkrQQBx204Y+O9EwRXeszLJDTaWN0GnEasxgLrQTA= +github.com/gobuffalo/genny v0.0.0-20181027195209-3887b7171c4f/go.mod h1:JbKx8HSWICu5zyqWOa0dVV1pbbXOHusrSzQUprW6g+w= +github.com/gobuffalo/genny v0.0.0-20181106193839-7dcb0924caf1/go.mod h1:x61yHxvbDCgQ/7cOAbJCacZQuHgB0KMSzoYcw5debjU= +github.com/gobuffalo/genny v0.0.0-20181107223128-f18346459dbe/go.mod h1:utQD3aKKEsdb03oR+Vi/6ztQb1j7pO10N3OBoowRcSU= +github.com/gobuffalo/genny v0.0.0-20181114215459-0a4decd77f5d/go.mod h1:kN2KZ8VgXF9VIIOj/GM0Eo7YK+un4Q3tTreKOf0q1ng= +github.com/gobuffalo/genny v0.0.0-20181119162812-e8ff4adce8bb/go.mod h1:BA9htSe4bZwBDJLe8CUkoqkypq3hn3+CkoHqVOW718E= +github.com/gobuffalo/genny v0.0.0-20181127225641-2d959acc795b/go.mod h1:l54xLXNkteX/PdZ+HlgPk1qtcrgeOr3XUBBPDbH+7CQ= +github.com/gobuffalo/genny v0.0.0-20181128191930-77e34f71ba2a/go.mod h1:FW/D9p7cEEOqxYA71/hnrkOWm62JZ5ZNxcNIVJEaWBU= +github.com/gobuffalo/genny v0.0.0-20181203165245-fda8bcce96b1/go.mod h1:wpNSANu9UErftfiaAlz1pDZclrYzLtO5lALifODyjuM= +github.com/gobuffalo/genny v0.0.0-20181203201232-849d2c9534ea/go.mod h1:wpNSANu9UErftfiaAlz1pDZclrYzLtO5lALifODyjuM= +github.com/gobuffalo/genny v0.0.0-20181206121324-d6fb8a0dbe36/go.mod h1:wpNSANu9UErftfiaAlz1pDZclrYzLtO5lALifODyjuM= +github.com/gobuffalo/genny v0.0.0-20181207164119-84844398a37d/go.mod h1:y0ysCHGGQf2T3vOhCrGHheYN54Y/REj0ayd0Suf4C/8= +github.com/gobuffalo/genny v0.0.0-20181211165820-e26c8466f14d h1:E9vKkmvd+KhQeOoKvcT4zveTKddiTopk6VifuxuO5LA= +github.com/gobuffalo/genny v0.0.0-20181211165820-e26c8466f14d/go.mod h1:sHnK+ZSU4e2feXP3PA29ouij6PUEiN+RCwECjCTB3yM= +github.com/gobuffalo/github_flavored_markdown v1.0.4/go.mod h1:uRowCdK+q8d/RF0Kt3/DSalaIXbb0De/dmTqMQdkQ4I= +github.com/gobuffalo/github_flavored_markdown v1.0.5/go.mod h1:U0643QShPF+OF2tJvYNiYDLDGDuQmJZXsf/bHOJPsMY= +github.com/gobuffalo/github_flavored_markdown v1.0.7 h1:Vjvz4wqOnviiLEfTh5bh270b3lhpJiwwQEWOWmHMwY8= +github.com/gobuffalo/github_flavored_markdown v1.0.7/go.mod h1:w93Pd9Lz6LvyQXEG6DktTPHkOtCbr+arAD5mkwMzXLI= +github.com/gobuffalo/httptest v1.0.2/go.mod h1:7T1IbSrg60ankme0aDLVnEY0h056g9M1/ZvpVThtB7E= +github.com/gobuffalo/licenser v0.0.0-20180924033006-eae28e638a42/go.mod h1:Ubo90Np8gpsSZqNScZZkVXXAo5DGhTb+WYFIjlnog8w= +github.com/gobuffalo/licenser v0.0.0-20181025145548-437d89de4f75/go.mod h1:x3lEpYxkRG/XtGCUNkio+6RZ/dlOvLzTI9M1auIwFcw= +github.com/gobuffalo/licenser v0.0.0-20181027200154-58051a75da95/go.mod h1:BzhaaxGd1tq1+OLKObzgdCV9kqVhbTulxOpYbvMQWS0= +github.com/gobuffalo/licenser v0.0.0-20181109171355-91a2a7aac9a7/go.mod h1:m+Ygox92pi9bdg+gVaycvqE8RVSjZp7mWw75+K5NPHk= +github.com/gobuffalo/licenser v0.0.0-20181128165715-cc7305f8abed/go.mod h1:oU9F9UCE+AzI/MueCKZamsezGOOHfSirltllOVeRTAE= +github.com/gobuffalo/licenser v0.0.0-20181203160806-fe900bbede07/go.mod h1:ph6VDNvOzt1CdfaWC+9XwcBnlSTBz2j49PBwum6RFaU= +github.com/gobuffalo/logger v0.0.0-20181022175615-46cfb361fc27/go.mod h1:8sQkgyhWipz1mIctHF4jTxmJh1Vxhp7mP8IqbljgJZo= +github.com/gobuffalo/logger v0.0.0-20181027144941-73d08d2bb969/go.mod h1:7uGg2duHKpWnN4+YmyKBdLXfhopkAdVM6H3nKbyFbz8= +github.com/gobuffalo/logger v0.0.0-20181027193913-9cf4dd0efe46/go.mod h1:7uGg2duHKpWnN4+YmyKBdLXfhopkAdVM6H3nKbyFbz8= +github.com/gobuffalo/logger v0.0.0-20181109185836-3feeab578c17/go.mod h1:oNErH0xLe+utO+OW8ptXMSA5DkiSEDW1u3zGIt8F9Ew= +github.com/gobuffalo/logger v0.0.0-20181117211126-8e9b89b7c264/go.mod h1:5etB91IE0uBlw9k756fVKZJdS+7M7ejVhmpXXiSFj0I= +github.com/gobuffalo/logger v0.0.0-20181127160119-5b956e21995c h1:Z/ppYX6EtPEysbW4VEGz2dO+4F4VTthWp2sWRUCANdU= +github.com/gobuffalo/logger v0.0.0-20181127160119-5b956e21995c/go.mod h1:+HxKANrR9VGw9yN3aOAppJKvhO05ctDi63w4mDnKv2U= +github.com/gobuffalo/makr v1.1.5/go.mod h1:Y+o0btAH1kYAMDJW/TX3+oAXEu0bmSLLoC9mIFxtzOw= +github.com/gobuffalo/mapi v1.0.0/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/mapi v1.0.1 h1:JRuTiZzDEZhBHkFiHTxJkYRT6CbYuL0K/rn+1byJoEA= +github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/meta v0.0.0-20181018155829-df62557efcd3/go.mod h1:XTTOhwMNryif3x9LkTTBO/Llrveezd71u3quLd0u7CM= +github.com/gobuffalo/meta v0.0.0-20181018192820-8c6cef77dab3/go.mod h1:E94EPzx9NERGCY69UWlcj6Hipf2uK/vnfrF4QD0plVE= +github.com/gobuffalo/meta v0.0.0-20181025145500-3a985a084b0a/go.mod h1:YDAKBud2FP7NZdruCSlmTmDOZbVSa6bpK7LJ/A/nlKg= +github.com/gobuffalo/meta v0.0.0-20181114191255-b130ebedd2f7/go.mod h1:K6cRZ29ozr4Btvsqkjvg5nDFTLOgTqf03KA70Ks0ypE= +github.com/gobuffalo/meta v0.0.0-20181127070345-0d7e59dd540b h1:TP4reYa74tCqKmeisA9aULXzcb1fHIM3bi7PdoDxpuQ= +github.com/gobuffalo/meta v0.0.0-20181127070345-0d7e59dd540b/go.mod h1:RLO7tMvE0IAKAM8wny1aN12pvEKn7EtkBLkUZR00Qf8= +github.com/gobuffalo/mw-basicauth v1.0.3/go.mod h1:dg7+ilMZOKnQFHDefUzUHufNyTswVUviCBgF244C1+0= +github.com/gobuffalo/mw-contenttype v0.0.0-20180802152300-74f5a47f4d56/go.mod h1:7EvcmzBbeCvFtQm5GqF9ys6QnCxz2UM1x0moiWLq1No= +github.com/gobuffalo/mw-csrf v0.0.0-20180802151833-446ff26e108b/go.mod h1:sbGtb8DmDZuDUQoxjr8hG1ZbLtZboD9xsn6p77ppcHo= +github.com/gobuffalo/mw-forcessl v0.0.0-20180802152810-73921ae7a130/go.mod h1:JvNHRj7bYNAMUr/5XMkZaDcw3jZhUZpsmzhd//FFWmQ= +github.com/gobuffalo/mw-i18n v0.0.0-20180802152014-e3060b7e13d6/go.mod h1:91AQfukc52A6hdfIfkxzyr+kpVYDodgAeT5cjX1UIj4= +github.com/gobuffalo/mw-paramlogger v0.0.0-20181005191442-d6ee392ec72e/go.mod h1:6OJr6VwSzgJMqWMj7TYmRUqzNe2LXu/W1rRW4MAz/ME= +github.com/gobuffalo/mw-tokenauth v0.0.0-20181001105134-8545f626c189/go.mod h1:UqBF00IfKvd39ni5+yI5MLMjAf4gX7cDKN/26zDOD6c= +github.com/gobuffalo/packd v0.0.0-20181027182251-01ad393492c8/go.mod h1:SmdBdhj6uhOsg1Ui4SFAyrhuc7U4VCildosO5IDJ3lc= +github.com/gobuffalo/packd v0.0.0-20181027190505-aafc0d02c411/go.mod h1:SmdBdhj6uhOsg1Ui4SFAyrhuc7U4VCildosO5IDJ3lc= +github.com/gobuffalo/packd v0.0.0-20181027194105-7ae579e6d213/go.mod h1:SmdBdhj6uhOsg1Ui4SFAyrhuc7U4VCildosO5IDJ3lc= +github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181104210303-d376b15f8e96/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181111195323-b2e760a5f0ff/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181114190715-f25c5d2471d7/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181124090624-311c6248e5fb/go.mod h1:Foenia9ZvITEvG05ab6XpiD5EfBHPL8A6hush8SJ0o8= +github.com/gobuffalo/packd v0.0.0-20181207120301-c49825f8f6f4/go.mod h1:LYc0TGKFBBFTRC9dg2pcRcMqGCTMD7T2BIMP7OBuQAA= +github.com/gobuffalo/packd v0.0.0-20181212173646-eca3b8fd6687 h1:uZ+G4JprR0UEq0aHZs+6eP7TEZuFfrIkmQWejIBV/QQ= +github.com/gobuffalo/packd v0.0.0-20181212173646-eca3b8fd6687/go.mod h1:LYc0TGKFBBFTRC9dg2pcRcMqGCTMD7T2BIMP7OBuQAA= +github.com/gobuffalo/packr v1.13.7/go.mod h1:KkinLIn/n6+3tVXMwg6KkNvWwVsrRAz4ph+jgpk3Z24= +github.com/gobuffalo/packr v1.15.0/go.mod h1:t5gXzEhIviQwVlNx/+3SfS07GS+cZ2hn76WLzPp6MGI= +github.com/gobuffalo/packr v1.15.1/go.mod h1:IeqicJ7jm8182yrVmNbM6PR4g79SjN9tZLH8KduZZwE= +github.com/gobuffalo/packr v1.19.0/go.mod h1:MstrNkfCQhd5o+Ct4IJ0skWlxN8emOq8DsoT1G98VIU= +github.com/gobuffalo/packr v1.20.0/go.mod h1:JDytk1t2gP+my1ig7iI4NcVaXr886+N0ecUga6884zw= +github.com/gobuffalo/packr v1.21.0/go.mod h1:H00jGfj1qFKxscFJSw8wcL4hpQtPe1PfU2wa6sg/SR0= +github.com/gobuffalo/packr/v2 v2.0.0-rc.8/go.mod h1:y60QCdzwuMwO2R49fdQhsjCPv7tLQFR0ayzxxla9zes= +github.com/gobuffalo/packr/v2 v2.0.0-rc.9/go.mod h1:fQqADRfZpEsgkc7c/K7aMew3n4aF1Kji7+lIZeR98Fc= +github.com/gobuffalo/packr/v2 v2.0.0-rc.10/go.mod h1:4CWWn4I5T3v4c1OsJ55HbHlUEKNWMITG5iIkdr4Px4w= +github.com/gobuffalo/packr/v2 v2.0.0-rc.11/go.mod h1:JoieH/3h3U4UmatmV93QmqyPUdf4wVM9HELaHEu+3fk= +github.com/gobuffalo/packr/v2 v2.0.0-rc.12/go.mod h1:FV1zZTsVFi1DSCboO36Xgs4pzCZBjB/tDV9Cz/lSaR8= +github.com/gobuffalo/packr/v2 v2.0.0-rc.13 h1:24zxY9FohMBT0JOYVjritfdGPVh9uz1YOKHqyDuEEjk= +github.com/gobuffalo/packr/v2 v2.0.0-rc.13/go.mod h1:2Mp7GhBFMdJlOK8vGfl7SYtfMP3+5roE39ejlfjw0rA= +github.com/gobuffalo/plush v3.7.16+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.20+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.21+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.22+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.23+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.30+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.31+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.32+incompatible h1:sxY0WMa6J1pMuomTUQ8n2TlR3otiCVZaq21gSrHLScU= +github.com/gobuffalo/plush v3.7.32+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plushgen v0.0.0-20181128164830-d29dcb966cb2/go.mod h1:r9QwptTFnuvSaSRjpSp4S2/4e2D3tJhARYbvEBcKSb4= +github.com/gobuffalo/plushgen v0.0.0-20181203163832-9fc4964505c2/go.mod h1:opEdT33AA2HdrIwK1aibqnTJDVVKXC02Bar/GT1YRVs= +github.com/gobuffalo/plushgen v0.0.0-20181207152837-eedb135bd51b h1:jliYV28yo404IYmFsYmcxlc46KUd8W2iYEj3Zn2nymI= +github.com/gobuffalo/plushgen v0.0.0-20181207152837-eedb135bd51b/go.mod h1:Lcw7HQbEVm09sAQrCLzIxuhFbB3nAgp4c55E+UlynR0= +github.com/gobuffalo/pop v4.8.2+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/pop v4.8.3+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/pop v4.8.4+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/release v1.0.35/go.mod h1:VtHFAKs61vO3wboCec5xr9JPTjYyWYcvaM3lclkc4x4= +github.com/gobuffalo/release v1.0.38/go.mod h1:VtHFAKs61vO3wboCec5xr9JPTjYyWYcvaM3lclkc4x4= +github.com/gobuffalo/release v1.0.42/go.mod h1:RPs7EtafH4oylgetOJpGP0yCZZUiO4vqHfTHJjSdpug= +github.com/gobuffalo/release v1.0.52/go.mod h1:RPs7EtafH4oylgetOJpGP0yCZZUiO4vqHfTHJjSdpug= +github.com/gobuffalo/release v1.0.53/go.mod h1:FdF257nd8rqhNaqtDWFGhxdJ/Ig4J7VcS3KL7n/a+aA= +github.com/gobuffalo/release v1.0.54/go.mod h1:Pe5/RxRa/BE8whDpGfRqSI7D1a0evGK1T4JDm339tJc= +github.com/gobuffalo/release v1.0.61/go.mod h1:mfIO38ujUNVDlBziIYqXquYfBF+8FDHUjKZgYC1Hj24= +github.com/gobuffalo/release v1.0.72/go.mod h1:NP5NXgg/IX3M5XmHmWR99D687/3Dt9qZtTK/Lbwc1hU= +github.com/gobuffalo/release v1.1.1/go.mod h1:Sluak1Xd6kcp6snkluR1jeXAogdJZpFFRzTYRs/2uwg= +github.com/gobuffalo/release v1.1.3/go.mod h1:CuXc5/m+4zuq8idoDt1l4va0AXAn/OSs08uHOfMVr8E= +github.com/gobuffalo/shoulders v1.0.1 h1:BqVJBUXlBWAf+WLhXijVk3SCpp75LXrVBiIkOCzZbNc= +github.com/gobuffalo/shoulders v1.0.1/go.mod h1:V33CcVmaQ4gRUmHKwq1fiTXuf8Gp/qjQBUL5tHPmvbA= +github.com/gobuffalo/syncx v0.0.0-20181120191700-98333ab04150/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/gobuffalo/syncx v0.0.0-20181120194010-558ac7de985f h1:S5EeH1reN93KR0L6TQvkRpu9YggCYXrUqFh1iEgvdC0= +github.com/gobuffalo/syncx v0.0.0-20181120194010-558ac7de985f/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/gobuffalo/tags v2.0.11+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY= +github.com/gobuffalo/tags v2.0.14+incompatible h1:RbcLAfomSsAIM+47dnwtAn/DYZyNaXpF72j1P3t6rmw= +github.com/gobuffalo/tags v2.0.14+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY= +github.com/gobuffalo/uuid v2.0.3+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/uuid v2.0.4+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/uuid v2.0.5+incompatible h1:c5uWRuEnYggYCrT9AJm0U2v1QTG7OVDAvxhj8tIV5Gc= +github.com/gobuffalo/uuid v2.0.5+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/validate v2.0.3+incompatible h1:6f4JCEz11Zi6iIlexMv7Jz10RBPvgI795AOaubtCwTE= +github.com/gobuffalo/validate v2.0.3+incompatible/go.mod h1:N+EtDe0J8252BgfzQUChBgfd6L93m9weay53EWFVsMM= +github.com/gobuffalo/x v0.0.0-20181003152136-452098b06085/go.mod h1:WevpGD+5YOreDJznWevcn8NTmQEW5STSBgIkpkjzqXc= +github.com/gobuffalo/x v0.0.0-20181007152206-913e47c59ca7/go.mod h1:9rDPXaB3kXdKWzMc4odGQQdG2e2DIEmANy5aSJ9yesY= +github.com/gofrs/uuid v3.1.0+incompatible h1:q2rtkjaKT4YEr6E1kamy0Ha4RtepWlQBedyHx0uzKwA= +github.com/gofrs/uuid v3.1.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1/go.mod h1:YeAe0gNeiNT5hoiZRI4yiOky6jVdNvfO2N6Kav/HmxY= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.1.2/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/gorilla/sessions v1.1.3/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ= +github.com/jackc/pgx v3.2.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= +github.com/jmoiron/sqlx v0.0.0-20180614180643-0dae4fefe7c0/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU= +github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +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.7.5/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46shStcFDJ34= +github.com/karrick/godirwalk v1.7.7 h1:lLkPCA+C0u1pI4fLFseaupvh5/THlPJIqSPmnGGViKs= +github.com/karrick/godirwalk v1.7.7/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46shStcFDJ34= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +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/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/markbates/deplist v1.0.4/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM= +github.com/markbates/deplist v1.0.5 h1:BKTJDTV5EynLGvTyONdgYVvV34DWq20mJAfGBCP+AYs= +github.com/markbates/deplist v1.0.5/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM= +github.com/markbates/going v1.0.2/go.mod h1:UWCk3zm0UKefHZ7l8BNqi26UyiEMniznk8naLdTcy6c= +github.com/markbates/grift v1.0.4/go.mod h1:wbmtW74veyx+cgfwFhlnnMWqhoz55rnHR47oMXzsyVs= +github.com/markbates/hmax v1.0.0/go.mod h1:cOkR9dktiESxIMu+65oc/r/bdY4bE8zZw3OLhLx0X2c= +github.com/markbates/inflect v1.0.0/go.mod h1:oTeZL2KHA7CUX6X+fovmK9OvIOFuqu0TwdQrZjLTh88= +github.com/markbates/inflect v1.0.1/go.mod h1:uv3UVNBe5qBIfCm8O8Q+DW+S1EopeyINj+Ikhc7rnCk= +github.com/markbates/inflect v1.0.3/go.mod h1:1fR9+pO2KHEO9ZRtto13gDwwZaAKstQzferVeWqbgNs= +github.com/markbates/inflect v1.0.4 h1:5fh1gzTFhfae06u3hzHYO9xe3l3v3nW5Pwt3naLTP5g= +github.com/markbates/inflect v1.0.4/go.mod h1:1fR9+pO2KHEO9ZRtto13gDwwZaAKstQzferVeWqbgNs= +github.com/markbates/oncer v0.0.0-20180924031910-e862a676800b/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/oncer v0.0.0-20180924034138-723ad0170a46/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/oncer v0.0.0-20181014194634-05fccaae8fc4/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2 h1:JgVTCPf0uBVcUSWpyXmGpgOc62nK5HWUBKAGc3Qqa5k= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/refresh v1.4.10/go.mod h1:NDPHvotuZmTmesXxr95C9bjlw1/0frJwtME2dzcVKhc= +github.com/markbates/safe v1.0.0/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +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/markbates/sigtx v1.0.0/go.mod h1:QF1Hv6Ic6Ca6W+T+DL0Y/ypborFKyvUY9HmuCD4VeTc= +github.com/markbates/willie v1.0.9/go.mod h1:fsrFVWl91+gXpx/6dv715j7i11fYPfZ9ZGfH0DQzY7w= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/microcosm-cc/bluemonday v1.0.1 h1:SIYunPjnlXcW+gVfvm0IlSeR5U3WZUOLfVmqg85Go44= +github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/monoculum/formam v0.0.0-20180901015400-4e68be1d79ba/go.mod h1:RKgILGEJq24YyJ2ban8EO0RUVSJlF1pGsEvoLEACr/Q= +github.com/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2xBGjv0j365Q= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.0.0 h1:o4VLZ5jqHE+HahLT6drNtSGTrrUA3wPBmtpgqtdbClo= +github.com/rogpeppe/go-internal v1.0.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516 h1:ofR1ZdrNSkiWcMsRrubK9tb2/SlZVWttAfqUjJi6QYc= +github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs= +github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= +github.com/shurcooL/highlight_go v0.0.0-20170515013102-78fb10f4a5f8/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= +github.com/shurcooL/octicon v0.0.0-20180602230221-c42b0e3b24d9/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= +github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.1.0/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= +github.com/sirupsen/logrus v1.1.1/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= +github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d h1:yKm7XZV6j9Ev6lojP2XaIshpT4ymkqhMeSghO5Ps00E= +github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= +github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e h1:qpG93cPwA5f7s/ZPBJnGOYQNK/vKsaDaseuKT5Asee8= +github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +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.2.1/go.mod h1:P4AexN0a+C9tGAnUFNwDMYYZv3pjFuvmeiMyKRaNVlI= +github.com/spf13/viper v1.3.1/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/unrolled/secure v0.0.0-20180918153822-f340ee86eb8b/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA= +github.com/unrolled/secure v0.0.0-20181005190816-ff9db2ff917f/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181015023909-0c41d7ab0a0e/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181024171144-74cb1d3d52f4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181025113841-85e1b3f9139a/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181025213731-e84da0312774/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180816102801-aaf60122140d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180921000356-2f5d2388922f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181017193950-04a2e542c03f/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-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181106065722-10aee1819953/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-20181207154023-610586996380 h1:zPQexyRtNYBc7bcHmehl1dH6TB3qn8zytv8cBGLDNY0= +golang.org/x/net v0.0.0-20181207154023-610586996380/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c/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-20180906133057-8cf3aee42992/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180921163948-d47a0f339242/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180927150500-dad3d9fb7b6e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181011152604-fa43e7bc11ba/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181022134430-8a28ead16f52/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181024145615-5cd93ef61a7c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181025063200-d989b31c8746/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026064943-731415f00dce/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-20181106135930-3a76605856fd/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-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181206074257-70b957f3b65e h1:njOxP/wVblhCLIUhjHXf6X+dzTt5OQ3vMQo9mkOIKIo= +golang.org/x/sys v0.0.0-20181206074257-70b957f3b65e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181003024731-2f84ea8ef872/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181006002542-f60d9635b16a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181008205924-a2b3f7f249e9/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181013182035-5e66757b835f/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181017214349-06f26fdaaa28/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181024171208-a2dc47679d30/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181026183834-f60e5f99f081/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181105230042-78dc5bac0cac/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181107215632-34b416bd17b3/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181114190951-94339b83286c/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181119130350-139d099f6620/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181127195227-b4e97c0ed882/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181127232545-e782529d0ddd/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181203210056-e5f3ab76ea4b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181205224935-3576414c54a4/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181206194817-bcd4e47d0288/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181207183836-8bc39b988060/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181212172921-837e80568c09 h1:WIjxC3kcRzP2DkFjzRjR1EzCaCgVPTnsv0XFO7HP3Uk= +golang.org/x/tools v0.0.0-20181212172921-837e80568c09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +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/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw= +gopkg.in/mail.v2 v2.0.0-20180731213649-a0242b2233b4/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/gobuffalo/packr/grifts/release.go b/vendor/github.com/gobuffalo/packr/grifts/release.go deleted file mode 100644 index 36e0b1307..000000000 --- a/vendor/github.com/gobuffalo/packr/grifts/release.go +++ /dev/null @@ -1,51 +0,0 @@ -package grifts - -import ( - "bufio" - "fmt" - "os" - "os/exec" - "strings" - - . "github.com/markbates/grift/grift" -) - -var _ = Add("release", func(c *Context) error { - cmd := exec.Command("git", "tag", "--sort", "-creatordate") - if b, err := cmd.CombinedOutput(); err == nil { - lines := strings.Split(string(b), "\n") - for _, l := range lines[:5] { - fmt.Println(l) - } - } - - r := bufio.NewReader(os.Stdin) - fmt.Print("Enter version number (vx.x.x): ") - v, _ := r.ReadString('\n') - v = strings.TrimSpace(v) - - cmd = exec.Command("git", "tag", v) - cmd.Stdin = os.Stdin - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - return err - } - - cmd = exec.Command("git", "push", "origin", "--tags") - cmd.Stdin = os.Stdin - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - return err - } - - cmd = exec.Command("goreleaser", "--rm-dist") - cmd.Stdin = os.Stdin - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - return err - } - return nil -}) diff --git a/vendor/github.com/gobuffalo/packr/http_box_test.go b/vendor/github.com/gobuffalo/packr/http_box_test.go index 9b3561eb0..e3bb7f481 100644 --- a/vendor/github.com/gobuffalo/packr/http_box_test.go +++ b/vendor/github.com/gobuffalo/packr/http_box_test.go @@ -26,6 +26,29 @@ 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) diff --git a/vendor/github.com/gobuffalo/packr/packr.go b/vendor/github.com/gobuffalo/packr/packr.go index d282994a2..6ccc6c15c 100644 --- a/vendor/github.com/gobuffalo/packr/packr.go +++ b/vendor/github.com/gobuffalo/packr/packr.go @@ -4,6 +4,8 @@ import ( "bytes" "compress/gzip" "encoding/json" + "runtime" + "strings" "sync" ) @@ -53,3 +55,20 @@ func UnpackBytes(box string) { 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) + } + } + + return paths +} + +func osPath(path string) string { + if runtime.GOOS == "windows" { + return strings.Replace(path, "/", "\\", -1) + } + return path +} diff --git a/vendor/github.com/gobuffalo/packr/packr/cmd/version.go b/vendor/github.com/gobuffalo/packr/packr/cmd/version.go new file mode 100644 index 000000000..df4391984 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/packr/cmd/version.go @@ -0,0 +1,20 @@ +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.Print(packr.Version) + }, +} + +func init() { + rootCmd.AddCommand(versionCmd) +} diff --git a/vendor/github.com/gobuffalo/packr/packr_test.go b/vendor/github.com/gobuffalo/packr/packr_test.go index a6132cd4b..d54036012 100644 --- a/vendor/github.com/gobuffalo/packr/packr_test.go +++ b/vendor/github.com/gobuffalo/packr/packr_test.go @@ -20,7 +20,8 @@ func init() { func Test_PackBytes(t *testing.T) { r := require.New(t) PackBytes(testBox.Path, "foo", []byte("bar")) - s := testBox.String("foo") + s, err := testBox.FindString("foo") + r.NoError(err) r.Equal("bar", s) } @@ -30,7 +31,7 @@ func Test_PackJSONBytes(t *testing.T) { r.NoError(err) err = PackJSONBytes(testBox.Path, "the bytes", string(b)) r.NoError(err) - s, err := testBox.MustBytes("the bytes") + s, err := testBox.Find("the bytes") r.NoError(err) r.Equal([]byte("json bytes"), s) } @@ -39,6 +40,7 @@ func Test_PackBytesGzip(t *testing.T) { r := require.New(t) err := PackBytesGzip(testBox.Path, "gzip", []byte("gzip foobar")) r.NoError(err) - s := testBox.String("gzip") + s, err := testBox.FindString("gzip") + r.NoError(err) r.Equal("gzip foobar", s) } diff --git a/vendor/github.com/gobuffalo/packr/physical_file.go b/vendor/github.com/gobuffalo/packr/physical_file.go deleted file mode 100644 index bf2d817a7..000000000 --- a/vendor/github.com/gobuffalo/packr/physical_file.go +++ /dev/null @@ -1,13 +0,0 @@ -package packr - -import "os" - -var _ File = physicalFile{} - -type physicalFile struct { - *os.File -} - -func (p physicalFile) FileInfo() (os.FileInfo, error) { - return os.Stat(p.Name()) -} diff --git a/vendor/github.com/gobuffalo/packr/travis.sh b/vendor/github.com/gobuffalo/packr/travis.sh new file mode 100755 index 000000000..92dc3af2d --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/travis.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +rm -rf packrd +rm -rf v2/packrd +go get -t ./... +go install -v ./packr +packr clean +go test -v -timeout=5s -race ./... diff --git a/vendor/github.com/gobuffalo/packr/v2/.gometalinter.json b/vendor/github.com/gobuffalo/packr/v2/.gometalinter.json new file mode 100644 index 000000000..e4f65a36e --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/.gometalinter.json @@ -0,0 +1,3 @@ +{ + "Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"] +} diff --git a/vendor/github.com/gobuffalo/packr/v2/.goreleaser.yml b/vendor/github.com/gobuffalo/packr/v2/.goreleaser.yml new file mode 100644 index 000000000..74230821a --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/.goreleaser.yml @@ -0,0 +1,27 @@ +# Code generated by github.com/gobuffalo/release. DO NOT EDIT. +# Edit .goreleaser.yml.plush instead + +builds: +- + goos: + - darwin + - linux + - windows + env: + - CGO_ENABLED=0 + main: ./packr2/main.go + binary: packr2 + +checksum: + name_template: 'checksums.txt' + +snapshot: + name_template: "{{ .Tag }}-next" + +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + diff --git a/vendor/github.com/gobuffalo/packr/v2/.goreleaser.yml.plush b/vendor/github.com/gobuffalo/packr/v2/.goreleaser.yml.plush new file mode 100644 index 000000000..4b1cfd4c1 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/.goreleaser.yml.plush @@ -0,0 +1,29 @@ +builds: +- + goos: + - darwin + - linux + - windows + env: + - CGO_ENABLED=0 + 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) { %> +brew: + github: + owner: gobuffalo + name: homebrew-tap +<% } %> diff --git a/vendor/github.com/gobuffalo/packr/v2/LICENSE.txt b/vendor/github.com/gobuffalo/packr/v2/LICENSE.txt new file mode 100644 index 000000000..3ccb336a0 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/LICENSE.txt @@ -0,0 +1,8 @@ +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/vendor/github.com/gobuffalo/packr/v2/Makefile b/vendor/github.com/gobuffalo/packr/v2/Makefile new file mode 100644 index 000000000..8de26c88b --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/Makefile @@ -0,0 +1,47 @@ +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 github.com/gobuffalo/release + $(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/vendor/github.com/gobuffalo/packr/v2/README.md b/vendor/github.com/gobuffalo/packr/v2/README.md new file mode 100644 index 000000000..6b79c7d47 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/README.md @@ -0,0 +1,172 @@ +# 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. PR's 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 +$ packr2 install --legacy +$ packr2 build --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 recieves 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/#FileSystemhttps://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 (the easy way) + +When it comes time to build, or install, your Go binary, simply use `packr2 build` or `packr2 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) + +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. diff --git a/vendor/github.com/gobuffalo/packr/v2/SHOULDERS.md b/vendor/github.com/gobuffalo/packr/v2/SHOULDERS.md new file mode 100644 index 000000000..dd4b86aba --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/SHOULDERS.md @@ -0,0 +1,84 @@ +# 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/BurntSushi/toml](https://godoc.org/github.com/BurntSushi/toml) + +* [github.com/gobuffalo/buffalo-plugins/plugins](https://godoc.org/github.com/gobuffalo/buffalo-plugins/plugins) + +* [github.com/gobuffalo/buffalo-plugins/plugins/plugdeps](https://godoc.org/github.com/gobuffalo/buffalo-plugins/plugins/plugdeps) + +* [github.com/gobuffalo/envy](https://godoc.org/github.com/gobuffalo/envy) + +* [github.com/gobuffalo/events](https://godoc.org/github.com/gobuffalo/events) + +* [github.com/gobuffalo/flect](https://godoc.org/github.com/gobuffalo/flect) + +* [github.com/gobuffalo/flect/name](https://godoc.org/github.com/gobuffalo/flect/name) + +* [github.com/gobuffalo/genny](https://godoc.org/github.com/gobuffalo/genny) + +* [github.com/gobuffalo/genny/movinglater/gotools](https://godoc.org/github.com/gobuffalo/genny/movinglater/gotools) + +* [github.com/gobuffalo/genny/movinglater/gotools/goimports](https://godoc.org/github.com/gobuffalo/genny/movinglater/gotools/goimports) + +* [github.com/gobuffalo/genny/movinglater/gotools/gomods](https://godoc.org/github.com/gobuffalo/genny/movinglater/gotools/gomods) + +* [github.com/gobuffalo/logger](https://godoc.org/github.com/gobuffalo/logger) + +* [github.com/gobuffalo/mapi](https://godoc.org/github.com/gobuffalo/mapi) + +* [github.com/gobuffalo/meta](https://godoc.org/github.com/gobuffalo/meta) + +* [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/gobuffalo/packr/v2/file](https://godoc.org/github.com/gobuffalo/packr/v2/file) + +* [github.com/gobuffalo/packr/v2/file/resolver](https://godoc.org/github.com/gobuffalo/packr/v2/file/resolver) + +* [github.com/gobuffalo/packr/v2/file/resolver/encoding/hex](https://godoc.org/github.com/gobuffalo/packr/v2/file/resolver/encoding/hex) + +* [github.com/gobuffalo/packr/v2/jam/parser](https://godoc.org/github.com/gobuffalo/packr/v2/jam/parser) + +* [github.com/gobuffalo/packr/v2/plog](https://godoc.org/github.com/gobuffalo/packr/v2/plog) + +* [github.com/gobuffalo/syncx](https://godoc.org/github.com/gobuffalo/syncx) + +* [github.com/joho/godotenv](https://godoc.org/github.com/joho/godotenv) + +* [github.com/karrick/godirwalk](https://godoc.org/github.com/karrick/godirwalk) + +* [github.com/markbates/oncer](https://godoc.org/github.com/markbates/oncer) + +* [github.com/markbates/safe](https://godoc.org/github.com/markbates/safe) + +* [github.com/pkg/errors](https://godoc.org/github.com/pkg/errors) + +* [github.com/rogpeppe/go-internal/modfile](https://godoc.org/github.com/rogpeppe/go-internal/modfile) + +* [github.com/rogpeppe/go-internal/module](https://godoc.org/github.com/rogpeppe/go-internal/module) + +* [github.com/rogpeppe/go-internal/semver](https://godoc.org/github.com/rogpeppe/go-internal/semver) + +* [github.com/sirupsen/logrus](https://godoc.org/github.com/sirupsen/logrus) + +* [github.com/spf13/cobra](https://godoc.org/github.com/spf13/cobra) + +* [github.com/spf13/pflag](https://godoc.org/github.com/spf13/pflag) + +* [golang.org/x/crypto/ssh/terminal](https://godoc.org/golang.org/x/crypto/ssh/terminal) + +* [golang.org/x/sys/unix](https://godoc.org/golang.org/x/sys/unix) + +* [golang.org/x/tools/go/ast/astutil](https://godoc.org/golang.org/x/tools/go/ast/astutil) + +* [golang.org/x/tools/imports](https://godoc.org/golang.org/x/tools/imports) + +* [golang.org/x/tools/internal/fastwalk](https://godoc.org/golang.org/x/tools/internal/fastwalk) + +* [golang.org/x/tools/internal/gopathwalk](https://godoc.org/golang.org/x/tools/internal/gopathwalk) diff --git a/vendor/github.com/gobuffalo/packr/v2/_fixtures/list_test/a.txt b/vendor/github.com/gobuffalo/packr/v2/_fixtures/list_test/a.txt new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/gobuffalo/packr/v2/_fixtures/list_test/b/b.txt b/vendor/github.com/gobuffalo/packr/v2/_fixtures/list_test/b/b.txt new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/gobuffalo/packr/v2/_fixtures/list_test/b/b2.txt b/vendor/github.com/gobuffalo/packr/v2/_fixtures/list_test/b/b2.txt new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/gobuffalo/packr/v2/_fixtures/list_test/c/c.txt b/vendor/github.com/gobuffalo/packr/v2/_fixtures/list_test/c/c.txt new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/gobuffalo/packr/v2/_fixtures/templates/foo.txt b/vendor/github.com/gobuffalo/packr/v2/_fixtures/templates/foo.txt new file mode 100644 index 000000000..12e9f8082 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/_fixtures/templates/foo.txt @@ -0,0 +1 @@ +FOO!!! diff --git a/vendor/github.com/gobuffalo/packr/v2/box.go b/vendor/github.com/gobuffalo/packr/v2/box.go new file mode 100644 index 000000000..ab08050d7 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/box.go @@ -0,0 +1,247 @@ +package packr + +import ( + "bytes" + "fmt" + "io" + "io/ioutil" + "net/http" + "os" + "path/filepath" + "runtime" + "sort" + "strings" + "sync" + + "github.com/gobuffalo/envy" + "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" + "github.com/pkg/errors" +) + +var _ packd.Box = &Box{} +var _ packd.HTTPBox = Box{} +var _ packd.Addable = &Box{} +var _ packd.Walkable = &Box{} +var _ packd.Finder = Box{} + +// NewBox returns a Box that can be used to +// retrieve files from either disk or the embedded +// binary. +func NewBox(path string) *Box { + oncer.Deprecate(0, "packr.NewBox", "Use packr.New instead.") + return New(path, path) +} + +func resolutionDir(og string) string { + ng, _ := filepath.Abs(og) + + exists := func(s string) bool { + _, err := os.Stat(s) + if err != nil { + return false + } + plog.Debug("packr", "resolutionDir", "original", og, "resolved", s) + return true + } + + if exists(ng) { + return ng + } + + _, filename, _, _ := runtime.Caller(2) + + ng = filepath.Join(filepath.Dir(filename), og) + + // // this little hack courtesy of the `-cover` flag!! + cov := filepath.Join("_test", "_obj_test") + ng = strings.Replace(ng, string(filepath.Separator)+cov, "", 1) + + if exists(ng) { + return ng + } + + ng = filepath.Join(envy.GoPath(), "src", ng) + if exists(ng) { + return ng + } + + return og +} + +func construct(name string, path string) *Box { + return &Box{ + Path: path, + Name: name, + ResolutionDir: resolutionDir(path), + resolvers: map[string]resolver.Resolver{}, + moot: &sync.RWMutex{}, + } +} + +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 +} + +// 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 map[string]resolver.Resolver + moot *sync.RWMutex +} + +func (b *Box) SetResolver(file string, res resolver.Resolver) { + b.moot.Lock() + plog.Debug(b, "SetResolver", "file", file, "resolver", fmt.Sprintf("%T", res)) + b.resolvers[resolver.Key(file)] = res + b.moot.Unlock() +} + +// 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 errors.WithStack(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) + if err != nil { + return false + } + return true +} + +// Open returns a File using the http.File interface +func (b Box) Open(name string) (http.File, error) { + plog.Debug(b, "Open", "name", name) + if len(filepath.Ext(name)) == 0 { + d, err := file.NewDir(name) + plog.Debug(b, "Open", "name", name, "dir", d) + return d, err + } + f, err := b.Resolve(name) + if err != nil { + return f, err + } + f, err = file.NewFileR(name, f) + plog.Debug(b, "Open", "name", f.Name(), "file", f.Name()) + return f, 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 +} + +func (b *Box) Resolve(key string) (file.File, error) { + key = strings.TrimPrefix(key, "/") + b.moot.RLock() + + var r resolver.Resolver + + for k, vr := range b.resolvers { + lk := strings.ToLower(resolver.Key(k)) + lkey := strings.ToLower(resolver.Key(key)) + if lk == lkey { + r = vr + break + } + } + b.moot.RUnlock() + + if r == nil { + r = b.DefaultResolver + if r == nil { + r = resolver.DefaultResolver + if r == nil { + return nil, errors.New("resolver.DefaultResolver is nil") + } + } + } + plog.Debug(r, "Resolve", "box", b.Name, "key", key) + + f, err := r.Resolve(b.Name, key) + if err != nil { + z := filepath.Join(resolver.OsPath(b.ResolutionDir), resolver.OsPath(key)) + 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, errors.WithStack(err) + } + f, err = file.NewFile(key, b) + if err != nil { + return f, errors.WithStack(err) + } + } + plog.Debug(r, "Resolve", "box", b.Name, "key", key, "file", f.Name()) + return f, nil +} diff --git a/vendor/github.com/gobuffalo/packr/v2/box_map.go b/vendor/github.com/gobuffalo/packr/v2/box_map.go new file mode 100644 index 000000000..aafeffa1d --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/box_map.go @@ -0,0 +1,73 @@ +//go:generate mapgen -name "box" -zero "nil" -go-type "*Box" -pkg "" -a "New(`test-a`, ``)" -b "New(`test-b`, ``)" -c "New(`test-c`, ``)" -bb "New(`test-bb`, ``)" -destination "packr" +// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. + +package packr + +import ( + "sort" + "sync" +) + +// boxMap wraps sync.Map and uses the following types: +// key: string +// value: *Box +type boxMap struct { + data sync.Map +} + +// Delete the key from the map +func (m *boxMap) Delete(key string) { + m.data.Delete(key) +} + +// Load the key from the map. +// Returns *Box or bool. +// A false return indicates either the key was not found +// or the value is not of type *Box +func (m *boxMap) Load(key string) (*Box, bool) { + i, ok := m.data.Load(key) + if !ok { + return nil, false + } + s, ok := i.(*Box) + return s, ok +} + +// LoadOrStore will return an existing key or +// store the value if not already in the map +func (m *boxMap) LoadOrStore(key string, value *Box) (*Box, bool) { + i, _ := m.data.LoadOrStore(key, value) + s, ok := i.(*Box) + return s, ok +} + +// Range over the *Box values in the map +func (m *boxMap) Range(f func(key string, value *Box) bool) { + m.data.Range(func(k, v interface{}) bool { + key, ok := k.(string) + if !ok { + return false + } + value, ok := v.(*Box) + if !ok { + return false + } + return f(key, value) + }) +} + +// Store a *Box in the map +func (m *boxMap) Store(key string, value *Box) { + m.data.Store(key, value) +} + +// Keys returns a list of keys in the map +func (m *boxMap) Keys() []string { + var keys []string + m.Range(func(key string, value *Box) bool { + keys = append(keys, key) + return true + }) + sort.Strings(keys) + return keys +} diff --git a/vendor/github.com/gobuffalo/packr/v2/box_map_test.go b/vendor/github.com/gobuffalo/packr/v2/box_map_test.go new file mode 100644 index 000000000..fe91a5f84 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/box_map_test.go @@ -0,0 +1,55 @@ +// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. + +package packr + +import ( + "sort" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_boxMap(t *testing.T) { + r := require.New(t) + + sm := &boxMap{} + + sm.Store("a", New(`test-a`, ``)) + + s, ok := sm.Load("a") + r.True(ok) + r.Equal(New(`test-a`, ``), s) + + s, ok = sm.LoadOrStore("b", New(`test-b`, ``)) + r.True(ok) + r.Equal(New(`test-b`, ``), s) + + s, ok = sm.LoadOrStore("b", New(`test-bb`, ``)) + r.True(ok) + r.Equal(New(`test-b`, ``), s) + + var keys []string + + sm.Range(func(key string, value *Box) bool { + keys = append(keys, key) + return true + }) + + sort.Strings(keys) + + r.Equal(sm.Keys(), keys) + + sm.Delete("b") + r.Equal([]string{"a", "b"}, keys) + + sm.Delete("b") + _, ok = sm.Load("b") + r.False(ok) + + func(m *boxMap) { + m.Store("c", New(`test-c`, ``)) + }(sm) + s, ok = sm.Load("c") + r.True(ok) + r.Equal(New(`test-c`, ``), s) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/box_test.go b/vendor/github.com/gobuffalo/packr/v2/box_test.go new file mode 100644 index 000000000..cbe8dccfb --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/box_test.go @@ -0,0 +1,209 @@ +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_NewBox(t *testing.T) { + r := require.New(t) + + box := NewBox(filepath.Join("_fixtures", "list_test")) + r.Len(box.List(), 4) + +} +func Test_Box_AddString(t *testing.T) { + r := require.New(t) + + box := NewBox("./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 := NewBox("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 := NewBox("./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 := NewBox(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 := NewBox("./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 := NewBox(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 := NewBox("./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 := NewBox(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 := NewBox("./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 := NewBox("./_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 := NewBox("./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!"), + }) + box := NewBox("./templates") + + box.SetResolver("foo.txt", d) + + f, err := box.Open("foo.txt") + 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 := NewBox(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) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/deprecated.go b/vendor/github.com/gobuffalo/packr/v2/deprecated.go new file mode 100644 index 000000000..7a19df386 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/deprecated.go @@ -0,0 +1,79 @@ +package packr + +import ( + "encoding/json" + "errors" + + "github.com/gobuffalo/packr/v2/file" + "github.com/gobuffalo/packr/v2/file/resolver" + "github.com/markbates/oncer" +) + +// File has been deprecated and file.File should be used instead +type File = file.File + +var ( + // ErrResOutsideBox gets returned in case of the requested resources being outside the box + // Deprecated + ErrResOutsideBox = errors.New("can't find a resource outside the box") +) + +// PackBytes packs bytes for a file into a box. +// Deprecated +func PackBytes(box string, name string, bb []byte) { + b := NewBox(box) + d := resolver.NewInMemory(map[string]file.File{}) + f, err := file.NewFile(name, bb) + if err != nil { + panic(err) + } + if err := d.Pack(name, f); err != nil { + panic(err) + } + b.SetResolver(name, d) +} + +// PackBytesGzip packets the gzipped compressed bytes into a box. +// Deprecated +func PackBytesGzip(box string, name string, bb []byte) error { + // TODO: this function never did what it was supposed to do! + PackBytes(box, name, bb) + return nil +} + +// PackJSONBytes packs JSON encoded bytes for a file into a box. +// Deprecated +func PackJSONBytes(box string, name string, jbb string) error { + var bb []byte + err := json.Unmarshal([]byte(jbb), &bb) + if err != nil { + return err + } + PackBytes(box, name, bb) + return nil +} + +// Bytes is deprecated. Use Find instead +func (b Box) Bytes(name string) []byte { + bb, _ := b.Find(name) + oncer.Deprecate(0, "github.com/gobuffalo/packr/v2#Box.Bytes", "Use github.com/gobuffalo/packr/v2#Box.Find instead.") + return bb +} + +// MustBytes is deprecated. Use Find instead. +func (b Box) MustBytes(name string) ([]byte, error) { + oncer.Deprecate(0, "github.com/gobuffalo/packr/v2#Box.MustBytes", "Use github.com/gobuffalo/packr/v2#Box.Find instead.") + return b.Find(name) +} + +// String is deprecated. Use FindString instead +func (b Box) String(name string) string { + oncer.Deprecate(0, "github.com/gobuffalo/packr/v2#Box.String", "Use github.com/gobuffalo/packr/v2#Box.FindString instead.") + return string(b.Bytes(name)) +} + +// MustString is deprecated. Use FindString instead +func (b Box) MustString(name string) (string, error) { + oncer.Deprecate(0, "github.com/gobuffalo/packr/v2#Box.MustString", "Use github.com/gobuffalo/packr/v2#Box.FindString instead.") + return b.FindString(name) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/deprecated_test.go b/vendor/github.com/gobuffalo/packr/v2/deprecated_test.go new file mode 100644 index 000000000..345485bbc --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/deprecated_test.go @@ -0,0 +1,46 @@ +package packr + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_PackBytes(t *testing.T) { + r := require.New(t) + + box := NewBox("my/box") + name := "foo.txt" + body := []byte("foo!!") + PackBytes(box.Name, name, body) + + f, err := box.FindString(name) + r.NoError(err) + r.Equal(string(body), f) +} + +func Test_PackBytesGzip(t *testing.T) { + r := require.New(t) + + box := NewBox("my/box") + name := "foo.txt" + body := []byte("foo!!") + PackBytesGzip(box.Name, name, body) + + f, err := box.FindString(name) + r.NoError(err) + r.Equal(string(body), f) +} + +func Test_PackJSONBytes(t *testing.T) { + r := require.New(t) + + box := NewBox("my/box") + name := "foo.txt" + body := "\"PGgxPnRlbXBsYXRlcy9tYWlsZXJzL2xheW91dC5odG1sPC9oMT4KCjwlPSB5aWVsZCAlPgo=\"" + PackJSONBytes(box.Name, name, body) + + f, err := box.FindString(name) + r.NoError(err) + r.Equal("

templates/mailers/layout.html

\n\n<%= yield %>\n", f) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/file.go b/vendor/github.com/gobuffalo/packr/v2/file/file.go new file mode 100644 index 000000000..bef50c8dd --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/file.go @@ -0,0 +1,32 @@ +package file + +import ( + "bytes" + "io" + + "github.com/gobuffalo/packd" +) + +// File represents a virtual, or physical, backing of +// a file object in a Box +type File = packd.File + +// FileMappable types are capable of returning a map of +// path => File +type FileMappable interface { + FileMap() map[string]File +} + +// NewFile returns a virtual File implementation +func NewFile(name string, b []byte) (File, error) { + return packd.NewFile(name, bytes.NewReader(b)) +} + +// NewDir returns a virtual dir implementation +func NewDir(name string) (File, error) { + return packd.NewDir(name) +} + +func NewFileR(name string, r io.Reader) (File, error) { + return packd.NewFile(name, r) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/info.go b/vendor/github.com/gobuffalo/packr/v2/file/info.go new file mode 100644 index 000000000..90acb8c21 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/info.go @@ -0,0 +1,38 @@ +package file + +import ( + "os" + "time" +) + +type info struct { + Path string + Contents []byte + size int64 + modTime time.Time + isDir bool +} + +func (f info) Name() string { + return f.Path +} + +func (f info) Size() int64 { + return f.size +} + +func (f info) Mode() os.FileMode { + return 0444 +} + +func (f info) ModTime() time.Time { + return f.modTime +} + +func (f info) IsDir() bool { + return f.isDir +} + +func (f info) Sys() interface{} { + return nil +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/_fixtures/templates/foo.txt b/vendor/github.com/gobuffalo/packr/v2/file/resolver/_fixtures/templates/foo.txt new file mode 100644 index 000000000..929efb305 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/_fixtures/templates/foo.txt @@ -0,0 +1 @@ +foo! diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/disk.go b/vendor/github.com/gobuffalo/packr/v2/file/resolver/disk.go new file mode 100644 index 000000000..2a431179a --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/disk.go @@ -0,0 +1,81 @@ +package resolver + +import ( + "io/ioutil" + "os" + "path/filepath" + "strings" + "sync" + + "github.com/gobuffalo/packr/v2/file" + "github.com/gobuffalo/packr/v2/plog" + "github.com/karrick/godirwalk" + "github.com/pkg/errors" +) + +var _ Resolver = &Disk{} + +type Disk struct { + Root string +} + +func (d Disk) String() string { + return String(&d) +} + +func (d *Disk) Resolve(box string, name string) (file.File, error) { + path := OsPath(name) + if !filepath.IsAbs(path) { + path = filepath.Join(OsPath(d.Root), path) + } + fi, err := os.Stat(path) + if err != nil { + return nil, err + } + if fi.IsDir() { + return file.NewDir(OsPath(name)) + } + if bb, err := ioutil.ReadFile(path); err == nil { + return file.NewFile(OsPath(name), bb) + } + return nil, os.ErrNotExist +} + +var _ file.FileMappable = &Disk{} + +func (d *Disk) FileMap() map[string]file.File { + moot := &sync.Mutex{} + m := map[string]file.File{} + root := OsPath(d.Root) + if _, err := os.Stat(root); err != nil { + return m + } + callback := func(path string, de *godirwalk.Dirent) error { + if _, err := os.Stat(root); err != nil { + return nil + } + if !de.IsRegular() { + return nil + } + moot.Lock() + name := strings.TrimPrefix(path, root+string(filepath.Separator)) + b, err := ioutil.ReadFile(path) + if err != nil { + return errors.WithStack(err) + } + m[name], err = file.NewFile(name, b) + if err != nil { + return errors.WithStack(err) + } + moot.Unlock() + return nil + } + err := godirwalk.Walk(root, &godirwalk.Options{ + FollowSymbolicLinks: true, + Callback: callback, + }) + if err != nil { + plog.Logger.Errorf("[%s] error walking %v", root, err) + } + return m +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/disk_test.go b/vendor/github.com/gobuffalo/packr/v2/file/resolver/disk_test.go new file mode 100644 index 000000000..c424adee6 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/disk_test.go @@ -0,0 +1,28 @@ +package resolver + +import ( + "io/ioutil" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_Disk_Find(t *testing.T) { + r := require.New(t) + + d := &Disk{ + Root: "_fixtures\\templates", + } + + f, err := d.Resolve("", "foo.txt") + r.NoError(err) + + fi, err := f.FileInfo() + r.NoError(err) + r.Equal("foo.txt", fi.Name()) + + b, err := ioutil.ReadAll(f) + r.NoError(err) + r.Equal("foo!", strings.TrimSpace(string(b))) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/encoding/hex/hex.go b/vendor/github.com/gobuffalo/packr/v2/file/resolver/encoding/hex/hex.go new file mode 100644 index 000000000..aee5aecb1 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/encoding/hex/hex.go @@ -0,0 +1,315 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package hex implements hexadecimal encoding and decoding. +package hex + +import ( + "bytes" + "errors" + "fmt" + "io" +) + +const hextable = "0123456789abcdef" + +// EncodedLen returns the length of an encoding of n source bytes. +// Specifically, it returns n * 2. +func EncodedLen(n int) int { return n * 2 } + +// Encode encodes src into EncodedLen(len(src)) +// bytes of dst. As a convenience, it returns the number +// of bytes written to dst, but this value is always EncodedLen(len(src)). +// Encode implements hexadecimal encoding. +func Encode(dst, src []byte) int { + for i, v := range src { + dst[i*2] = hextable[v>>4] + dst[i*2+1] = hextable[v&0x0f] + } + + return len(src) * 2 +} + +// ErrLength reports an attempt to decode an odd-length input +// using Decode or DecodeString. +// The stream-based Decoder returns io.ErrUnexpectedEOF instead of ErrLength. +var ErrLength = errors.New("encoding/hex: odd length hex string") + +// InvalidByteError values describe errors resulting from an invalid byte in a hex string. +type InvalidByteError byte + +func (e InvalidByteError) Error() string { + return fmt.Sprintf("encoding/hex: invalid byte: %#U", rune(e)) +} + +// DecodedLen returns the length of a decoding of x source bytes. +// Specifically, it returns x / 2. +func DecodedLen(x int) int { return x / 2 } + +// Decode decodes src into DecodedLen(len(src)) bytes, +// returning the actual number of bytes written to dst. +// +// Decode expects that src contains only hexadecimal +// characters and that src has even length. +// If the input is malformed, Decode returns the number +// of bytes decoded before the error. +func Decode(dst, src []byte) (int, error) { + var i int + for i = 0; i < len(src)/2; i++ { + a, ok := fromHexChar(src[i*2]) + if !ok { + return i, InvalidByteError(src[i*2]) + } + b, ok := fromHexChar(src[i*2+1]) + if !ok { + return i, InvalidByteError(src[i*2+1]) + } + dst[i] = (a << 4) | b + } + if len(src)%2 == 1 { + // Check for invalid char before reporting bad length, + // since the invalid char (if present) is an earlier problem. + if _, ok := fromHexChar(src[i*2]); !ok { + return i, InvalidByteError(src[i*2]) + } + return i, ErrLength + } + return i, nil +} + +// fromHexChar converts a hex character into its value and a success flag. +func fromHexChar(c byte) (byte, bool) { + switch { + case '0' <= c && c <= '9': + return c - '0', true + case 'a' <= c && c <= 'f': + return c - 'a' + 10, true + case 'A' <= c && c <= 'F': + return c - 'A' + 10, true + } + + return 0, false +} + +// EncodeToString returns the hexadecimal encoding of src. +func EncodeToString(src []byte) string { + dst := make([]byte, EncodedLen(len(src))) + Encode(dst, src) + return string(dst) +} + +// DecodeString returns the bytes represented by the hexadecimal string s. +// +// DecodeString expects that src contains only hexadecimal +// characters and that src has even length. +// If the input is malformed, DecodeString returns +// the bytes decoded before the error. +func DecodeString(s string) ([]byte, error) { + src := []byte(s) + // We can use the source slice itself as the destination + // because the decode loop increments by one and then the 'seen' byte is not used anymore. + n, err := Decode(src, src) + return src[:n], err +} + +// Dump returns a string that contains a hex dump of the given data. The format +// of the hex dump matches the output of `hexdump -C` on the command line. +func Dump(data []byte) string { + var buf bytes.Buffer + dumper := Dumper(&buf) + dumper.Write(data) + dumper.Close() + return buf.String() +} + +// bufferSize is the number of hexadecimal characters to buffer in encoder and decoder. +const bufferSize = 1024 + +type encoder struct { + w io.Writer + err error + out [bufferSize]byte // output buffer +} + +// NewEncoder returns an io.Writer that writes lowercase hexadecimal characters to w. +func NewEncoder(w io.Writer) io.Writer { + return &encoder{w: w} +} + +func (e *encoder) Write(p []byte) (n int, err error) { + for len(p) > 0 && e.err == nil { + chunkSize := bufferSize / 2 + if len(p) < chunkSize { + chunkSize = len(p) + } + + var written int + encoded := Encode(e.out[:], p[:chunkSize]) + written, e.err = e.w.Write(e.out[:encoded]) + n += written / 2 + p = p[chunkSize:] + } + return n, e.err +} + +type decoder struct { + r io.Reader + err error + in []byte // input buffer (encoded form) + arr [bufferSize]byte // backing array for in +} + +// NewDecoder returns an io.Reader that decodes hexadecimal characters from r. +// NewDecoder expects that r contain only an even number of hexadecimal characters. +func NewDecoder(r io.Reader) io.Reader { + return &decoder{r: r} +} + +func (d *decoder) Read(p []byte) (n int, err error) { + // Fill internal buffer with sufficient bytes to decode + if len(d.in) < 2 && d.err == nil { + var numCopy, numRead int + numCopy = copy(d.arr[:], d.in) // Copies either 0 or 1 bytes + numRead, d.err = d.r.Read(d.arr[numCopy:]) + d.in = d.arr[:numCopy+numRead] + if d.err == io.EOF && len(d.in)%2 != 0 { + if _, ok := fromHexChar(d.in[len(d.in)-1]); !ok { + d.err = InvalidByteError(d.in[len(d.in)-1]) + } else { + d.err = io.ErrUnexpectedEOF + } + } + } + + // Decode internal buffer into output buffer + if numAvail := len(d.in) / 2; len(p) > numAvail { + p = p[:numAvail] + } + numDec, err := Decode(p, d.in[:len(p)*2]) + d.in = d.in[2*numDec:] + if err != nil { + d.in, d.err = nil, err // Decode error; discard input remainder + } + + if len(d.in) < 2 { + return numDec, d.err // Only expose errors when buffer fully consumed + } + return numDec, nil +} + +// Dumper returns a WriteCloser that writes a hex dump of all written data to +// w. The format of the dump matches the output of `hexdump -C` on the command +// line. +func Dumper(w io.Writer) io.WriteCloser { + return &dumper{w: w} +} + +type dumper struct { + w io.Writer + rightChars [18]byte + buf [14]byte + used int // number of bytes in the current line + n uint // number of bytes, total + closed bool +} + +func toChar(b byte) byte { + if b < 32 || b > 126 { + return '.' + } + return b +} + +func (h *dumper) Write(data []byte) (n int, err error) { + if h.closed { + return 0, errors.New("encoding/hex: dumper closed") + } + + // Output lines look like: + // 00000010 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d |./0123456789:;<=| + // ^ offset ^ extra space ^ ASCII of line. + for i := range data { + if h.used == 0 { + // At the beginning of a line we print the current + // offset in hex. + h.buf[0] = byte(h.n >> 24) + h.buf[1] = byte(h.n >> 16) + h.buf[2] = byte(h.n >> 8) + h.buf[3] = byte(h.n) + Encode(h.buf[4:], h.buf[:4]) + h.buf[12] = ' ' + h.buf[13] = ' ' + _, err = h.w.Write(h.buf[4:]) + if err != nil { + return + } + } + Encode(h.buf[:], data[i:i+1]) + h.buf[2] = ' ' + l := 3 + if h.used == 7 { + // There's an additional space after the 8th byte. + h.buf[3] = ' ' + l = 4 + } else if h.used == 15 { + // At the end of the line there's an extra space and + // the bar for the right column. + h.buf[3] = ' ' + h.buf[4] = '|' + l = 5 + } + _, err = h.w.Write(h.buf[:l]) + if err != nil { + return + } + n++ + h.rightChars[h.used] = toChar(data[i]) + h.used++ + h.n++ + if h.used == 16 { + h.rightChars[16] = '|' + h.rightChars[17] = '\n' + _, err = h.w.Write(h.rightChars[:]) + if err != nil { + return + } + h.used = 0 + } + } + return +} + +func (h *dumper) Close() (err error) { + // See the comments in Write() for the details of this format. + if h.closed { + return + } + h.closed = true + if h.used == 0 { + return + } + h.buf[0] = ' ' + h.buf[1] = ' ' + h.buf[2] = ' ' + h.buf[3] = ' ' + h.buf[4] = '|' + nBytes := h.used + for h.used < 16 { + l := 3 + if h.used == 7 { + l = 4 + } else if h.used == 15 { + l = 5 + } + _, err = h.w.Write(h.buf[:l]) + if err != nil { + return + } + h.used++ + } + h.rightChars[nBytes] = '|' + h.rightChars[nBytes+1] = '\n' + _, err = h.w.Write(h.rightChars[:nBytes+2]) + return +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/hex_gzip.go b/vendor/github.com/gobuffalo/packr/v2/file/resolver/hex_gzip.go new file mode 100644 index 000000000..0fc5b7d6e --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/hex_gzip.go @@ -0,0 +1,113 @@ +package resolver + +import ( + "bytes" + "compress/gzip" + "io" + "io/ioutil" + "os" + "strings" + "sync" + + "github.com/gobuffalo/packr/v2/file/resolver/encoding/hex" + "github.com/gobuffalo/packr/v2/plog" + + "github.com/gobuffalo/packr/v2/file" + "github.com/pkg/errors" +) + +var _ Resolver = &HexGzip{} + +type HexGzip struct { + packed map[string]string + unpacked map[string]string + moot *sync.RWMutex +} + +func (hg HexGzip) String() string { + return String(&hg) +} + +var _ file.FileMappable = &HexGzip{} + +func (hg *HexGzip) FileMap() map[string]file.File { + hg.moot.RLock() + var names []string + for k := range hg.packed { + names = append(names, k) + } + hg.moot.RUnlock() + m := map[string]file.File{} + for _, n := range names { + if f, err := hg.Resolve("", n); err == nil { + m[n] = f + } + } + return m +} + +func (hg *HexGzip) Resolve(box string, name string) (file.File, error) { + plog.Debug(hg, "Resolve", "box", box, "name", name) + hg.moot.Lock() + defer hg.moot.Unlock() + + if s, ok := hg.unpacked[name]; ok { + return file.NewFile(name, []byte(s)) + } + packed, ok := hg.packed[name] + if !ok { + return nil, os.ErrNotExist + } + + unpacked, err := UnHexGzipString(packed) + if err != nil { + return nil, errors.WithStack(err) + } + + f, err := file.NewFile(OsPath(name), []byte(unpacked)) + if err != nil { + return nil, errors.WithStack(err) + } + hg.unpacked[name] = f.String() + return f, nil +} + +func NewHexGzip(files map[string]string) (*HexGzip, error) { + if files == nil { + files = map[string]string{} + } + + hg := &HexGzip{ + packed: files, + unpacked: map[string]string{}, + moot: &sync.RWMutex{}, + } + + return hg, nil +} + +func HexGzipString(s string) (string, error) { + bb := &bytes.Buffer{} + enc := hex.NewEncoder(bb) + zw := gzip.NewWriter(enc) + io.Copy(zw, strings.NewReader(s)) + zw.Close() + + return bb.String(), nil +} + +func UnHexGzipString(packed string) (string, error) { + br := bytes.NewBufferString(packed) + dec := hex.NewDecoder(br) + zr, err := gzip.NewReader(dec) + if err != nil { + return "", errors.WithStack(err) + } + defer zr.Close() + + b, err := ioutil.ReadAll(zr) + if err != nil { + return "", errors.WithStack(err) + } + return string(b), nil +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/hex_gzip_test.go b/vendor/github.com/gobuffalo/packr/v2/file/resolver/hex_gzip_test.go new file mode 100644 index 000000000..88e3cc961 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/hex_gzip_test.go @@ -0,0 +1,40 @@ +package resolver + +import ( + "io/ioutil" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_HexGzip_Find(t *testing.T) { + r := require.New(t) + + x, err := HexGzipString("foo!") + r.NoError(err) + files := map[string]string{ + "foo.txt": x, + } + d, err := NewHexGzip(files) + r.NoError(err) + + f, err := d.Resolve("", "foo.txt") + r.NoError(err) + + fi, err := f.FileInfo() + r.NoError(err) + r.Equal("foo.txt", fi.Name()) + + b, err := ioutil.ReadAll(f) + r.NoError(err) + r.Equal("foo!", strings.TrimSpace(string(b))) +} + +func Test_fo(t *testing.T) { + r := require.New(t) + x := "1f8b08000000000000ff9c575f6fe3b8117fd7a798ea490e6c0a7d2b5ce4806c76b3b9c29718916f53e0b04818696cb34b715892b2e306feeec5905262a7ebddb6010249e4f037bff9c399b195f537b942907550647c96a9d6920b506400f94a8575f7246a6acb153d75cba5d454a2d9ecf293bbfd930596e46af45e9f906cb7934182a5ad74b2d5b45aa13b7de040e83d85ce38d21a9bd263dd39ccb30ce0e505d41204d9e0c5bd0aeb3959d8eff9e0cb4b5afd8d1ad47efe6db5dfffd4a689255bf6ffed364ff8681a98ecf7efb55df87b7c8a1b00b577cbd326f12e63a93fffc59c96e2ddd3043988ee67842ee6bff6840e419c2f6b72fe34f673e9d17bce0d96a9c9043421ec2cfec0a437a177a446595696f0e9e60b280f9dc70602c11ab505bf55a15e83c7109459797892bc4b06b66b7408618d7c525aab552d395519e109955981eb8c808fb8949d0ebc9a37b8414db6451372916da48b1acf8133577cc650e49f6f1f3edd7cc9c7c7b2a3282bad85b3de1a71616df6fdb8b2e802ce383062e1a4f15a0672596f2c07a02ce1c25a66946c905a83a32ea007691a6855d368dc4a877c53a0d7c8a7fc9a3addc01342834b65b011b0582bcf48618d60d06d106a34011dd01276d4b977ce115959f2d21d75eccef181b231ac1c75d68f01432d840026d060ada5c30616b77398fc021f6fef6f1823e96d511acf3ed85107b269401e920f048fd2da473893cb80eeac07e3c8488688eac610d632a477d82aade1e676016bb9c1b461707b80c9f62278d9c6a0b3d9ae4336d5a1a7ced503e168ab07e9618b5a0f46ff1a406a4f3ded083fb8dd21d46bacbf6103ca4467926bd0f1dbeec811d1f8c78a3d7da534fa476621e1f26271793db998cd12e2183c810a43c0a4deca1d67251fb65ad6d880963e0cbae29923ea63e6ae42f28875b8413390658cd7b044cfb2602030b841c7c9514bae77225b76a6e64c2b4647790b2f5c5596319fcfcfc1281d57202d0cf9266e705b0cefb736b24a62009fcc66ca5767dc7f9faa27fc57a5225105723885a164889b4eeb97fd003077782f1dfa29fcf175d0d9af0d3ab9c4382ffaeb5c8cc4b5348d463740ec0fc80c55e588c18d6c710af9c350e1f95b700cf7fb879e569e30f6a32c3ef99e76815a1914bb74070e1be5b08edeaeaad9e034f1bbc722b6acaa9a15a3b7d3335a81c37f76e8436a6318d07928964ac717be98bb9138c239e864623e9c99c5ef1ef8b4b7cb122a0c29a57ab57dc985589803c1dfaadb9b237d073559545c020faa45f90f4f261f8db203bfa60e72baa94516734781fd245752191fe0b2babb021982acbf7901eb10ac9f96e576bb15b495de0a72ab5299069f855ddbf2d291f7934a057cb84b663c5c915ba1db3d148c341ad4dc614b9b6856a3bc7cd25c33943ff627b751cee59f1a71340744f87b27ad0794f5fad59dca8084c0553dcd456290855a7c91bac3220fcff948146796acb8246330cafd4f94e318917a47d252b4711a111f3ffc1fb1a83074363696ce63e2ae5391991e693ddc29beaf87453f7f5a1479998fe19a5aecefe07713f390061f7cab99e9bcf41e83ff40cf2366e963ef5af2362c1db531896df7a4550de9d291db65ff71bf233187a173869564fbec44572ecb23d35361d5241bd0544bddab1ef39c019d8ddac36bf386c77e0a168bc771eca8a6490883ea777d2f7a9a123e43d5e462dd1874918b69c5507d66c5bec2eb2d39046596e4da4875fa7a5d5e4729a178d82e1baa7d1911d5bfa2682af8c7717c2de7bfbd12bc62292eab3ca9a08bffe4524f588ce3ca799c3a630b882324bf7da0e722172269449f8fc690a399fc5ee5a3bfc6437f7ad74b4415c816e8dc2806ea354e8b032ec528dbbf1b8d8642fa030773e7ee77fb822c0d2853531bc7bee4d138212cb9372a0f86025c2f16f34a40cefe9c96253ecbd66ae4293587f35fd2ba7fb77130ebbce96f083d9c9d190a67678026dee2aa9a89183f1eba8e262e581034144933d8966b734d6d8bf146c66908aca3e7dd4f221d65fe8b2c39f9cba74cf9f1d6a87e941bbddf871f6287214b68c7334155cdeefa584cd388c083f539e4d651d3c5cbd337d7aa9acdd9926b940d3a3f8556da3f7ce0b1f06b7abce47f9f5c91db4ad76033e15642f9b40f4f1edbfc9eb3e6df010000ffffa0d4ca87a10e0000" + y, err := UnHexGzipString(x) + r.NoError(err) + r.NotEqual("", y) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/ident.go b/vendor/github.com/gobuffalo/packr/v2/file/resolver/ident.go new file mode 100644 index 000000000..0b90d1f4d --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/ident.go @@ -0,0 +1,21 @@ +package resolver + +import ( + "path/filepath" + "runtime" + "strings" +) + +func Key(s string) string { + s = strings.Replace(s, "\\", "/", -1) + return s +} + +func OsPath(s string) string { + if runtime.GOOS == "windows" { + s = strings.Replace(s, "/", string(filepath.Separator), -1) + } else { + s = strings.Replace(s, "\\", string(filepath.Separator), -1) + } + return s +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/ident_test.go b/vendor/github.com/gobuffalo/packr/v2/file/resolver/ident_test.go new file mode 100644 index 000000000..298123b48 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/ident_test.go @@ -0,0 +1,33 @@ +package resolver + +import ( + "runtime" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_Ident_OsPath(t *testing.T) { + table := map[string]string{ + "foo/bar/baz": "foo/bar/baz", + "foo\\bar\\baz": "foo/bar/baz", + } + + if runtime.GOOS == "windows" { + table = ident_OsPath_Windows_Table() + } + + for in, out := range table { + t.Run(in, func(st *testing.T) { + r := require.New(st) + r.Equal(out, OsPath(in)) + }) + } +} + +func ident_OsPath_Windows_Table() map[string]string { + return map[string]string{ + "foo/bar/baz": "foo\\bar\\baz", + "foo\\bar\\baz": "foo\\bar\\baz", + } +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/in_memory.go b/vendor/github.com/gobuffalo/packr/v2/file/resolver/in_memory.go new file mode 100644 index 000000000..aa37297e6 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/in_memory.go @@ -0,0 +1,64 @@ +package resolver + +import ( + "io/ioutil" + + "github.com/gobuffalo/packd" + "github.com/gobuffalo/packr/v2/file" + "github.com/gobuffalo/packr/v2/plog" + "github.com/pkg/errors" +) + +var _ Resolver = &InMemory{} + +type InMemory struct { + *packd.MemoryBox +} + +func (d InMemory) String() string { + return String(&d) +} + +func (d *InMemory) Resolve(box string, name string) (file.File, error) { + b, err := d.MemoryBox.Find(name) + if err != nil { + return nil, err + } + return file.NewFile(name, b) +} + +func (d *InMemory) Pack(name string, f file.File) error { + plog.Debug(d, "Pack", "name", name) + b, err := ioutil.ReadAll(f) + if err != nil { + return errors.WithStack(err) + } + d.AddBytes(name, b) + return nil +} + +func (d *InMemory) FileMap() map[string]file.File { + m := map[string]file.File{} + d.Walk(func(path string, file file.File) error { + m[path] = file + return nil + }) + return m +} + +func NewInMemory(files map[string]file.File) *InMemory { + if files == nil { + files = map[string]file.File{} + } + box := packd.NewMemoryBox() + + for p, f := range files { + if b, err := ioutil.ReadAll(f); err == nil { + box.AddBytes(p, b) + } + } + + return &InMemory{ + MemoryBox: box, + } +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/in_memory_test.go b/vendor/github.com/gobuffalo/packr/v2/file/resolver/in_memory_test.go new file mode 100644 index 000000000..ac01272fc --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/in_memory_test.go @@ -0,0 +1,30 @@ +package resolver + +import ( + "io/ioutil" + "strings" + "testing" + + "github.com/gobuffalo/packr/v2/file" + "github.com/stretchr/testify/require" +) + +func Test_inMemory_Find(t *testing.T) { + r := require.New(t) + + files := map[string]file.File{ + "foo.txt": qfile("foo.txt", "foo!"), + } + d := NewInMemory(files) + + f, err := d.Resolve("", "foo.txt") + r.NoError(err) + + fi, err := f.FileInfo() + r.NoError(err) + r.Equal("foo.txt", fi.Name()) + + b, err := ioutil.ReadAll(f) + r.NoError(err) + r.Equal("foo!", strings.TrimSpace(string(b))) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/packable.go b/vendor/github.com/gobuffalo/packr/v2/file/resolver/packable.go new file mode 100644 index 000000000..ee551fcc0 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/packable.go @@ -0,0 +1,7 @@ +package resolver + +import "github.com/gobuffalo/packr/v2/file" + +type Packable interface { + Pack(name string, f file.File) error +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/resolver.go b/vendor/github.com/gobuffalo/packr/v2/file/resolver/resolver.go new file mode 100644 index 000000000..8b00397ab --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/resolver.go @@ -0,0 +1,33 @@ +package resolver + +import ( + "encoding/json" + "fmt" + "os" + + "github.com/gobuffalo/packr/v2/file" +) + +type Resolver interface { + Resolve(string, string) (file.File, error) +} + +func defaultResolver() Resolver { + pwd, _ := os.Getwd() + return &Disk{ + Root: pwd, + } +} + +var DefaultResolver = defaultResolver() + +func String(r Resolver) string { + m := map[string]interface{}{ + "name": fmt.Sprintf("%T", r), + } + if fm, ok := r.(file.FileMappable); ok { + m["files"] = fm + } + b, _ := json.Marshal(m) + return string(b) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/file/resolver/resolver_test.go b/vendor/github.com/gobuffalo/packr/v2/file/resolver/resolver_test.go new file mode 100644 index 000000000..94e5701ef --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/file/resolver/resolver_test.go @@ -0,0 +1,11 @@ +package resolver + +import "github.com/gobuffalo/packr/v2/file" + +func qfile(name string, body string) file.File { + f, err := file.NewFile(name, []byte(body)) + if err != nil { + panic(err) + } + return f +} diff --git a/vendor/github.com/gobuffalo/packr/v2/go.mod b/vendor/github.com/gobuffalo/packr/v2/go.mod new file mode 100644 index 000000000..0bb33553f --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/go.mod @@ -0,0 +1,19 @@ +module github.com/gobuffalo/packr/v2 + +require ( + github.com/gobuffalo/buffalo-plugins v1.8.3 // indirect + github.com/gobuffalo/envy v1.6.11 + github.com/gobuffalo/genny v0.0.0-20181211165820-e26c8466f14d + github.com/gobuffalo/logger v0.0.0-20181127160119-5b956e21995c + github.com/gobuffalo/packd v0.0.0-20181212173646-eca3b8fd6687 + github.com/karrick/godirwalk v1.7.7 + github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2 + github.com/markbates/safe v1.0.1 + github.com/pkg/errors v0.8.0 + github.com/rogpeppe/go-internal v1.0.0 + github.com/sirupsen/logrus v1.2.0 + github.com/spf13/cobra v0.0.3 + github.com/stretchr/testify v1.2.2 + golang.org/x/sync v0.0.0-20181108010431-42b317875d0f + golang.org/x/tools v0.0.0-20181212172921-837e80568c09 +) diff --git a/vendor/github.com/gobuffalo/packr/v2/go.sum b/vendor/github.com/gobuffalo/packr/v2/go.sum new file mode 100644 index 000000000..164cf84ff --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/go.sum @@ -0,0 +1,387 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= +github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/ajg/form v0.0.0-20160822230020-523a5da1a92f/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= +github.com/codegangsta/negroni v1.0.0/go.mod h1:v0y3T5G7Y1UlFfyxFn/QLRU4a2EuNau2iZY63YTKWo0= +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/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/dustin/go-humanize v0.0.0-20180713052910-9f541cc9db5d/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/gobuffalo/buffalo v0.12.8-0.20181004233540-fac9bb505aa8/go.mod h1:sLyT7/dceRXJUxSsE813JTQtA3Eb1vjxWfo/N//vXIY= +github.com/gobuffalo/buffalo v0.13.0/go.mod h1:Mjn1Ba9wpIbpbrD+lIDMy99pQ0H0LiddMIIDGse7qT4= +github.com/gobuffalo/buffalo-plugins v1.0.2/go.mod h1:pOp/uF7X3IShFHyobahTkTLZaeUXwb0GrUTb9ngJWTs= +github.com/gobuffalo/buffalo-plugins v1.0.4/go.mod h1:pWS1vjtQ6uD17MVFWf7i3zfThrEKWlI5+PYLw/NaDB4= +github.com/gobuffalo/buffalo-plugins v1.4.3/go.mod h1:uCzTY0woez4nDMdQjkcOYKanngeUVRO2HZi7ezmAjWY= +github.com/gobuffalo/buffalo-plugins v1.5.1/go.mod h1:jbmwSZK5+PiAP9cC09VQOrGMZFCa/P0UMlIS3O12r5w= +github.com/gobuffalo/buffalo-plugins v1.6.4/go.mod h1:/+N1aophkA2jZ1ifB2O3Y9yGwu6gKOVMtUmJnbg+OZI= +github.com/gobuffalo/buffalo-plugins v1.6.5/go.mod h1:0HVkbgrVs/MnPZ/FOseDMVanCTm2RNcdM0PuXcL1NNI= +github.com/gobuffalo/buffalo-plugins v1.6.7/go.mod h1:ZGZRkzz2PiKWHs0z7QsPBOTo2EpcGRArMEym6ghKYgk= +github.com/gobuffalo/buffalo-plugins v1.6.9/go.mod h1:yYlYTrPdMCz+6/+UaXg5Jm4gN3xhsvsQ2ygVatZV5vw= +github.com/gobuffalo/buffalo-plugins v1.6.11/go.mod h1:eAA6xJIL8OuynJZ8amXjRmHND6YiusVAaJdHDN1Lu8Q= +github.com/gobuffalo/buffalo-plugins v1.8.2 h1:yA/adm1SRp8qZSHKMd0LH5+rhSez1DjY2uQSmhMZrLo= +github.com/gobuffalo/buffalo-plugins v1.8.2/go.mod h1:9te6/VjEQ7pKp7lXlDIMqzxgGpjlKoAcAANdCgoR960= +github.com/gobuffalo/buffalo-plugins v1.8.3 h1:LEbQCqCKSSQgX8Sfq2dGs2o7bDT4s6TZJWwWUNQKsF0= +github.com/gobuffalo/buffalo-plugins v1.8.3/go.mod h1:IAWq6vjZJVXebIq2qGTLOdlXzmpyTZ5iJG5b59fza5U= +github.com/gobuffalo/buffalo-pop v1.0.5/go.mod h1:Fw/LfFDnSmB/vvQXPvcXEjzP98Tc+AudyNWUBWKCwQ8= +github.com/gobuffalo/envy v1.6.4/go.mod h1:Abh+Jfw475/NWtYMEt+hnJWRiC8INKWibIMyNt1w2Mc= +github.com/gobuffalo/envy v1.6.5/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.6/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.7/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.8/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.9/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.10/go.mod h1:X0CFllQjTV5ogsnUrg+Oks2yTI+PU2dGYBJOEI2D1Uo= +github.com/gobuffalo/envy v1.6.11 h1:dCKSFypLRvqaaUtyzkfKKF2j35ce5agsqfyIrRmm02E= +github.com/gobuffalo/envy v1.6.11/go.mod h1:Fiq52W7nrHGDggFPhn2ZCcHw4u/rqXkqo+i7FB6EAcg= +github.com/gobuffalo/events v1.0.3/go.mod h1:Txo8WmqScapa7zimEQIwgiJBvMECMe9gJjsKNPN3uZw= +github.com/gobuffalo/events v1.0.7/go.mod h1:z8txf6H9jWhQ5Scr7YPLWg/cgXBRj8Q4uYI+rsVCCSQ= +github.com/gobuffalo/events v1.0.8/go.mod h1:A5KyqT1sA+3GJiBE4QKZibse9mtOcI9nw8gGrDdqYGs= +github.com/gobuffalo/events v1.1.3/go.mod h1:9yPGWYv11GENtzrIRApwQRMYSbUgCsZ1w6R503fCfrk= +github.com/gobuffalo/events v1.1.4/go.mod h1:09/YRRgZHEOts5Isov+g9X2xajxdvOAcUuAHIX/O//A= +github.com/gobuffalo/events v1.1.5/go.mod h1:3YUSzgHfYctSjEjLCWbkXP6djH2M+MLaVRzb4ymbAK0= +github.com/gobuffalo/events v1.1.7/go.mod h1:6fGqxH2ing5XMb3EYRq9LEkVlyPGs4oO/eLzh+S8CxY= +github.com/gobuffalo/events v1.1.8 h1:T9SXUVyO1kF61uns5a8cpqsSPj5txZgIplbOoNNltqk= +github.com/gobuffalo/events v1.1.8/go.mod h1:UFy+W6X6VbCWS8k2iT81HYX65dMtiuVycMy04cplt/8= +github.com/gobuffalo/fizz v1.0.12/go.mod h1:C0sltPxpYK8Ftvf64kbsQa2yiCZY4RZviurNxXdAKwc= +github.com/gobuffalo/flect v0.0.0-20180907193754-dc14d8acaf9f/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181002182613-4571df4b1daf/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181007231023-ae7ed6bfe683/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181018182602-fd24a256709f/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181019110701-3d6f0b585514/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181024204909-8f6be1a8c6c2/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181104133451-1f6e9779237a/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181114183036-47375f6d8328 h1:nvA0/snr4wQeCwBYmrbftniJun/kxOjK/Pz3ivb7wis= +github.com/gobuffalo/flect v0.0.0-20181114183036-47375f6d8328/go.mod h1:0HvNbHdfh+WOvDSIASqJOSxTOWSxCCUF++k/Y53v9rI= +github.com/gobuffalo/genny v0.0.0-20180924032338-7af3a40f2252/go.mod h1:tUTQOogrr7tAQnhajMSH6rv1BVev34H2sa1xNHMy94g= +github.com/gobuffalo/genny v0.0.0-20181003150629-3786a0744c5d/go.mod h1:WAd8HmjMVrnkAZbmfgH5dLBUchsZfqzp/WS5sQz+uTM= +github.com/gobuffalo/genny v0.0.0-20181005145118-318a41a134cc/go.mod h1:WAd8HmjMVrnkAZbmfgH5dLBUchsZfqzp/WS5sQz+uTM= +github.com/gobuffalo/genny v0.0.0-20181007153042-b8de7d566757/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA= +github.com/gobuffalo/genny v0.0.0-20181012161047-33e5f43d83a6/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA= +github.com/gobuffalo/genny v0.0.0-20181017160347-90a774534246/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA= +github.com/gobuffalo/genny v0.0.0-20181024195656-51392254bf53/go.mod h1:o9GEH5gn5sCKLVB5rHFC4tq40rQ3VRUzmx6WwmaqISE= +github.com/gobuffalo/genny v0.0.0-20181025145300-af3f81d526b8/go.mod h1:uZ1fFYvdcP8mu0B/Ynarf6dsGvp7QFIpk/QACUuFUVI= +github.com/gobuffalo/genny v0.0.0-20181027191429-94d6cfb5c7fc/go.mod h1:x7SkrQQBx204Y+O9EwRXeszLJDTaWN0GnEasxgLrQTA= +github.com/gobuffalo/genny v0.0.0-20181027195209-3887b7171c4f/go.mod h1:JbKx8HSWICu5zyqWOa0dVV1pbbXOHusrSzQUprW6g+w= +github.com/gobuffalo/genny v0.0.0-20181106193839-7dcb0924caf1/go.mod h1:x61yHxvbDCgQ/7cOAbJCacZQuHgB0KMSzoYcw5debjU= +github.com/gobuffalo/genny v0.0.0-20181107223128-f18346459dbe/go.mod h1:utQD3aKKEsdb03oR+Vi/6ztQb1j7pO10N3OBoowRcSU= +github.com/gobuffalo/genny v0.0.0-20181114215459-0a4decd77f5d/go.mod h1:kN2KZ8VgXF9VIIOj/GM0Eo7YK+un4Q3tTreKOf0q1ng= +github.com/gobuffalo/genny v0.0.0-20181119162812-e8ff4adce8bb/go.mod h1:BA9htSe4bZwBDJLe8CUkoqkypq3hn3+CkoHqVOW718E= +github.com/gobuffalo/genny v0.0.0-20181127225641-2d959acc795b/go.mod h1:l54xLXNkteX/PdZ+HlgPk1qtcrgeOr3XUBBPDbH+7CQ= +github.com/gobuffalo/genny v0.0.0-20181128191930-77e34f71ba2a/go.mod h1:FW/D9p7cEEOqxYA71/hnrkOWm62JZ5ZNxcNIVJEaWBU= +github.com/gobuffalo/genny v0.0.0-20181203165245-fda8bcce96b1/go.mod h1:wpNSANu9UErftfiaAlz1pDZclrYzLtO5lALifODyjuM= +github.com/gobuffalo/genny v0.0.0-20181203201232-849d2c9534ea/go.mod h1:wpNSANu9UErftfiaAlz1pDZclrYzLtO5lALifODyjuM= +github.com/gobuffalo/genny v0.0.0-20181206121324-d6fb8a0dbe36/go.mod h1:wpNSANu9UErftfiaAlz1pDZclrYzLtO5lALifODyjuM= +github.com/gobuffalo/genny v0.0.0-20181207164119-84844398a37d/go.mod h1:y0ysCHGGQf2T3vOhCrGHheYN54Y/REj0ayd0Suf4C/8= +github.com/gobuffalo/genny v0.0.0-20181211165820-e26c8466f14d h1:E9vKkmvd+KhQeOoKvcT4zveTKddiTopk6VifuxuO5LA= +github.com/gobuffalo/genny v0.0.0-20181211165820-e26c8466f14d/go.mod h1:sHnK+ZSU4e2feXP3PA29ouij6PUEiN+RCwECjCTB3yM= +github.com/gobuffalo/github_flavored_markdown v1.0.4/go.mod h1:uRowCdK+q8d/RF0Kt3/DSalaIXbb0De/dmTqMQdkQ4I= +github.com/gobuffalo/github_flavored_markdown v1.0.5/go.mod h1:U0643QShPF+OF2tJvYNiYDLDGDuQmJZXsf/bHOJPsMY= +github.com/gobuffalo/github_flavored_markdown v1.0.7 h1:Vjvz4wqOnviiLEfTh5bh270b3lhpJiwwQEWOWmHMwY8= +github.com/gobuffalo/github_flavored_markdown v1.0.7/go.mod h1:w93Pd9Lz6LvyQXEG6DktTPHkOtCbr+arAD5mkwMzXLI= +github.com/gobuffalo/httptest v1.0.2/go.mod h1:7T1IbSrg60ankme0aDLVnEY0h056g9M1/ZvpVThtB7E= +github.com/gobuffalo/licenser v0.0.0-20180924033006-eae28e638a42/go.mod h1:Ubo90Np8gpsSZqNScZZkVXXAo5DGhTb+WYFIjlnog8w= +github.com/gobuffalo/licenser v0.0.0-20181025145548-437d89de4f75/go.mod h1:x3lEpYxkRG/XtGCUNkio+6RZ/dlOvLzTI9M1auIwFcw= +github.com/gobuffalo/licenser v0.0.0-20181027200154-58051a75da95/go.mod h1:BzhaaxGd1tq1+OLKObzgdCV9kqVhbTulxOpYbvMQWS0= +github.com/gobuffalo/licenser v0.0.0-20181109171355-91a2a7aac9a7/go.mod h1:m+Ygox92pi9bdg+gVaycvqE8RVSjZp7mWw75+K5NPHk= +github.com/gobuffalo/licenser v0.0.0-20181128165715-cc7305f8abed/go.mod h1:oU9F9UCE+AzI/MueCKZamsezGOOHfSirltllOVeRTAE= +github.com/gobuffalo/licenser v0.0.0-20181203160806-fe900bbede07/go.mod h1:ph6VDNvOzt1CdfaWC+9XwcBnlSTBz2j49PBwum6RFaU= +github.com/gobuffalo/logger v0.0.0-20181022175615-46cfb361fc27/go.mod h1:8sQkgyhWipz1mIctHF4jTxmJh1Vxhp7mP8IqbljgJZo= +github.com/gobuffalo/logger v0.0.0-20181027144941-73d08d2bb969/go.mod h1:7uGg2duHKpWnN4+YmyKBdLXfhopkAdVM6H3nKbyFbz8= +github.com/gobuffalo/logger v0.0.0-20181027193913-9cf4dd0efe46/go.mod h1:7uGg2duHKpWnN4+YmyKBdLXfhopkAdVM6H3nKbyFbz8= +github.com/gobuffalo/logger v0.0.0-20181109185836-3feeab578c17/go.mod h1:oNErH0xLe+utO+OW8ptXMSA5DkiSEDW1u3zGIt8F9Ew= +github.com/gobuffalo/logger v0.0.0-20181117211126-8e9b89b7c264/go.mod h1:5etB91IE0uBlw9k756fVKZJdS+7M7ejVhmpXXiSFj0I= +github.com/gobuffalo/logger v0.0.0-20181127160119-5b956e21995c h1:Z/ppYX6EtPEysbW4VEGz2dO+4F4VTthWp2sWRUCANdU= +github.com/gobuffalo/logger v0.0.0-20181127160119-5b956e21995c/go.mod h1:+HxKANrR9VGw9yN3aOAppJKvhO05ctDi63w4mDnKv2U= +github.com/gobuffalo/makr v1.1.5/go.mod h1:Y+o0btAH1kYAMDJW/TX3+oAXEu0bmSLLoC9mIFxtzOw= +github.com/gobuffalo/mapi v1.0.0/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/mapi v1.0.1 h1:JRuTiZzDEZhBHkFiHTxJkYRT6CbYuL0K/rn+1byJoEA= +github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/meta v0.0.0-20181018155829-df62557efcd3/go.mod h1:XTTOhwMNryif3x9LkTTBO/Llrveezd71u3quLd0u7CM= +github.com/gobuffalo/meta v0.0.0-20181018192820-8c6cef77dab3/go.mod h1:E94EPzx9NERGCY69UWlcj6Hipf2uK/vnfrF4QD0plVE= +github.com/gobuffalo/meta v0.0.0-20181025145500-3a985a084b0a/go.mod h1:YDAKBud2FP7NZdruCSlmTmDOZbVSa6bpK7LJ/A/nlKg= +github.com/gobuffalo/meta v0.0.0-20181114191255-b130ebedd2f7/go.mod h1:K6cRZ29ozr4Btvsqkjvg5nDFTLOgTqf03KA70Ks0ypE= +github.com/gobuffalo/meta v0.0.0-20181127070345-0d7e59dd540b h1:TP4reYa74tCqKmeisA9aULXzcb1fHIM3bi7PdoDxpuQ= +github.com/gobuffalo/meta v0.0.0-20181127070345-0d7e59dd540b/go.mod h1:RLO7tMvE0IAKAM8wny1aN12pvEKn7EtkBLkUZR00Qf8= +github.com/gobuffalo/mw-basicauth v1.0.3/go.mod h1:dg7+ilMZOKnQFHDefUzUHufNyTswVUviCBgF244C1+0= +github.com/gobuffalo/mw-contenttype v0.0.0-20180802152300-74f5a47f4d56/go.mod h1:7EvcmzBbeCvFtQm5GqF9ys6QnCxz2UM1x0moiWLq1No= +github.com/gobuffalo/mw-csrf v0.0.0-20180802151833-446ff26e108b/go.mod h1:sbGtb8DmDZuDUQoxjr8hG1ZbLtZboD9xsn6p77ppcHo= +github.com/gobuffalo/mw-forcessl v0.0.0-20180802152810-73921ae7a130/go.mod h1:JvNHRj7bYNAMUr/5XMkZaDcw3jZhUZpsmzhd//FFWmQ= +github.com/gobuffalo/mw-i18n v0.0.0-20180802152014-e3060b7e13d6/go.mod h1:91AQfukc52A6hdfIfkxzyr+kpVYDodgAeT5cjX1UIj4= +github.com/gobuffalo/mw-paramlogger v0.0.0-20181005191442-d6ee392ec72e/go.mod h1:6OJr6VwSzgJMqWMj7TYmRUqzNe2LXu/W1rRW4MAz/ME= +github.com/gobuffalo/mw-tokenauth v0.0.0-20181001105134-8545f626c189/go.mod h1:UqBF00IfKvd39ni5+yI5MLMjAf4gX7cDKN/26zDOD6c= +github.com/gobuffalo/packd v0.0.0-20181027182251-01ad393492c8/go.mod h1:SmdBdhj6uhOsg1Ui4SFAyrhuc7U4VCildosO5IDJ3lc= +github.com/gobuffalo/packd v0.0.0-20181027190505-aafc0d02c411/go.mod h1:SmdBdhj6uhOsg1Ui4SFAyrhuc7U4VCildosO5IDJ3lc= +github.com/gobuffalo/packd v0.0.0-20181027194105-7ae579e6d213/go.mod h1:SmdBdhj6uhOsg1Ui4SFAyrhuc7U4VCildosO5IDJ3lc= +github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181104210303-d376b15f8e96/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181111195323-b2e760a5f0ff/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181114190715-f25c5d2471d7/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181124090624-311c6248e5fb/go.mod h1:Foenia9ZvITEvG05ab6XpiD5EfBHPL8A6hush8SJ0o8= +github.com/gobuffalo/packd v0.0.0-20181207120301-c49825f8f6f4/go.mod h1:LYc0TGKFBBFTRC9dg2pcRcMqGCTMD7T2BIMP7OBuQAA= +github.com/gobuffalo/packd v0.0.0-20181212173646-eca3b8fd6687 h1:uZ+G4JprR0UEq0aHZs+6eP7TEZuFfrIkmQWejIBV/QQ= +github.com/gobuffalo/packd v0.0.0-20181212173646-eca3b8fd6687/go.mod h1:LYc0TGKFBBFTRC9dg2pcRcMqGCTMD7T2BIMP7OBuQAA= +github.com/gobuffalo/packr v1.13.7/go.mod h1:KkinLIn/n6+3tVXMwg6KkNvWwVsrRAz4ph+jgpk3Z24= +github.com/gobuffalo/packr v1.15.0/go.mod h1:t5gXzEhIviQwVlNx/+3SfS07GS+cZ2hn76WLzPp6MGI= +github.com/gobuffalo/packr v1.15.1/go.mod h1:IeqicJ7jm8182yrVmNbM6PR4g79SjN9tZLH8KduZZwE= +github.com/gobuffalo/packr v1.19.0/go.mod h1:MstrNkfCQhd5o+Ct4IJ0skWlxN8emOq8DsoT1G98VIU= +github.com/gobuffalo/packr v1.20.0/go.mod h1:JDytk1t2gP+my1ig7iI4NcVaXr886+N0ecUga6884zw= +github.com/gobuffalo/packr v1.21.0/go.mod h1:H00jGfj1qFKxscFJSw8wcL4hpQtPe1PfU2wa6sg/SR0= +github.com/gobuffalo/packr/v2 v2.0.0-rc.8/go.mod h1:y60QCdzwuMwO2R49fdQhsjCPv7tLQFR0ayzxxla9zes= +github.com/gobuffalo/packr/v2 v2.0.0-rc.9/go.mod h1:fQqADRfZpEsgkc7c/K7aMew3n4aF1Kji7+lIZeR98Fc= +github.com/gobuffalo/packr/v2 v2.0.0-rc.10/go.mod h1:4CWWn4I5T3v4c1OsJ55HbHlUEKNWMITG5iIkdr4Px4w= +github.com/gobuffalo/packr/v2 v2.0.0-rc.11/go.mod h1:JoieH/3h3U4UmatmV93QmqyPUdf4wVM9HELaHEu+3fk= +github.com/gobuffalo/packr/v2 v2.0.0-rc.12/go.mod h1:FV1zZTsVFi1DSCboO36Xgs4pzCZBjB/tDV9Cz/lSaR8= +github.com/gobuffalo/plush v3.7.16+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.20+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.21+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.22+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.23+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.30+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.31+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.32+incompatible h1:sxY0WMa6J1pMuomTUQ8n2TlR3otiCVZaq21gSrHLScU= +github.com/gobuffalo/plush v3.7.32+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plushgen v0.0.0-20181128164830-d29dcb966cb2/go.mod h1:r9QwptTFnuvSaSRjpSp4S2/4e2D3tJhARYbvEBcKSb4= +github.com/gobuffalo/plushgen v0.0.0-20181203163832-9fc4964505c2/go.mod h1:opEdT33AA2HdrIwK1aibqnTJDVVKXC02Bar/GT1YRVs= +github.com/gobuffalo/plushgen v0.0.0-20181207152837-eedb135bd51b h1:jliYV28yo404IYmFsYmcxlc46KUd8W2iYEj3Zn2nymI= +github.com/gobuffalo/plushgen v0.0.0-20181207152837-eedb135bd51b/go.mod h1:Lcw7HQbEVm09sAQrCLzIxuhFbB3nAgp4c55E+UlynR0= +github.com/gobuffalo/pop v4.8.2+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/pop v4.8.3+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/pop v4.8.4+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/release v1.0.35/go.mod h1:VtHFAKs61vO3wboCec5xr9JPTjYyWYcvaM3lclkc4x4= +github.com/gobuffalo/release v1.0.38/go.mod h1:VtHFAKs61vO3wboCec5xr9JPTjYyWYcvaM3lclkc4x4= +github.com/gobuffalo/release v1.0.42/go.mod h1:RPs7EtafH4oylgetOJpGP0yCZZUiO4vqHfTHJjSdpug= +github.com/gobuffalo/release v1.0.52/go.mod h1:RPs7EtafH4oylgetOJpGP0yCZZUiO4vqHfTHJjSdpug= +github.com/gobuffalo/release v1.0.53/go.mod h1:FdF257nd8rqhNaqtDWFGhxdJ/Ig4J7VcS3KL7n/a+aA= +github.com/gobuffalo/release v1.0.54/go.mod h1:Pe5/RxRa/BE8whDpGfRqSI7D1a0evGK1T4JDm339tJc= +github.com/gobuffalo/release v1.0.61/go.mod h1:mfIO38ujUNVDlBziIYqXquYfBF+8FDHUjKZgYC1Hj24= +github.com/gobuffalo/release v1.0.72/go.mod h1:NP5NXgg/IX3M5XmHmWR99D687/3Dt9qZtTK/Lbwc1hU= +github.com/gobuffalo/release v1.1.1/go.mod h1:Sluak1Xd6kcp6snkluR1jeXAogdJZpFFRzTYRs/2uwg= +github.com/gobuffalo/release v1.1.3/go.mod h1:CuXc5/m+4zuq8idoDt1l4va0AXAn/OSs08uHOfMVr8E= +github.com/gobuffalo/shoulders v1.0.1 h1:BqVJBUXlBWAf+WLhXijVk3SCpp75LXrVBiIkOCzZbNc= +github.com/gobuffalo/shoulders v1.0.1/go.mod h1:V33CcVmaQ4gRUmHKwq1fiTXuf8Gp/qjQBUL5tHPmvbA= +github.com/gobuffalo/syncx v0.0.0-20181120191700-98333ab04150/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/gobuffalo/syncx v0.0.0-20181120194010-558ac7de985f h1:S5EeH1reN93KR0L6TQvkRpu9YggCYXrUqFh1iEgvdC0= +github.com/gobuffalo/syncx v0.0.0-20181120194010-558ac7de985f/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/gobuffalo/tags v2.0.11+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY= +github.com/gobuffalo/tags v2.0.14+incompatible h1:RbcLAfomSsAIM+47dnwtAn/DYZyNaXpF72j1P3t6rmw= +github.com/gobuffalo/tags v2.0.14+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY= +github.com/gobuffalo/uuid v2.0.3+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/uuid v2.0.4+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/uuid v2.0.5+incompatible h1:c5uWRuEnYggYCrT9AJm0U2v1QTG7OVDAvxhj8tIV5Gc= +github.com/gobuffalo/uuid v2.0.5+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/validate v2.0.3+incompatible h1:6f4JCEz11Zi6iIlexMv7Jz10RBPvgI795AOaubtCwTE= +github.com/gobuffalo/validate v2.0.3+incompatible/go.mod h1:N+EtDe0J8252BgfzQUChBgfd6L93m9weay53EWFVsMM= +github.com/gobuffalo/x v0.0.0-20181003152136-452098b06085/go.mod h1:WevpGD+5YOreDJznWevcn8NTmQEW5STSBgIkpkjzqXc= +github.com/gobuffalo/x v0.0.0-20181007152206-913e47c59ca7/go.mod h1:9rDPXaB3kXdKWzMc4odGQQdG2e2DIEmANy5aSJ9yesY= +github.com/gofrs/uuid v3.1.0+incompatible h1:q2rtkjaKT4YEr6E1kamy0Ha4RtepWlQBedyHx0uzKwA= +github.com/gofrs/uuid v3.1.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1/go.mod h1:YeAe0gNeiNT5hoiZRI4yiOky6jVdNvfO2N6Kav/HmxY= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.1.2/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/gorilla/sessions v1.1.3/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ= +github.com/jackc/pgx v3.2.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= +github.com/jmoiron/sqlx v0.0.0-20180614180643-0dae4fefe7c0/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU= +github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +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.7.5/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46shStcFDJ34= +github.com/karrick/godirwalk v1.7.7 h1:lLkPCA+C0u1pI4fLFseaupvh5/THlPJIqSPmnGGViKs= +github.com/karrick/godirwalk v1.7.7/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46shStcFDJ34= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +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/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/markbates/deplist v1.0.4/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM= +github.com/markbates/deplist v1.0.5 h1:BKTJDTV5EynLGvTyONdgYVvV34DWq20mJAfGBCP+AYs= +github.com/markbates/deplist v1.0.5/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM= +github.com/markbates/going v1.0.2/go.mod h1:UWCk3zm0UKefHZ7l8BNqi26UyiEMniznk8naLdTcy6c= +github.com/markbates/grift v1.0.4/go.mod h1:wbmtW74veyx+cgfwFhlnnMWqhoz55rnHR47oMXzsyVs= +github.com/markbates/hmax v1.0.0/go.mod h1:cOkR9dktiESxIMu+65oc/r/bdY4bE8zZw3OLhLx0X2c= +github.com/markbates/inflect v1.0.0/go.mod h1:oTeZL2KHA7CUX6X+fovmK9OvIOFuqu0TwdQrZjLTh88= +github.com/markbates/inflect v1.0.1/go.mod h1:uv3UVNBe5qBIfCm8O8Q+DW+S1EopeyINj+Ikhc7rnCk= +github.com/markbates/inflect v1.0.3/go.mod h1:1fR9+pO2KHEO9ZRtto13gDwwZaAKstQzferVeWqbgNs= +github.com/markbates/inflect v1.0.4 h1:5fh1gzTFhfae06u3hzHYO9xe3l3v3nW5Pwt3naLTP5g= +github.com/markbates/inflect v1.0.4/go.mod h1:1fR9+pO2KHEO9ZRtto13gDwwZaAKstQzferVeWqbgNs= +github.com/markbates/oncer v0.0.0-20180924031910-e862a676800b/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/oncer v0.0.0-20180924034138-723ad0170a46/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/oncer v0.0.0-20181014194634-05fccaae8fc4/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2 h1:JgVTCPf0uBVcUSWpyXmGpgOc62nK5HWUBKAGc3Qqa5k= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/refresh v1.4.10/go.mod h1:NDPHvotuZmTmesXxr95C9bjlw1/0frJwtME2dzcVKhc= +github.com/markbates/safe v1.0.0/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +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/markbates/sigtx v1.0.0/go.mod h1:QF1Hv6Ic6Ca6W+T+DL0Y/ypborFKyvUY9HmuCD4VeTc= +github.com/markbates/willie v1.0.9/go.mod h1:fsrFVWl91+gXpx/6dv715j7i11fYPfZ9ZGfH0DQzY7w= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/microcosm-cc/bluemonday v1.0.1 h1:SIYunPjnlXcW+gVfvm0IlSeR5U3WZUOLfVmqg85Go44= +github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/monoculum/formam v0.0.0-20180901015400-4e68be1d79ba/go.mod h1:RKgILGEJq24YyJ2ban8EO0RUVSJlF1pGsEvoLEACr/Q= +github.com/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2xBGjv0j365Q= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.0.0 h1:o4VLZ5jqHE+HahLT6drNtSGTrrUA3wPBmtpgqtdbClo= +github.com/rogpeppe/go-internal v1.0.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516 h1:ofR1ZdrNSkiWcMsRrubK9tb2/SlZVWttAfqUjJi6QYc= +github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs= +github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= +github.com/shurcooL/highlight_go v0.0.0-20170515013102-78fb10f4a5f8/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= +github.com/shurcooL/octicon v0.0.0-20180602230221-c42b0e3b24d9/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= +github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.1.0/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= +github.com/sirupsen/logrus v1.1.1/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= +github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d h1:yKm7XZV6j9Ev6lojP2XaIshpT4ymkqhMeSghO5Ps00E= +github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= +github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e h1:qpG93cPwA5f7s/ZPBJnGOYQNK/vKsaDaseuKT5Asee8= +github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +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.2.1/go.mod h1:P4AexN0a+C9tGAnUFNwDMYYZv3pjFuvmeiMyKRaNVlI= +github.com/spf13/viper v1.3.1/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/unrolled/secure v0.0.0-20180918153822-f340ee86eb8b/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA= +github.com/unrolled/secure v0.0.0-20181005190816-ff9db2ff917f/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181015023909-0c41d7ab0a0e/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181024171144-74cb1d3d52f4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181025113841-85e1b3f9139a/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181025213731-e84da0312774/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180816102801-aaf60122140d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180921000356-2f5d2388922f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181017193950-04a2e542c03f/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-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181106065722-10aee1819953/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-20181207154023-610586996380 h1:zPQexyRtNYBc7bcHmehl1dH6TB3qn8zytv8cBGLDNY0= +golang.org/x/net v0.0.0-20181207154023-610586996380/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c/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-20180906133057-8cf3aee42992/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180921163948-d47a0f339242/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180927150500-dad3d9fb7b6e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181011152604-fa43e7bc11ba/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181022134430-8a28ead16f52/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181024145615-5cd93ef61a7c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181025063200-d989b31c8746/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026064943-731415f00dce/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-20181106135930-3a76605856fd/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-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181206074257-70b957f3b65e h1:njOxP/wVblhCLIUhjHXf6X+dzTt5OQ3vMQo9mkOIKIo= +golang.org/x/sys v0.0.0-20181206074257-70b957f3b65e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181003024731-2f84ea8ef872/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181006002542-f60d9635b16a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181008205924-a2b3f7f249e9/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181013182035-5e66757b835f/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181017214349-06f26fdaaa28/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181024171208-a2dc47679d30/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181026183834-f60e5f99f081/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181105230042-78dc5bac0cac/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181107215632-34b416bd17b3/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181114190951-94339b83286c/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181119130350-139d099f6620/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181127195227-b4e97c0ed882/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181127232545-e782529d0ddd/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181203210056-e5f3ab76ea4b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181205224935-3576414c54a4/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181206194817-bcd4e47d0288/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181207183836-8bc39b988060/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181212172921-837e80568c09 h1:WIjxC3kcRzP2DkFjzRjR1EzCaCgVPTnsv0XFO7HP3Uk= +golang.org/x/tools v0.0.0-20181212172921-837e80568c09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +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/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw= +gopkg.in/mail.v2 v2.0.0-20180731213649-a0242b2233b4/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/gobuffalo/packr/v2/http_box_test.go b/vendor/github.com/gobuffalo/packr/v2/http_box_test.go new file mode 100644 index 000000000..a715f6667 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/http_box_test.go @@ -0,0 +1,110 @@ +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(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())) + }) + } +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/_r/r.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/_r/r.go new file mode 100644 index 000000000..5e2f0f1b7 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/_r/r.go @@ -0,0 +1,7 @@ +package q + +import "github.com/gobuffalo/packr/v2" + +func init() { + packr.New("bob", "dylan") +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/e/e.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/e/e.go new file mode 100644 index 000000000..d0269d48b --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/e/e.go @@ -0,0 +1,8 @@ +package q + +import "github.com/gobuffalo/packr/v2" + +func init() { + packr.New("tom", "petty") + packr.NewBox("./heartbreakers") +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/q.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/q.go new file mode 100644 index 000000000..ea0972117 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/q.go @@ -0,0 +1,7 @@ +package q + +import "github.com/gobuffalo/packr/v2" + +func init() { + packr.New("aretha", "franklin") +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/w/w.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/w/w.go new file mode 100644 index 000000000..790580777 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/_fixtures/new_from_roots/w/w.go @@ -0,0 +1,5 @@ +package main + +func main() { + +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/args.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/args.go new file mode 100644 index 000000000..5f042d15e --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/args.go @@ -0,0 +1,53 @@ +package parser + +import ( + "encoding/json" + + "github.com/pkg/errors" +) + +// FromArgs is useful when writing packr store-cmd binaries. +/* + package main + + import ( + "log" + "os" + + "github.com/gobuffalo/packr/v2/jam/parser" + "github.com/markbates/s3packr/s3packr" + ) + + func main() { + err := parser.FromArgs(os.Args[1:], func(boxes parser.Boxes) error { + for _, box := range boxes { + s3 := s3packr.New(box) + if err := s3.Pack(box); err != nil { + return err + } + } + return nil + }) + + if err != nil { + log.Fatal(err) + } + } +*/ +func FromArgs(args []string, fn func(Boxes) error) error { + if len(args) == 0 { + return errors.New("you must supply a payload") + } + payload := args[0] + if len(payload) == 0 { + return errors.New("you must supply a payload") + } + + var boxes Boxes + err := json.Unmarshal([]byte(payload), &boxes) + if err != nil { + return err + } + + return fn(boxes) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/box.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/box.go new file mode 100644 index 000000000..b29419127 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/box.go @@ -0,0 +1,40 @@ +package parser + +import ( + "encoding/json" + "os" + "strings" +) + +// Box found while parsing a file +type Box struct { + Name string // name of the box + Path string // relative path of folder NewBox("./templates") + AbsPath string // absolute path of Path + Package string // the package name the box was found in + PWD string // the PWD when the parser was run + PackageDir string // the absolute path of the package where the box was found +} + +type Boxes []*Box + +// String - json returned +func (b Box) String() string { + x, _ := json.Marshal(b) + return string(x) +} + +// NewBox stub from the name and the path provided +func NewBox(name string, path string) *Box { + if len(name) == 0 { + name = path + } + name = strings.Replace(name, "\"", "", -1) + pwd, _ := os.Getwd() + box := &Box{ + Name: name, + Path: path, + PWD: pwd, + } + return box +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/file.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/file.go new file mode 100644 index 000000000..3bf49cd0a --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/file.go @@ -0,0 +1,54 @@ +package parser + +import ( + "bytes" + "io" + "io/ioutil" + "path/filepath" +) + +// File that is to be parsed +type File struct { + io.Reader + Path string + AbsPath string +} + +// Name of the file "app.go" +func (f File) Name() string { + return f.Path +} + +// String returns the contents of the reader +func (f *File) String() string { + src, _ := ioutil.ReadAll(f) + f.Reader = bytes.NewReader(src) + return string(src) +} + +func (s *File) Write(p []byte) (int, error) { + bb := &bytes.Buffer{} + i, err := bb.Write(p) + s.Reader = bb + return i, err +} + +// NewFile takes the name of the file you want to +// write to and a reader to reader from +func NewFile(path string, r io.Reader) *File { + if r == nil { + r = &bytes.Buffer{} + } + if seek, ok := r.(io.Seeker); ok { + seek.Seek(0, 0) + } + abs := path + if !filepath.IsAbs(path) { + abs, _ = filepath.Abs(path) + } + return &File{ + Reader: r, + Path: path, + AbsPath: abs, + } +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/finder.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/finder.go new file mode 100644 index 000000000..164638829 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/finder.go @@ -0,0 +1,101 @@ +package parser + +import ( + "fmt" + "go/build" + "path/filepath" + "strings" + "time" + + "github.com/gobuffalo/packr/v2/plog" + "github.com/karrick/godirwalk" + "github.com/markbates/oncer" + "github.com/pkg/errors" +) + +type finder struct { + id time.Time +} + +func (fd *finder) key(m, dir string) string { + return fmt.Sprintf("%s-*parser.finder#%s-%s", fd.id, m, dir) +} + +// findAllGoFiles *.go files for a given diretory +func (fd *finder) findAllGoFiles(dir string) ([]string, error) { + var err error + var names []string + oncer.Do(fd.key("findAllGoFiles", dir), func() { + plog.Debug(fd, "findAllGoFiles", "dir", dir) + + callback := func(path string, do *godirwalk.Dirent) error { + ext := filepath.Ext(path) + if ext != ".go" { + return nil + } + names = append(names, path) + return nil + } + err = godirwalk.Walk(dir, &godirwalk.Options{ + FollowSymbolicLinks: true, + Callback: callback, + }) + }) + + return names, err +} + +func (fd *finder) findAllGoFilesImports(dir string) ([]string, error) { + var err error + var names []string + oncer.Do(fd.key("findAllGoFilesImports", dir), func() { + ctx := build.Default + + if len(ctx.SrcDirs()) == 0 { + err = errors.New("no src directories found") + return + } + + pkg, err := ctx.ImportDir(dir, 0) + if strings.HasPrefix(pkg.ImportPath, "github.com/gobuffalo/packr") { + return + } + + if err != nil { + if !strings.Contains(err.Error(), "cannot find package") { + if _, ok := errors.Cause(err).(*build.NoGoError); !ok { + err = errors.WithStack(err) + return + } + } + } + + if pkg.Goroot { + return + } + if len(pkg.GoFiles) <= 0 { + return + } + + plog.Debug(fd, "findAllGoFilesImports", "dir", dir) + + names, _ = fd.findAllGoFiles(dir) + for _, n := range pkg.GoFiles { + names = append(names, filepath.Join(pkg.Dir, n)) + } + for _, imp := range pkg.Imports { + if len(ctx.SrcDirs()) == 0 { + continue + } + d := ctx.SrcDirs()[len(ctx.SrcDirs())-1] + ip := filepath.Join(d, imp) + n, err := fd.findAllGoFilesImports(ip) + if err != nil && len(n) != 0 { + names = n + return + } + names = append(names, n...) + } + }) + return names, err +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/parser.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/parser.go new file mode 100644 index 000000000..17c1516d8 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/parser.go @@ -0,0 +1,47 @@ +package parser + +import ( + "os" + "sort" + "strings" + + "github.com/gobuffalo/packr/v2/plog" + "github.com/pkg/errors" +) + +// Parser to find boxes +type Parser struct { + Prospects []*File // a list of files to check for boxes + IgnoreImports bool +} + +// Run the parser and run any boxes found +func (p *Parser) Run() (Boxes, error) { + var boxes Boxes + for _, pros := range p.Prospects { + plog.Debug(p, "Run", "parsing", pros.Name()) + v := NewVisitor(pros) + pbr, err := v.Run() + if err != nil { + return boxes, errors.WithStack(err) + } + for _, b := range pbr { + plog.Debug(p, "Run", "file", pros.Name(), "box", b.Name) + boxes = append(boxes, b) + } + } + + pwd, _ := os.Getwd() + sort.Slice(boxes, func(a, b int) bool { + b1 := boxes[a] + return !strings.HasPrefix(b1.AbsPath, pwd) + }) + return boxes, nil +} + +// New Parser from a list of File +func New(prospects ...*File) *Parser { + return &Parser{ + Prospects: prospects, + } +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/parser_test.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/parser_test.go new file mode 100644 index 000000000..2a04411bd --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/parser_test.go @@ -0,0 +1,64 @@ +package parser_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/gobuffalo/packr/v2/jam/parser" + "github.com/gobuffalo/packr/v2/jam/store" + "github.com/markbates/oncer" + "github.com/stretchr/testify/require" +) + +func init() { + parser.DefaultIgnoredFolders = []string{"vendor", ".git", "node_modules", ".idea"} +} + +func Test_Parser_Run(t *testing.T) { + r := require.New(t) + + f1 := parser.NewFile("a/a.x", strings.NewReader(fmt.Sprintf(basicGoTmpl, "a"))) + f2 := parser.NewFile("b/b.x", strings.NewReader(fmt.Sprintf(basicGoTmpl, "b"))) + + p := parser.New(f1, f2) + boxes, err := p.Run() + r.NoError(err) + + r.Len(boxes, 4) +} + +func Test_NewFrom_Roots_Imports(t *testing.T) { + r := require.New(t) + store.Clean("./_fixtures") + p, err := parser.NewFromRoots([]string{"./_fixtures/new_from_roots"}, &parser.RootsOptions{}) + r.NoError(err) + + boxes, err := p.Run() + r.NoError(err) + r.Len(boxes, 3) +} + +func Test_NewFrom_Roots_Disk(t *testing.T) { + r := require.New(t) + oncer.Reset() + store.Clean("./_fixtures") + p, err := parser.NewFromRoots([]string{"./_fixtures/new_from_roots"}, &parser.RootsOptions{ + IgnoreImports: true, + }) + r.NoError(err) + + boxes, err := p.Run() + r.NoError(err) + r.Len(boxes, 3) +} + +const basicGoTmpl = `package %s + +import "github.com/gobuffalo/packr/v2" + +func init() { + packr.New("elvis", "./presley") + packr.NewBox("./buddy-holly") +} +` diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/prospect.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/prospect.go new file mode 100644 index 000000000..d5421cc1d --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/prospect.go @@ -0,0 +1,77 @@ +package parser + +import ( + "os" + "path/filepath" + "strings" + + "github.com/gobuffalo/packr/v2/file/resolver" + "github.com/gobuffalo/packr/v2/plog" +) + +var DefaultIgnoredFolders = []string{".", "_", "vendor", "node_modules", "_fixtures"} + +func IsProspect(path string, ignore ...string) (status bool) { + // plog.Debug("parser", "IsProspect", "path", path, "ignore", ignore) + defer func() { + if status { + plog.Debug("parser", "IsProspect (TRUE)", "path", path, "status", status) + } + }() + if path == "." { + return true + } + + ext := filepath.Ext(path) + dir := filepath.Dir(path) + + fi, _ := os.Stat(path) + if fi != nil { + if fi.IsDir() { + dir = filepath.Base(path) + } else { + if len(ext) > 0 { + dir = filepath.Base(filepath.Dir(path)) + } + } + } + + path = strings.ToLower(path) + dir = strings.ToLower(dir) + + if strings.HasSuffix(path, "-packr.go") { + return false + } + + if strings.HasSuffix(path, "_test.go") { + return false + } + + ignore = append(ignore, DefaultIgnoredFolders...) + for i, x := range ignore { + ignore[i] = strings.TrimSpace(strings.ToLower(x)) + } + + parts := strings.Split(resolver.OsPath(path), string(filepath.Separator)) + if len(parts) == 0 { + return false + } + + for _, i := range ignore { + for _, p := range parts { + if strings.HasPrefix(p, i) { + return false + } + } + } + + un := filepath.Base(path) + if len(ext) != 0 { + un = filepath.Base(filepath.Dir(path)) + } + if strings.HasPrefix(un, "_") { + return false + } + + return ext == ".go" +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/prospect_test.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/prospect_test.go new file mode 100644 index 000000000..f023f811f --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/prospect_test.go @@ -0,0 +1,38 @@ +package parser + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_IsProspect(t *testing.T) { + table := []struct { + path string + pass bool + }{ + {"foo/.git/config", false}, + {"foo/.git/baz.go", false}, + {"a.go", true}, + {".", true}, + {"a/b.go", true}, + {"a/b_test.go", false}, + {"a/b-packr.go", false}, + {"a/vendor/b.go", false}, + {"a/_c/c.go", false}, + {"a/_c/e/fe/f/c.go", false}, + {"a/d/_d.go", false}, + {"a/d/", false}, + } + + for _, tt := range table { + t.Run(tt.path, func(st *testing.T) { + r := require.New(st) + if tt.pass { + r.True(IsProspect(tt.path, ".", "_")) + } else { + r.False(IsProspect(tt.path, ".", "_")) + } + }) + } +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/roots.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/roots.go new file mode 100644 index 000000000..777f535de --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/roots.go @@ -0,0 +1,90 @@ +package parser + +import ( + "bytes" + "encoding/json" + "io/ioutil" + "os" + "path/filepath" + "time" + + "github.com/gobuffalo/packr/v2/plog" + "github.com/karrick/godirwalk" + "github.com/pkg/errors" +) + +type RootsOptions struct { + IgnoreImports bool + Ignores []string +} + +func (r RootsOptions) String() string { + x, _ := json.Marshal(r) + return string(x) +} + +// NewFromRoots scans the file roots provided and returns a +// new Parser containing the prospects +func NewFromRoots(roots []string, opts *RootsOptions) (*Parser, error) { + if opts == nil { + opts = &RootsOptions{} + } + + if len(roots) == 0 { + pwd, _ := os.Getwd() + roots = append(roots, pwd) + } + p := New() + plog.Debug(p, "NewFromRoots", "roots", roots, "options", opts) + callback := func(path string, de *godirwalk.Dirent) error { + if IsProspect(path, opts.Ignores...) { + if de.IsDir() { + return nil + } + roots = append(roots, path) + return nil + } + if de.IsDir() { + return filepath.SkipDir + } + return nil + } + wopts := &godirwalk.Options{ + FollowSymbolicLinks: true, + Callback: callback, + } + for _, root := range roots { + plog.Debug(p, "NewFromRoots", "walking", root) + err := godirwalk.Walk(root, wopts) + if err != nil { + return p, errors.WithStack(err) + } + } + + dd := map[string]string{} + fd := &finder{id: time.Now()} + for _, r := range roots { + var names []string + if opts.IgnoreImports { + names, _ = fd.findAllGoFiles(r) + } else { + names, _ = fd.findAllGoFilesImports(r) + } + for _, n := range names { + if IsProspect(n) { + plog.Debug(p, "NewFromRoots", "mapping", n) + dd[n] = n + } + } + } + for path := range dd { + plog.Debug(p, "NewFromRoots", "reading file", path) + b, err := ioutil.ReadFile(path) + if err != nil { + return nil, errors.WithStack(err) + } + p.Prospects = append(p.Prospects, NewFile(path, bytes.NewReader(b))) + } + plog.Debug(p, "NewFromRoots", "found prospects", len(p.Prospects)) + return p, nil +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/visitor.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/visitor.go new file mode 100644 index 000000000..8c6ce6d2c --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/visitor.go @@ -0,0 +1,326 @@ +package parser + +import ( + "fmt" + "go/ast" + "os" + "path/filepath" + "sort" + "strings" + + "github.com/gobuffalo/genny" + "github.com/gobuffalo/genny/movinglater/gotools" + "github.com/pkg/errors" +) + +type Visitor struct { + File genny.File + Package string + boxes map[string]*Box + errors []error +} + +func NewVisitor(f *File) *Visitor { + return &Visitor{ + File: f, + boxes: map[string]*Box{}, + errors: []error{}, + } +} + +func (v *Visitor) Run() (Boxes, error) { + var boxes Boxes + pf, err := gotools.ParseFile(v.File) + if err != nil { + return boxes, errors.Wrap(err, v.File.Name()) + } + + v.Package = pf.Ast.Name.Name + ast.Walk(v, pf.Ast) + + for _, vb := range v.boxes { + boxes = append(boxes, vb) + } + + sort.Slice(boxes, func(i, j int) bool { + return boxes[i].Name < boxes[j].Name + }) + + if len(v.errors) > 0 { + s := make([]string, len(v.errors)) + for i, e := range v.errors { + s[i] = e.Error() + } + return boxes, errors.Wrap(errors.New(strings.Join(s, "\n")), v.File.Name()) + } + return boxes, 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 errors.WithStack(err) + } + } + case *ast.FuncDecl: + if t.Body == nil { + return nil + } + for _, b := range t.Body.List { + if err := v.evalStmt(b); err != nil { + return errors.WithStack(err) + } + } + return nil + case *ast.ValueSpec: + for _, e := range t.Values { + if err := v.evalExpr(e); err != nil { + return errors.WithStack(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 errors.WithStack(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 errors.WithStack(err) + } + case *ast.CompositeLit: + for _, e := range at.Elts { + if err := v.evalExpr(e); err != nil { + return errors.WithStack(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 errors.WithStack(err) + } + } + 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 errors.WithStack(err) + } + case *ast.Ident: + return v.evalIdent(st) + } + for _, a := range at.Args { + if err := v.evalArgs(a); err != nil { + return errors.WithStack(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" { + switch sel.Sel.Name { + case "New": + if len(expr.Args) != 2 { + return errors.New("`New` requires two arguments") + } + + zz := func(e ast.Expr) (string, error) { + switch at := e.(type) { + case *ast.Ident: + switch at.Obj.Kind { + case ast.Var: + if as, ok := at.Obj.Decl.(*ast.AssignStmt); ok { + return v.fromVariable(as) + } + case ast.Con: + if vs, ok := at.Obj.Decl.(*ast.ValueSpec); ok { + return v.fromConstant(vs) + } + } + return "", v.evalIdent(at) + case *ast.BasicLit: + return at.Value, nil + case *ast.CallExpr: + return "", v.evalExpr(at) + } + return "", errors.Errorf("can't handle %T", e) + } + + k1, err := zz(expr.Args[0]) + if err != nil { + return errors.WithStack(err) + } + k2, err := zz(expr.Args[1]) + if err != nil { + return errors.WithStack(err) + } + v.addBox(k1, k2) + + return nil + case "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(name string, path string) { + if len(name) == 0 { + name = path + } + name = strings.Replace(name, "\"", "", -1) + path = strings.Replace(path, "\"", "", -1) + abs := path + if _, ok := v.boxes[name]; !ok { + box := NewBox(name, path) + box.Package = v.Package + + pd := filepath.Dir(v.File.Name()) + pwd, _ := os.Getwd() + if !filepath.IsAbs(pd) { + pd = filepath.Join(pwd, pd) + } + box.PackageDir = pd + + if !filepath.IsAbs(abs) { + abs = filepath.Join(pd, abs) + } + box.AbsPath = abs + v.boxes[name] = box + } +} +func (v *Visitor) fromVariable(as *ast.AssignStmt) (string, error) { + if len(as.Rhs) == 1 { + if bs, ok := as.Rhs[0].(*ast.BasicLit); ok { + return bs.Value, nil + } + } + return "", errors.Wrap(errors.New("unable to find value from variable"), fmt.Sprint(as)) +} + +func (v *Visitor) addVariable(bn string, as *ast.AssignStmt) error { + bv, err := v.fromVariable(as) + if err != nil { + return nil + } + if len(bn) == 0 { + bn = bv + } + v.addBox(bn, bv) + return nil +} + +func (v *Visitor) fromConstant(vs *ast.ValueSpec) (string, error) { + if len(vs.Values) == 1 { + if bs, ok := vs.Values[0].(*ast.BasicLit); ok { + return bs.Value, nil + } + } + return "", errors.Wrap(errors.New("unable to find value from constant"), fmt.Sprint(vs)) +} + +func (v *Visitor) addConstant(bn string, vs *ast.ValueSpec) error { + if len(vs.Values) == 1 { + if bs, ok := vs.Values[0].(*ast.BasicLit); ok { + bv := bs.Value + if len(bn) == 0 { + bn = bv + } + v.addBox(bn, bv) + } + } + return nil +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/parser/visitor_test.go b/vendor/github.com/gobuffalo/packr/v2/jam/parser/visitor_test.go new file mode 100644 index 000000000..e41f5cc74 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/parser/visitor_test.go @@ -0,0 +1,76 @@ +package parser + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_Visitor(t *testing.T) { + r := require.New(t) + v := NewVisitor(NewFile("example/example.go", strings.NewReader(example))) + + boxes, err := v.Run() + r.NoError(err) + + r.Equal("example", v.Package) + r.Len(v.errors, 0) + + var act []string + for _, b := range boxes { + act = append(act, b.Name) + } + + exp := []string{"./assets", "./bar", "./constant", "./foo", "./sf", "./templates", "./variable", "beatles"} + r.Len(act, len(exp)) + r.Equal(exp, act) +} + +const example = `package example + +import ( + "github.com/gobuffalo/packr/v2" +) + +var a = packr.NewBox("./foo") +var pw = packr.New("beatles", "./paperback-writer") + +const constString = "./constant" + +type S struct{} + +func (S) f(packr.Box) {} + +func init() { + // packr.NewBox("../idontexists") + + b := "./variable" + packr.NewBox(b) + + packr.New("beatles", "./day-tripper") + + 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/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/a/a.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/a/a.go new file mode 100644 index 000000000..bd03162fd --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/a/a.go @@ -0,0 +1,7 @@ +package a + +import "github.com/gobuffalo/packr/v2" + +func init() { + packr.New("a-box", "../c") +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/b/b.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/b/b.go new file mode 100644 index 000000000..d7635fa74 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/b/b.go @@ -0,0 +1,8 @@ +package b + +import "github.com/gobuffalo/packr/v2" + +func init() { + packr.New("b-box", "../c") + packr.New("cb-box", "../c") +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/c/d.txt b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/c/d.txt new file mode 100644 index 000000000..178481050 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/c/d.txt @@ -0,0 +1 @@ +D diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/c/e.txt b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/c/e.txt new file mode 100644 index 000000000..1c5072613 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/c/e.txt @@ -0,0 +1 @@ +E diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/c/f.txt b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/c/f.txt new file mode 100644 index 000000000..cf84443e4 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/c/f.txt @@ -0,0 +1 @@ +F diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/go.mod b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/go.mod new file mode 100644 index 000000000..287ee37d7 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/go.mod @@ -0,0 +1,6 @@ +module foo + +require ( + github.com/gobuffalo/packr/v2 v2.0.0-rc.2 // indirect + golang.org/x/tools v0.0.0-20181116193547-e77c06808af6 // indirect +) diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/go.sum b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/go.sum new file mode 100644 index 000000000..10d8818b3 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk-pack/go.sum @@ -0,0 +1,291 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/ajg/form v0.0.0-20160822230020-523a5da1a92f/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= +github.com/codegangsta/negroni v1.0.0/go.mod h1:v0y3T5G7Y1UlFfyxFn/QLRU4a2EuNau2iZY63YTKWo0= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/dustin/go-humanize v0.0.0-20180713052910-9f541cc9db5d/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/gobuffalo/buffalo v0.12.8-0.20181004233540-fac9bb505aa8/go.mod h1:sLyT7/dceRXJUxSsE813JTQtA3Eb1vjxWfo/N//vXIY= +github.com/gobuffalo/buffalo v0.13.0/go.mod h1:Mjn1Ba9wpIbpbrD+lIDMy99pQ0H0LiddMIIDGse7qT4= +github.com/gobuffalo/buffalo-plugins v1.0.2/go.mod h1:pOp/uF7X3IShFHyobahTkTLZaeUXwb0GrUTb9ngJWTs= +github.com/gobuffalo/buffalo-plugins v1.0.4/go.mod h1:pWS1vjtQ6uD17MVFWf7i3zfThrEKWlI5+PYLw/NaDB4= +github.com/gobuffalo/buffalo-plugins v1.4.3/go.mod h1:uCzTY0woez4nDMdQjkcOYKanngeUVRO2HZi7ezmAjWY= +github.com/gobuffalo/buffalo-plugins v1.5.1/go.mod h1:jbmwSZK5+PiAP9cC09VQOrGMZFCa/P0UMlIS3O12r5w= +github.com/gobuffalo/buffalo-plugins v1.6.4/go.mod h1:/+N1aophkA2jZ1ifB2O3Y9yGwu6gKOVMtUmJnbg+OZI= +github.com/gobuffalo/buffalo-plugins v1.6.5/go.mod h1:0HVkbgrVs/MnPZ/FOseDMVanCTm2RNcdM0PuXcL1NNI= +github.com/gobuffalo/buffalo-plugins v1.6.7/go.mod h1:ZGZRkzz2PiKWHs0z7QsPBOTo2EpcGRArMEym6ghKYgk= +github.com/gobuffalo/buffalo-plugins v1.6.9 h1:Z4WSEWPSxHMxrxVwCdy9x0QVZjirywhGpZaB9yeCwdc= +github.com/gobuffalo/buffalo-plugins v1.6.9/go.mod h1:yYlYTrPdMCz+6/+UaXg5Jm4gN3xhsvsQ2ygVatZV5vw= +github.com/gobuffalo/buffalo-pop v1.0.5/go.mod h1:Fw/LfFDnSmB/vvQXPvcXEjzP98Tc+AudyNWUBWKCwQ8= +github.com/gobuffalo/envy v1.6.4/go.mod h1:Abh+Jfw475/NWtYMEt+hnJWRiC8INKWibIMyNt1w2Mc= +github.com/gobuffalo/envy v1.6.5/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.6/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.7/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.8/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/envy v1.6.9 h1:ShEJ/fUg/wr5qIYmTTOnUQ0sy1yGo+4uYQJNgg753S8= +github.com/gobuffalo/envy v1.6.9/go.mod h1:N+GkhhZ/93bGZc6ZKhJLP6+m+tCNPKwgSpH9kaifseQ= +github.com/gobuffalo/events v1.0.3/go.mod h1:Txo8WmqScapa7zimEQIwgiJBvMECMe9gJjsKNPN3uZw= +github.com/gobuffalo/events v1.0.7/go.mod h1:z8txf6H9jWhQ5Scr7YPLWg/cgXBRj8Q4uYI+rsVCCSQ= +github.com/gobuffalo/events v1.0.8/go.mod h1:A5KyqT1sA+3GJiBE4QKZibse9mtOcI9nw8gGrDdqYGs= +github.com/gobuffalo/events v1.1.3/go.mod h1:9yPGWYv11GENtzrIRApwQRMYSbUgCsZ1w6R503fCfrk= +github.com/gobuffalo/events v1.1.4/go.mod h1:09/YRRgZHEOts5Isov+g9X2xajxdvOAcUuAHIX/O//A= +github.com/gobuffalo/events v1.1.5/go.mod h1:3YUSzgHfYctSjEjLCWbkXP6djH2M+MLaVRzb4ymbAK0= +github.com/gobuffalo/events v1.1.7 h1:X+wjuT7c1rZNKqhfevIA30oFCgO5JBlnW6hvAJcv1Vg= +github.com/gobuffalo/events v1.1.7/go.mod h1:6fGqxH2ing5XMb3EYRq9LEkVlyPGs4oO/eLzh+S8CxY= +github.com/gobuffalo/fizz v1.0.12/go.mod h1:C0sltPxpYK8Ftvf64kbsQa2yiCZY4RZviurNxXdAKwc= +github.com/gobuffalo/flect v0.0.0-20180907193754-dc14d8acaf9f/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181002182613-4571df4b1daf/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181007231023-ae7ed6bfe683/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181018182602-fd24a256709f/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181019110701-3d6f0b585514/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181024204909-8f6be1a8c6c2/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181104133451-1f6e9779237a/go.mod h1:rCiQgmAE4axgBNl3jZWzS5rETRYTGOsrixTRaCPzNdA= +github.com/gobuffalo/flect v0.0.0-20181114183036-47375f6d8328 h1:nvA0/snr4wQeCwBYmrbftniJun/kxOjK/Pz3ivb7wis= +github.com/gobuffalo/flect v0.0.0-20181114183036-47375f6d8328/go.mod h1:0HvNbHdfh+WOvDSIASqJOSxTOWSxCCUF++k/Y53v9rI= +github.com/gobuffalo/genny v0.0.0-20180924032338-7af3a40f2252/go.mod h1:tUTQOogrr7tAQnhajMSH6rv1BVev34H2sa1xNHMy94g= +github.com/gobuffalo/genny v0.0.0-20181003150629-3786a0744c5d/go.mod h1:WAd8HmjMVrnkAZbmfgH5dLBUchsZfqzp/WS5sQz+uTM= +github.com/gobuffalo/genny v0.0.0-20181005145118-318a41a134cc/go.mod h1:WAd8HmjMVrnkAZbmfgH5dLBUchsZfqzp/WS5sQz+uTM= +github.com/gobuffalo/genny v0.0.0-20181007153042-b8de7d566757/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA= +github.com/gobuffalo/genny v0.0.0-20181012161047-33e5f43d83a6/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA= +github.com/gobuffalo/genny v0.0.0-20181017160347-90a774534246/go.mod h1:+oG5Ljrw04czAHbPXREwaFojJbpUvcIy4DiOnbEJFTA= +github.com/gobuffalo/genny v0.0.0-20181024195656-51392254bf53/go.mod h1:o9GEH5gn5sCKLVB5rHFC4tq40rQ3VRUzmx6WwmaqISE= +github.com/gobuffalo/genny v0.0.0-20181025145300-af3f81d526b8/go.mod h1:uZ1fFYvdcP8mu0B/Ynarf6dsGvp7QFIpk/QACUuFUVI= +github.com/gobuffalo/genny v0.0.0-20181027191429-94d6cfb5c7fc/go.mod h1:x7SkrQQBx204Y+O9EwRXeszLJDTaWN0GnEasxgLrQTA= +github.com/gobuffalo/genny v0.0.0-20181027195209-3887b7171c4f/go.mod h1:JbKx8HSWICu5zyqWOa0dVV1pbbXOHusrSzQUprW6g+w= +github.com/gobuffalo/genny v0.0.0-20181106193839-7dcb0924caf1/go.mod h1:x61yHxvbDCgQ/7cOAbJCacZQuHgB0KMSzoYcw5debjU= +github.com/gobuffalo/genny v0.0.0-20181114215459-0a4decd77f5d h1:mznfLmbY1+EhkTIWhk19fZHuxoOLqZ/wzFUcKr5OGY8= +github.com/gobuffalo/genny v0.0.0-20181114215459-0a4decd77f5d/go.mod h1:kN2KZ8VgXF9VIIOj/GM0Eo7YK+un4Q3tTreKOf0q1ng= +github.com/gobuffalo/github_flavored_markdown v1.0.4/go.mod h1:uRowCdK+q8d/RF0Kt3/DSalaIXbb0De/dmTqMQdkQ4I= +github.com/gobuffalo/github_flavored_markdown v1.0.5/go.mod h1:U0643QShPF+OF2tJvYNiYDLDGDuQmJZXsf/bHOJPsMY= +github.com/gobuffalo/github_flavored_markdown v1.0.7/go.mod h1:w93Pd9Lz6LvyQXEG6DktTPHkOtCbr+arAD5mkwMzXLI= +github.com/gobuffalo/httptest v1.0.2/go.mod h1:7T1IbSrg60ankme0aDLVnEY0h056g9M1/ZvpVThtB7E= +github.com/gobuffalo/licenser v0.0.0-20180924033006-eae28e638a42/go.mod h1:Ubo90Np8gpsSZqNScZZkVXXAo5DGhTb+WYFIjlnog8w= +github.com/gobuffalo/licenser v0.0.0-20181025145548-437d89de4f75/go.mod h1:x3lEpYxkRG/XtGCUNkio+6RZ/dlOvLzTI9M1auIwFcw= +github.com/gobuffalo/licenser v0.0.0-20181027200154-58051a75da95/go.mod h1:BzhaaxGd1tq1+OLKObzgdCV9kqVhbTulxOpYbvMQWS0= +github.com/gobuffalo/logger v0.0.0-20181022175615-46cfb361fc27/go.mod h1:8sQkgyhWipz1mIctHF4jTxmJh1Vxhp7mP8IqbljgJZo= +github.com/gobuffalo/logger v0.0.0-20181027144941-73d08d2bb969/go.mod h1:7uGg2duHKpWnN4+YmyKBdLXfhopkAdVM6H3nKbyFbz8= +github.com/gobuffalo/logger v0.0.0-20181027193913-9cf4dd0efe46/go.mod h1:7uGg2duHKpWnN4+YmyKBdLXfhopkAdVM6H3nKbyFbz8= +github.com/gobuffalo/logger v0.0.0-20181109185836-3feeab578c17 h1:DnrA/oPJXI+mdlhX8LS8Gwj3uiTQhKOZCDAAcWSCYk0= +github.com/gobuffalo/logger v0.0.0-20181109185836-3feeab578c17/go.mod h1:oNErH0xLe+utO+OW8ptXMSA5DkiSEDW1u3zGIt8F9Ew= +github.com/gobuffalo/makr v1.1.5/go.mod h1:Y+o0btAH1kYAMDJW/TX3+oAXEu0bmSLLoC9mIFxtzOw= +github.com/gobuffalo/mapi v1.0.0/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/mapi v1.0.1 h1:JRuTiZzDEZhBHkFiHTxJkYRT6CbYuL0K/rn+1byJoEA= +github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/meta v0.0.0-20181018155829-df62557efcd3/go.mod h1:XTTOhwMNryif3x9LkTTBO/Llrveezd71u3quLd0u7CM= +github.com/gobuffalo/meta v0.0.0-20181018192820-8c6cef77dab3/go.mod h1:E94EPzx9NERGCY69UWlcj6Hipf2uK/vnfrF4QD0plVE= +github.com/gobuffalo/meta v0.0.0-20181025145500-3a985a084b0a h1:kROH1vRfBoxH1QIQjINB4qi4TmQTdg2Z/yzrKq1f2qM= +github.com/gobuffalo/meta v0.0.0-20181025145500-3a985a084b0a/go.mod h1:YDAKBud2FP7NZdruCSlmTmDOZbVSa6bpK7LJ/A/nlKg= +github.com/gobuffalo/mw-basicauth v1.0.3/go.mod h1:dg7+ilMZOKnQFHDefUzUHufNyTswVUviCBgF244C1+0= +github.com/gobuffalo/mw-contenttype v0.0.0-20180802152300-74f5a47f4d56/go.mod h1:7EvcmzBbeCvFtQm5GqF9ys6QnCxz2UM1x0moiWLq1No= +github.com/gobuffalo/mw-csrf v0.0.0-20180802151833-446ff26e108b/go.mod h1:sbGtb8DmDZuDUQoxjr8hG1ZbLtZboD9xsn6p77ppcHo= +github.com/gobuffalo/mw-forcessl v0.0.0-20180802152810-73921ae7a130/go.mod h1:JvNHRj7bYNAMUr/5XMkZaDcw3jZhUZpsmzhd//FFWmQ= +github.com/gobuffalo/mw-i18n v0.0.0-20180802152014-e3060b7e13d6/go.mod h1:91AQfukc52A6hdfIfkxzyr+kpVYDodgAeT5cjX1UIj4= +github.com/gobuffalo/mw-paramlogger v0.0.0-20181005191442-d6ee392ec72e/go.mod h1:6OJr6VwSzgJMqWMj7TYmRUqzNe2LXu/W1rRW4MAz/ME= +github.com/gobuffalo/mw-tokenauth v0.0.0-20181001105134-8545f626c189/go.mod h1:UqBF00IfKvd39ni5+yI5MLMjAf4gX7cDKN/26zDOD6c= +github.com/gobuffalo/packd v0.0.0-20181027182251-01ad393492c8/go.mod h1:SmdBdhj6uhOsg1Ui4SFAyrhuc7U4VCildosO5IDJ3lc= +github.com/gobuffalo/packd v0.0.0-20181027190505-aafc0d02c411/go.mod h1:SmdBdhj6uhOsg1Ui4SFAyrhuc7U4VCildosO5IDJ3lc= +github.com/gobuffalo/packd v0.0.0-20181027194105-7ae579e6d213/go.mod h1:SmdBdhj6uhOsg1Ui4SFAyrhuc7U4VCildosO5IDJ3lc= +github.com/gobuffalo/packd v0.0.0-20181031195726-c82734870264/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181104210303-d376b15f8e96/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181111195323-b2e760a5f0ff/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packd v0.0.0-20181114190715-f25c5d2471d7 h1:7AZMyDyRxIm2cbSXRvUEUJrankvMV1xcAOrrWUWp7yE= +github.com/gobuffalo/packd v0.0.0-20181114190715-f25c5d2471d7/go.mod h1:Yf2toFaISlyQrr5TfO3h6DB9pl9mZRmyvBGQb/aQ/pI= +github.com/gobuffalo/packr v1.13.7/go.mod h1:KkinLIn/n6+3tVXMwg6KkNvWwVsrRAz4ph+jgpk3Z24= +github.com/gobuffalo/packr v1.15.0/go.mod h1:t5gXzEhIviQwVlNx/+3SfS07GS+cZ2hn76WLzPp6MGI= +github.com/gobuffalo/packr v1.15.1/go.mod h1:IeqicJ7jm8182yrVmNbM6PR4g79SjN9tZLH8KduZZwE= +github.com/gobuffalo/packr v1.19.0/go.mod h1:MstrNkfCQhd5o+Ct4IJ0skWlxN8emOq8DsoT1G98VIU= +github.com/gobuffalo/packr v1.20.0 h1:XDHu3L931kHjr0v80vJ9hAxOMavbSpzuwAXDONsMYcM= +github.com/gobuffalo/packr v1.20.0/go.mod h1:JDytk1t2gP+my1ig7iI4NcVaXr886+N0ecUga6884zw= +github.com/gobuffalo/packr/v2 v2.0.0-rc.2 h1:22PapDc3YjlxFvfJ5ukc47/CwmwSQgZhma2wGf05eC8= +github.com/gobuffalo/packr/v2 v2.0.0-rc.2/go.mod h1:4Xjr6aIxzyYQN6TBp/oJZ4L+X17DGfq3dy0DCidBebw= +github.com/gobuffalo/plush v3.7.16+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.20+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.21+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/plush v3.7.22+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= +github.com/gobuffalo/pop v4.8.2+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/pop v4.8.3+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/pop v4.8.4+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg= +github.com/gobuffalo/release v1.0.35/go.mod h1:VtHFAKs61vO3wboCec5xr9JPTjYyWYcvaM3lclkc4x4= +github.com/gobuffalo/release v1.0.38/go.mod h1:VtHFAKs61vO3wboCec5xr9JPTjYyWYcvaM3lclkc4x4= +github.com/gobuffalo/release v1.0.42/go.mod h1:RPs7EtafH4oylgetOJpGP0yCZZUiO4vqHfTHJjSdpug= +github.com/gobuffalo/release v1.0.52/go.mod h1:RPs7EtafH4oylgetOJpGP0yCZZUiO4vqHfTHJjSdpug= +github.com/gobuffalo/release v1.0.53/go.mod h1:FdF257nd8rqhNaqtDWFGhxdJ/Ig4J7VcS3KL7n/a+aA= +github.com/gobuffalo/release v1.0.54/go.mod h1:Pe5/RxRa/BE8whDpGfRqSI7D1a0evGK1T4JDm339tJc= +github.com/gobuffalo/release v1.0.61/go.mod h1:mfIO38ujUNVDlBziIYqXquYfBF+8FDHUjKZgYC1Hj24= +github.com/gobuffalo/shoulders v1.0.1/go.mod h1:V33CcVmaQ4gRUmHKwq1fiTXuf8Gp/qjQBUL5tHPmvbA= +github.com/gobuffalo/tags v2.0.11+incompatible/go.mod h1:9XmhOkyaB7UzvuY4UoZO4s67q8/xRMVJEaakauVQYeY= +github.com/gobuffalo/uuid v2.0.3+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/uuid v2.0.4+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/uuid v2.0.5+incompatible/go.mod h1:ErhIzkRhm0FtRuiE/PeORqcw4cVi1RtSpnwYrxuvkfE= +github.com/gobuffalo/validate v2.0.3+incompatible/go.mod h1:N+EtDe0J8252BgfzQUChBgfd6L93m9weay53EWFVsMM= +github.com/gobuffalo/x v0.0.0-20181003152136-452098b06085/go.mod h1:WevpGD+5YOreDJznWevcn8NTmQEW5STSBgIkpkjzqXc= +github.com/gobuffalo/x v0.0.0-20181007152206-913e47c59ca7/go.mod h1:9rDPXaB3kXdKWzMc4odGQQdG2e2DIEmANy5aSJ9yesY= +github.com/gofrs/uuid v3.1.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/pat v0.0.0-20180118222023-199c85a7f6d1/go.mod h1:YeAe0gNeiNT5hoiZRI4yiOky6jVdNvfO2N6Kav/HmxY= +github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= +github.com/gorilla/sessions v1.1.2/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/gorilla/sessions v1.1.3/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ= +github.com/jackc/pgx v3.2.0+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= +github.com/jmoiron/sqlx v0.0.0-20180614180643-0dae4fefe7c0/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU= +github.com/joho/godotenv v1.2.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +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.7.5 h1:JQFiMR65pT543bkWP46+k194gS999qo/OYccos9cOXg= +github.com/karrick/godirwalk v1.7.5/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46shStcFDJ34= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +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/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/markbates/deplist v1.0.4/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM= +github.com/markbates/deplist v1.0.5/go.mod h1:gRRbPbbuA8TmMiRvaOzUlRfzfjeCCBqX2A6arxN01MM= +github.com/markbates/going v1.0.2/go.mod h1:UWCk3zm0UKefHZ7l8BNqi26UyiEMniznk8naLdTcy6c= +github.com/markbates/grift v1.0.4/go.mod h1:wbmtW74veyx+cgfwFhlnnMWqhoz55rnHR47oMXzsyVs= +github.com/markbates/hmax v1.0.0/go.mod h1:cOkR9dktiESxIMu+65oc/r/bdY4bE8zZw3OLhLx0X2c= +github.com/markbates/inflect v1.0.0/go.mod h1:oTeZL2KHA7CUX6X+fovmK9OvIOFuqu0TwdQrZjLTh88= +github.com/markbates/inflect v1.0.1/go.mod h1:uv3UVNBe5qBIfCm8O8Q+DW+S1EopeyINj+Ikhc7rnCk= +github.com/markbates/inflect v1.0.3/go.mod h1:1fR9+pO2KHEO9ZRtto13gDwwZaAKstQzferVeWqbgNs= +github.com/markbates/inflect v1.0.4/go.mod h1:1fR9+pO2KHEO9ZRtto13gDwwZaAKstQzferVeWqbgNs= +github.com/markbates/oncer v0.0.0-20180924031910-e862a676800b/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/oncer v0.0.0-20180924034138-723ad0170a46/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/oncer v0.0.0-20181014194634-05fccaae8fc4 h1:Mlji5gkcpzkqTROyE4ZxZ8hN7osunMb2RuGVrbvMvCc= +github.com/markbates/oncer v0.0.0-20181014194634-05fccaae8fc4/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/refresh v1.4.10/go.mod h1:NDPHvotuZmTmesXxr95C9bjlw1/0frJwtME2dzcVKhc= +github.com/markbates/safe v1.0.0/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +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/markbates/sigtx v1.0.0/go.mod h1:QF1Hv6Ic6Ca6W+T+DL0Y/ypborFKyvUY9HmuCD4VeTc= +github.com/markbates/willie v1.0.9/go.mod h1:fsrFVWl91+gXpx/6dv715j7i11fYPfZ9ZGfH0DQzY7w= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.0.0/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/monoculum/formam v0.0.0-20180901015400-4e68be1d79ba/go.mod h1:RKgILGEJq24YyJ2ban8EO0RUVSJlF1pGsEvoLEACr/Q= +github.com/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2xBGjv0j365Q= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= +github.com/shurcooL/highlight_go v0.0.0-20170515013102-78fb10f4a5f8/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= +github.com/shurcooL/octicon v0.0.0-20180602230221-c42b0e3b24d9/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= +github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.1.0/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= +github.com/sirupsen/logrus v1.1.1/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= +github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= +github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.2.0/go.mod h1:r2rcYCSwa1IExKTDiTfzaxqT2FNHs8hODu4LnUfgKEg= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +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.2.1/go.mod h1:P4AexN0a+C9tGAnUFNwDMYYZv3pjFuvmeiMyKRaNVlI= +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/unrolled/secure v0.0.0-20180918153822-f340ee86eb8b/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA= +github.com/unrolled/secure v0.0.0-20181005190816-ff9db2ff917f/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181015023909-0c41d7ab0a0e/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181024171144-74cb1d3d52f4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181025113841-85e1b3f9139a/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181025213731-e84da0312774/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd h1:VtIkGDhk0ph3t+THbvXHfMZ8QHgsBO39Nh52+74pq7w= +golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180816102801-aaf60122140d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180921000356-2f5d2388922f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181017193950-04a2e542c03f/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-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +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/sys v0.0.0-20180816055513-1c9583448a9c/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-20180906133057-8cf3aee42992/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180921163948-d47a0f339242/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180927150500-dad3d9fb7b6e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181011152604-fa43e7bc11ba/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181022134430-8a28ead16f52/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181024145615-5cd93ef61a7c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181025063200-d989b31c8746/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026064943-731415f00dce/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-20181106135930-3a76605856fd h1:5lx5yH6109ClL0rlBzOj++ZkX/njUT+RVgTO2RMbmZo= +golang.org/x/sys v0.0.0-20181106135930-3a76605856fd/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181003024731-2f84ea8ef872/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181006002542-f60d9635b16a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181008205924-a2b3f7f249e9/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181013182035-5e66757b835f/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181017214349-06f26fdaaa28/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181024171208-a2dc47679d30/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181026183834-f60e5f99f081/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181105230042-78dc5bac0cac/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181114190951-94339b83286c/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181115011154-2a3f5192be2e h1:C6Dd9cORPM5l1agULNKGE7TsHE1f4fKb6u/C03xjFxo= +golang.org/x/tools v0.0.0-20181115011154-2a3f5192be2e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181116193547-e77c06808af6 h1:eiQyQ1ZGSmM3I3XUf/clCROlBlOlmAUmTJ9l2GjX2GE= +golang.org/x/tools v0.0.0-20181116193547-e77c06808af6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw= +gopkg.in/mail.v2 v2.0.0-20180731213649-a0242b2233b4/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/_r/r.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/_r/r.go new file mode 100644 index 000000000..5e2f0f1b7 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/_r/r.go @@ -0,0 +1,7 @@ +package q + +import "github.com/gobuffalo/packr/v2" + +func init() { + packr.New("bob", "dylan") +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/e/e.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/e/e.go new file mode 100644 index 000000000..e097685ec --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/e/e.go @@ -0,0 +1,8 @@ +package q + +import "github.com/gobuffalo/packr/v2" + +func init() { + packr.New("tom", "./petty") + packr.NewBox("../e/heartbreakers") +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/e/heartbreakers/refugee.txt b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/e/heartbreakers/refugee.txt new file mode 100644 index 000000000..eeca8b26a --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/e/heartbreakers/refugee.txt @@ -0,0 +1 @@ +YOU DON'T HAVE TO BE A REFUGEE! diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/e/petty/fallin.txt b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/e/petty/fallin.txt new file mode 100644 index 000000000..ac1dae43d --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/e/petty/fallin.txt @@ -0,0 +1 @@ +FREE FALLIN! diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/franklin/aretha.txt b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/franklin/aretha.txt new file mode 100644 index 000000000..be658c493 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/franklin/aretha.txt @@ -0,0 +1 @@ +RESPECT! diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/franklin/think.txt b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/franklin/think.txt new file mode 100644 index 000000000..d068d77e8 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/franklin/think.txt @@ -0,0 +1 @@ +THINK! diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/q.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/q.go new file mode 100644 index 000000000..958df8418 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/q.go @@ -0,0 +1,7 @@ +package q + +import "github.com/gobuffalo/packr/v2" + +func init() { + packr.New("aretha", "./franklin") +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/w/w.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/w/w.go new file mode 100644 index 000000000..790580777 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/_fixtures/disk/w/w.go @@ -0,0 +1,5 @@ +package main + +func main() { + +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/clean.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/clean.go new file mode 100644 index 000000000..cfdca4b98 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/clean.go @@ -0,0 +1,76 @@ +package store + +import ( + "os" + "path/filepath" + "strings" + + "github.com/gobuffalo/packr/v2/jam/parser" + "github.com/pkg/errors" +) + +func Clean(root string) error { + defer func() { + packd := filepath.Join(root, "packrd") + os.RemoveAll(packd) + }() + + p, err := parser.NewFromRoots([]string{root}, &parser.RootsOptions{}) + if err != nil { + return errors.WithStack(err) + } + + boxes, err := p.Run() + if err != nil { + return errors.WithStack(err) + } + + d := NewDisk("", "") + for _, box := range boxes { + if err := d.Clean(box); err != nil { + return errors.WithStack(err) + } + } + return nil +} + +func clean(root string) error { + if len(root) == 0 { + pwd, err := os.Getwd() + if err != nil { + return errors.WithStack(err) + } + root = pwd + } + if _, err := os.Stat(root); err != nil { + return nil + } + defer func() { + packd := filepath.Join(root, "packrd") + os.RemoveAll(packd) + }() + + err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error { + if err != nil { + return errors.WithStack(err) + } + if info.IsDir() { + if filepath.Base(path) == "packrd" { + os.RemoveAll(path) + return filepath.SkipDir + } + } + if strings.HasSuffix(path, "-packr.go") { + err := os.RemoveAll(path) + if err != nil { + return errors.WithStack(err) + } + } + return nil + }) + if err != nil { + return errors.WithStack(err) + } + + return nil +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/disk.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/disk.go new file mode 100644 index 000000000..dff4e8f2a --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/disk.go @@ -0,0 +1,323 @@ +package store + +import ( + "bytes" + "compress/gzip" + "context" + "crypto/md5" + "fmt" + "go/build" + "html/template" + "io" + "io/ioutil" + "os" + "path" + "path/filepath" + "sort" + "strings" + "sync" + + "github.com/gobuffalo/envy" + "github.com/gobuffalo/genny" + "github.com/gobuffalo/genny/movinglater/gotools" + "github.com/gobuffalo/packr/v2/file/resolver/encoding/hex" + "github.com/gobuffalo/packr/v2/plog" + "github.com/rogpeppe/go-internal/modfile" + + "github.com/gobuffalo/packr/v2/jam/parser" + "github.com/karrick/godirwalk" + "github.com/pkg/errors" + "golang.org/x/sync/errgroup" +) + +var _ Store = &Disk{} + +const DISK_GLOBAL_KEY = "__packr_global__" + +type Disk struct { + DBPath string + DBPackage string + global map[string]string + boxes map[string]*parser.Box + moot *sync.RWMutex +} + +func NewDisk(path string, pkg string) *Disk { + if len(path) == 0 { + path = "packrd" + } + if len(pkg) == 0 { + pkg = "packrd" + } + if !filepath.IsAbs(path) { + path, _ = filepath.Abs(path) + } + return &Disk{ + DBPath: path, + DBPackage: pkg, + global: map[string]string{}, + boxes: map[string]*parser.Box{}, + moot: &sync.RWMutex{}, + } +} + +func (d *Disk) FileNames(box *parser.Box) ([]string, error) { + path := box.AbsPath + if len(box.AbsPath) == 0 { + path = box.Path + } + var names []string + if _, err := os.Stat(path); err != nil { + return names, nil + } + err := godirwalk.Walk(path, &godirwalk.Options{ + FollowSymbolicLinks: true, + Callback: func(path string, de *godirwalk.Dirent) error { + if !de.IsRegular() { + return nil + } + names = append(names, path) + return nil + }, + }) + return names, err +} + +func (d *Disk) Files(box *parser.Box) ([]*parser.File, error) { + var files []*parser.File + names, err := d.FileNames(box) + if err != nil { + return files, errors.WithStack(err) + } + for _, n := range names { + b, err := ioutil.ReadFile(n) + if err != nil { + return files, errors.WithStack(err) + } + f := parser.NewFile(n, bytes.NewReader(b)) + files = append(files, f) + } + return files, nil +} + +func (d *Disk) Pack(box *parser.Box) error { + plog.Debug(d, "Pack", "box", box.Name) + d.boxes[box.Name] = box + names, err := d.FileNames(box) + if err != nil { + return errors.WithStack(err) + } + for _, n := range names { + _, ok := d.global[n] + if ok { + continue + } + k := makeKey(box, n) + // not in the global, so add it! + d.global[n] = k + } + return nil +} + +func (d *Disk) Clean(box *parser.Box) error { + root := box.PackageDir + if len(root) == 0 { + return errors.New("can't clean an empty box.PackageDir") + } + plog.Debug(d, "Clean", "box", box.Name, "root", root) + return clean(root) +} + +type options struct { + Package string + GlobalFiles map[string]string + Boxes []optsBox + GK string +} + +type optsBox struct { + Name string + Path string +} + +func (d *Disk) Generator() (*genny.Generator, error) { + g := genny.New() + + xb := &parser.Box{Name: DISK_GLOBAL_KEY} + opts := options{ + Package: d.DBPackage, + GlobalFiles: map[string]string{}, + GK: makeKey(xb, d.DBPath), + } + + wg := errgroup.Group{} + for k, v := range d.global { + func(k, v string) { + wg.Go(func() error { + bb := &bytes.Buffer{} + enc := hex.NewEncoder(bb) + zw := gzip.NewWriter(enc) + f, err := os.Open(k) + if err != nil { + return errors.WithStack(err) + } + defer f.Close() + io.Copy(zw, f) + if err := zw.Close(); err != nil { + return errors.WithStack(err) + } + d.moot.Lock() + opts.GlobalFiles[makeKey(xb, k)] = bb.String() + d.moot.Unlock() + return nil + }) + }(k, v) + } + + if err := wg.Wait(); err != nil { + return g, errors.WithStack(err) + } + + for _, b := range d.boxes { + ob := optsBox{ + Name: b.Name, + } + opts.Boxes = append(opts.Boxes, ob) + } + + sort.Slice(opts.Boxes, func(a, b int) bool { + return opts.Boxes[a].Name < opts.Boxes[b].Name + }) + + t := gotools.TemplateTransformer(opts, template.FuncMap{ + "printBox": func(ob optsBox) (template.HTML, error) { + box := d.boxes[ob.Name] + if box == nil { + return "", errors.Errorf("could not find box %s", ob.Name) + } + fn, err := d.FileNames(box) + if err != nil { + return "", errors.WithStack(err) + } + if len(fn) == 0 { + return "", nil + } + + type file struct { + Resolver string + ForwardPath string + } + + gf := genny.NewFile("box.go.tmpl", strings.NewReader(diskGlobalBoxTmpl)) + var files []file + for _, s := range fn { + p := strings.TrimPrefix(s, box.AbsPath) + p = strings.TrimPrefix(p, string(filepath.Separator)) + files = append(files, file{ + Resolver: strings.Replace(p, "\\", "/", -1), + ForwardPath: makeKey(box, s), + }) + } + opts := map[string]interface{}{ + "Box": box, + "Files": files, + } + t := gotools.TemplateTransformer(opts, nil) + gf, err = t.Transform(gf) + if err != nil { + return "", errors.WithStack(err) + } + return template.HTML(gf.String()), nil + }, + }) + g.Transformer(t) + + fp := filepath.Join(d.DBPath, "packed-packr.go.tmpl") + global := genny.NewFile(fp, strings.NewReader(diskGlobalTmpl)) + global, err := t.Transform(global) + if err != nil { + return g, errors.WithStack(err) + } + + ft := gotools.FmtTransformer() + global, err = ft.Transform(global) + if err != nil { + return g, errors.WithStack(err) + } + g.File(global) + + var ip string + if envy.Mods() { + 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 g, errors.New("go.mod cannot be read or does not exist while go module is enabled.") + } + ip = modfile.ModulePath(moddata) + if ip == "" { + return g, errors.New("go.mod is malformed.") + } + } else { + ip = filepath.Dir(d.DBPath) + for _, x := range build.Default.SrcDirs() { + ip = strings.TrimPrefix(ip, x) + } + ip = strings.TrimPrefix(ip, string(filepath.Separator)) + + ip = strings.Replace(ip, "\\", "/", -1) + } + ip = path.Join(ip, d.DBPackage) + + for _, n := range opts.Boxes { + b := d.boxes[n.Name] + if b == nil { + continue + } + p := filepath.Join(b.PackageDir, b.Package+"-packr.go.tmpl") + f := genny.NewFile(p, strings.NewReader(diskImportTmpl)) + + o := struct { + Package string + Import string + }{ + Package: b.Package, + Import: ip, + } + + t := gotools.TemplateTransformer(o, template.FuncMap{}) + f, err := t.Transform(f) + if err != nil { + return g, nil + } + g.File(f) + } + + return g, nil +} + +func (d *Disk) Close() error { + plog.Debug(d, "Close") + run := genny.WetRunner(context.Background()) + run.Logger = plog.Logger + if err := run.WithNew(d.Generator()); err != nil { + return errors.WithStack(err) + } + return run.Run() +} + +// resolve file paths (only) for the boxes +// compile "global" db +// resolve files for boxes to point at global db +// write global db to disk (default internal/packr) +// write boxes db to disk (default internal/packr) +// write -packr.go files in each package (1 per package) that init the global db + +func makeKey(box *parser.Box, path string) string { + w := md5.New() + fmt.Fprint(w, path) + h := hex.EncodeToString(w.Sum(nil)) + return h +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/disk_packed_test.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/disk_packed_test.go new file mode 100644 index 000000000..08b0c4121 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/disk_packed_test.go @@ -0,0 +1,32 @@ +package store + +import ( + "github.com/gobuffalo/packr/v2" + "github.com/gobuffalo/packr/v2/file/resolver" +) + +var _ = func() error { + const gk = DISK_GLOBAL_KEY + g := packr.New(gk, "") + + hgr, err := resolver.NewHexGzip(map[string]string{ + "4abf3a9b652ecec6b347eb6acb7ce363": "1f8b08000000000000fff2750c72775508cecc2d28cecfe302040000fffffb1d273b0e000000", + "5cfc8f95f98237a10affc14a76e3e20b": "1f8b08000000000000fff2757477f7745508cecc2d28cecfe302040000ffffb09167470f000000", + "6d8be986fa35821e7e869fbb118e51ba": "1f8b08000000000000fff2f0f7750d5208cecc2d28cecfe302040000fffffb2ef0a60e000000", + "99e5497ae5f5988fafafbcd15ed74d22": "1f8b08000000000000fff2f10c765408cecc2d28cecfe302040000ffffab9bc93e0d000000", + "bb006aa6261a80f6c52c640f713659c1": "1f8b08000000000000ff72720c0a5108cecc2d28cecfe302040000ffff89742ac20d000000", + }) + if err != nil { + return err + } + g.DefaultResolver = hgr + func() { + b := packr.New("simpsons", "") + b.SetResolver("kids/bart.txt", packr.Pointer{ForwardBox: gk, ForwardPath: "bb006aa6261a80f6c52c640f713659c1"}) + b.SetResolver("kids/lisa.txt", packr.Pointer{ForwardBox: gk, ForwardPath: "99e5497ae5f5988fafafbcd15ed74d22"}) + b.SetResolver("kids/maggie.txt", packr.Pointer{ForwardBox: gk, ForwardPath: "5cfc8f95f98237a10affc14a76e3e20b"}) + b.SetResolver("parents/homer.txt", packr.Pointer{ForwardBox: gk, ForwardPath: "6d8be986fa35821e7e869fbb118e51ba"}) + b.SetResolver("parents/marge.txt", packr.Pointer{ForwardBox: gk, ForwardPath: "4abf3a9b652ecec6b347eb6acb7ce363"}) + }() + return nil +}() diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/disk_test.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/disk_test.go new file mode 100644 index 000000000..2dd66b3ab --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/disk_test.go @@ -0,0 +1,142 @@ +package store + +import ( + "path/filepath" + "strings" + "testing" + + "github.com/gobuffalo/genny/gentest" + "github.com/gobuffalo/genny/movinglater/gotools/gomods" + "github.com/gobuffalo/packr/v2" + "github.com/gobuffalo/packr/v2/jam/parser" + "github.com/markbates/oncer" + "github.com/stretchr/testify/require" +) + +func init() { + parser.DefaultIgnoredFolders = []string{"vendor", ".git", "node_modules", ".idea"} +} + +func Test_Disk_Generator(t *testing.T) { + gomods.Disable(func() error { + + r := require.New(t) + + p, err := parser.NewFromRoots([]string{"./_fixtures/disk-pack"}, &parser.RootsOptions{ + IgnoreImports: true, + }) + r.NoError(err) + + boxes, err := p.Run() + r.NoError(err) + + d := NewDisk(".", "") + for _, b := range boxes { + r.NoError(d.Pack(b)) + } + + run := gentest.NewRunner() + run.WithNew(d.Generator()) + r.NoError(run.Run()) + + res := run.Results() + r.Len(res.Files, 3) + + f := res.Files[0] + r.Equal("a-packr.go", filepath.Base(f.Name())) + r.Contains(f.String(), `import _ "github.com/gobuffalo/packr/v2/jam/packrd"`) + return nil + }) +} + +func Test_Disk_FileNames(t *testing.T) { + r := require.New(t) + + d := &Disk{} + + box := parser.NewBox("Test_Disk_FileNames", "./_fixtures/disk/franklin") + names, err := d.FileNames(box) + r.NoError(err) + r.Len(names, 2) + + r.Equal("aretha.txt", filepath.Base(names[0])) + r.Equal("think.txt", filepath.Base(names[1])) +} + +func Test_Disk_Files(t *testing.T) { + r := require.New(t) + + d := &Disk{} + + box := parser.NewBox("Test_Disk_Files", "./_fixtures/disk/franklin") + files, err := d.Files(box) + r.NoError(err) + r.Len(files, 2) + + f := files[0] + r.Equal("aretha.txt", filepath.Base(f.Name())) + r.Equal("RESPECT!", strings.TrimSpace(f.String())) + + f = files[1] + r.Equal("think.txt", filepath.Base(f.Name())) + r.Equal("THINK!", strings.TrimSpace(f.String())) +} + +func Test_Disk_Pack(t *testing.T) { + oncer.Reset() + r := require.New(t) + + d := NewDisk("", "") + + p, err := parser.NewFromRoots([]string{"./_fixtures/disk-pack"}, &parser.RootsOptions{ + IgnoreImports: true, + }) + r.NoError(err) + boxes, err := p.Run() + r.NoError(err) + + for _, b := range boxes { + r.NoError(d.Pack(b)) + } + + global := d.global + r.Len(global, 3) + + r.Len(d.boxes, 3) + +} + +func Test_Disk_Packed_Test(t *testing.T) { + r := require.New(t) + + b := packr.NewBox("simpsons") + + s, err := b.FindString("parents/homer.txt") + r.NoError(err) + r.Equal("HOMER Simpson", strings.TrimSpace(s)) + + s, err = b.FindString("parents/marge.txt") + r.NoError(err) + r.Equal("MARGE Simpson", strings.TrimSpace(s)) + + _, err = b.FindString("idontexist") + r.Error(err) +} + +func Test_Disk_Close(t *testing.T) { + gomods.Disable(func() error { + r := require.New(t) + + p, err := parser.NewFromRoots([]string{"./_fixtures/disk-pack"}, nil) + r.NoError(err) + boxes, err := p.Run() + r.NoError(err) + + d := NewDisk("./_fixtures/disk-pack", "") + for _, b := range boxes { + r.NoError(d.Pack(b)) + } + r.NoError(d.Close()) + return nil + }) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/disk_tmpl.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/disk_tmpl.go new file mode 100644 index 000000000..bc29d4865 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/disk_tmpl.go @@ -0,0 +1,50 @@ +package store + +const diskGlobalTmpl = `// Code generated by github.com/gobuffalo/packr/v2. DO NOT EDIT. + +// You can use the "packr2 clean" command to clean up this, +// and any other packr generated files. +package {{.Package}} + +import ( + "github.com/gobuffalo/packr/v2" + "github.com/gobuffalo/packr/v2/file/resolver" +) + +var _ = func() error { + const gk = "{{.GK}}" + g := packr.New(gk, "") + hgr, err := resolver.NewHexGzip(map[string]string{ + {{- range $k, $v := .GlobalFiles }} + "{{$k}}": "{{$v}}", + {{- end }} + }) + if err != nil { + panic(err) + } + g.DefaultResolver = hgr + + {{- range $box := .Boxes}} +{{ printBox $box -}} + {{ end }} + return nil +}() +` + +const diskImportTmpl = `// Code generated by github.com/gobuffalo/packr/v2. DO NOT EDIT. + +// You can use the "packr clean" command to clean up this, +// and any other packr generated files. +package {{.Package}} + +import _ "{{.Import}}" +` + +const diskGlobalBoxTmpl = ` + func() { + b := packr.New("{{.Box.Name}}", "{{.Box.Path}}") + {{ range $file := .Files -}} + b.SetResolver("{{$file.Resolver}}", packr.Pointer{ForwardBox: gk, ForwardPath: "{{$file.ForwardPath}}"}) + {{ end -}} + }() +` diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/env.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/env.go new file mode 100644 index 000000000..9a65e6dfa --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/env.go @@ -0,0 +1,39 @@ +package store + +import ( + "os" + "os/exec" + "path/filepath" + "strings" + "sync" +) + +var goPath = filepath.Join(os.Getenv("HOME"), "go") + +func init() { + var once sync.Once + once.Do(func() { + cmd := exec.Command("go", "env", "GOPATH") + b, err := cmd.CombinedOutput() + if err != nil { + return + } + goPath = strings.TrimSpace(string(b)) + }) +} + +// GoPath returns the current GOPATH env var +// or if it's missing, the default. +func GoPath() string { + return goPath +} + +// GoBin returns the current GO_BIN env var +// or if it's missing, a default of "go" +func GoBin() string { + go_bin := os.Getenv("GO_BIN") + if go_bin == "" { + return "go" + } + return go_bin +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/fn.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/fn.go new file mode 100644 index 000000000..e71aaac82 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/fn.go @@ -0,0 +1,44 @@ +package store + +import ( + "errors" + + "github.com/gobuffalo/packr/v2/jam/parser" +) + +var _ Store = &FnStore{} + +type FnStore struct { + FileNamesFn func(*parser.Box) ([]string, error) + FilesFn func(*parser.Box) ([]*parser.File, error) + PackFn func(*parser.Box) error + CleanFn func(*parser.Box) error +} + +func (f *FnStore) FileNames(box *parser.Box) ([]string, error) { + if f.FileNamesFn == nil { + return []string{}, errors.New("FileNames not implemented") + } + return f.FileNames(box) +} + +func (f *FnStore) Files(box *parser.Box) ([]*parser.File, error) { + if f.FilesFn == nil { + return []*parser.File{}, errors.New("Files not implemented") + } + return f.FilesFn(box) +} + +func (f *FnStore) Pack(box *parser.Box) error { + if f.PackFn == nil { + return errors.New("Pack not implemented") + } + return f.PackFn(box) +} + +func (f *FnStore) Clean(box *parser.Box) error { + if f.CleanFn == nil { + return errors.New("Clean not implemented") + } + return f.Clean(box) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/legacy.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/legacy.go new file mode 100644 index 000000000..c1ee411a1 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/legacy.go @@ -0,0 +1,140 @@ +package store + +import ( + "bytes" + "context" + "encoding/json" + "io" + "path/filepath" + "sort" + "strings" + + "github.com/pkg/errors" + + "github.com/gobuffalo/genny" + "github.com/gobuffalo/genny/movinglater/gotools" + "github.com/gobuffalo/packr/v2/jam/parser" + "github.com/gobuffalo/packr/v2/plog" +) + +var _ Store = &Legacy{} + +type Legacy struct { + *Disk + boxes map[string][]legacyBox +} + +func NewLegacy() *Legacy { + return &Legacy{ + Disk: NewDisk("", ""), + boxes: map[string][]legacyBox{}, + } +} + +func (l *Legacy) Pack(box *parser.Box) error { + files, err := l.Files(box) + if err != nil { + return errors.WithStack(err) + } + + var fcs []legacyFile + + for _, f := range files { + n := strings.TrimPrefix(f.Name(), box.AbsPath+string(filepath.Separator)) + c, err := l.prepFile(f) + if err != nil { + return errors.WithStack(err) + } + fcs = append(fcs, legacyFile{Name: n, Contents: c}) + } + + sort.Slice(fcs, func(a, b int) bool { + return fcs[a].Name < fcs[b].Name + }) + + lbs := l.boxes[box.PackageDir] + lbs = append(lbs, legacyBox{ + Box: box, + Files: fcs, + }) + l.boxes[box.PackageDir] = lbs + return nil + + // run := genny.WetRunner(context.Background()) + // if err := run.WithNew(l.Generator(box)); err != nil { + // return errors.WithStack(err) + // } + // run.Logger = plog.Logger + // return run.Run() +} + +func (l *Legacy) prepFile(r io.Reader) (string, error) { + bb := &bytes.Buffer{} + if _, err := io.Copy(bb, r); err != nil { + return "", errors.WithStack(err) + } + b, err := json.Marshal(bb.Bytes()) + if err != nil { + return "", errors.WithStack(err) + } + return strings.Replace(string(b), "\"", "\\\"", -1), nil +} + +func (l *Legacy) Generator() (*genny.Generator, error) { + g := genny.New() + for _, b := range l.boxes { + if len(b) == 0 { + continue + } + bx := b[0].Box + pkg := bx.Package + opts := map[string]interface{}{ + "Package": pkg, + "Boxes": b, + } + f := genny.NewFile(filepath.Join(bx.PackageDir, "a_"+bx.Package+"-packr.go.tmpl"), strings.NewReader(legacyTmpl)) + t := gotools.TemplateTransformer(opts, nil) + f, err := t.Transform(f) + if err != nil { + return g, errors.WithStack(err) + } + g.File(f) + } + return g, nil +} + +func (l *Legacy) Close() error { + run := genny.WetRunner(context.Background()) + if err := run.WithNew(l.Generator()); err != nil { + return errors.WithStack(err) + } + run.Logger = plog.Logger + return run.Run() +} + +type legacyBox struct { + Box *parser.Box + Files []legacyFile +} + +type legacyFile struct { + Name string + Contents string +} + +var legacyTmpl = `// Code generated by github.com/gobuffalo/packr. DO NOT EDIT. + +package {{.Package}} + +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 $box.Files }} + packr.PackJSONBytes("{{$box.Box.Name}}", "{{.Name}}", "{{.Contents}}") + {{- end }} + {{- end }} +} +` diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/legacy_test.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/legacy_test.go new file mode 100644 index 000000000..c864ed5ea --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/legacy_test.go @@ -0,0 +1,67 @@ +package store + +import ( + "path/filepath" + "testing" + + "github.com/gobuffalo/genny/gentest" + "github.com/gobuffalo/packr/v2/jam/parser" + "github.com/markbates/oncer" + "github.com/stretchr/testify/require" +) + +func Test_Legacy_Pack(t *testing.T) { + r := require.New(t) + + d := NewLegacy() + + p, err := parser.NewFromRoots([]string{"./_fixtures/disk"}, &parser.RootsOptions{ + IgnoreImports: true, + }) + r.NoError(err) + boxes, err := p.Run() + r.NoError(err) + + for _, b := range boxes { + r.NoError(d.Pack(b)) + } + + db := d.boxes + r.Len(db, 2) + for k, v := range db { + switch filepath.Base(k) { + case "disk": + r.Len(v, 1) + case "e": + r.Len(v, 2) + default: + r.Fail(k) + } + } +} + +func Test_Legacy_Close(t *testing.T) { + oncer.Reset() + r := require.New(t) + + d := NewLegacy() + + p, err := parser.NewFromRoots([]string{"./_fixtures/disk"}, &parser.RootsOptions{ + IgnoreImports: true, + }) + r.NoError(err) + boxes, err := p.Run() + r.NoError(err) + + for _, b := range boxes { + r.NoError(d.Pack(b)) + } + r.Len(d.boxes, 2) + + run := gentest.NewRunner() + r.NoError(run.WithNew(d.Generator())) + r.NoError(run.Run()) + + res := run.Results() + r.Len(res.Files, 2) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/store.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/store.go new file mode 100644 index 000000000..35c0781fc --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/store.go @@ -0,0 +1,12 @@ +package store + +import ( + "github.com/gobuffalo/packr/v2/jam/parser" +) + +type Store interface { + FileNames(*parser.Box) ([]string, error) + Files(*parser.Box) ([]*parser.File, error) + Pack(*parser.Box) error + Clean(*parser.Box) error +} diff --git a/vendor/github.com/gobuffalo/packr/v2/jam/store/store_test.go b/vendor/github.com/gobuffalo/packr/v2/jam/store/store_test.go new file mode 100644 index 000000000..72440ea2a --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/jam/store/store_test.go @@ -0,0 +1 @@ +package store diff --git a/vendor/github.com/gobuffalo/packr/v2/packr.go b/vendor/github.com/gobuffalo/packr/v2/packr.go new file mode 100644 index 000000000..fc43f9d37 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr.go @@ -0,0 +1,55 @@ +package packr + +import ( + "github.com/gobuffalo/packr/v2/file/resolver" + "github.com/gobuffalo/packr/v2/jam/parser" + "github.com/gobuffalo/packr/v2/plog" + "github.com/markbates/safe" + "github.com/pkg/errors" +) + +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, errors.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/vendor/github.com/gobuffalo/packr/v2/packr2/LICENSE b/vendor/github.com/gobuffalo/packr/v2/packr2/LICENSE new file mode 100644 index 000000000..aab0dd47a --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright © 2018 Mark Bates + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/build.go b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/build.go new file mode 100644 index 000000000..f1d45affa --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/build.go @@ -0,0 +1,30 @@ +package cmd + +import ( + "github.com/pkg/errors" + "github.com/spf13/cobra" +) + +var buildCmd = &cobra.Command{ + Use: "build", + Short: "Wraps the go build command with packr", + DisableFlagParsing: true, + RunE: func(cmd *cobra.Command, args []string) error { + var cargs []string + for _, a := range args { + if a == "--legacy" { + globalOptions.Legacy = true + continue + } + cargs = append(cargs, a) + } + if err := pack(); err != nil { + return errors.WithStack(err) + } + return goCmd("build", cargs...) + }, +} + +func init() { + rootCmd.AddCommand(buildCmd) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/clean.go b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/clean.go new file mode 100644 index 000000000..40320555c --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/clean.go @@ -0,0 +1,35 @@ +package cmd + +import ( + "os" + + "github.com/gobuffalo/packr/v2/jam/store" + "github.com/pkg/errors" + "github.com/spf13/cobra" +) + +var cleanCmd = &cobra.Command{ + Use: "clean", + Short: "removes any *-packr.go files", + RunE: func(cmd *cobra.Command, args []string) error { + return clean(args...) + }, +} + +func clean(args ...string) error { + pwd, err := os.Getwd() + if err != nil { + return errors.WithStack(err) + } + args = append(args, pwd) + for _, root := range args { + if err := store.Clean(root); err != nil { + return errors.WithStack(err) + } + } + return nil +} + +func init() { + rootCmd.AddCommand(cleanCmd) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix.go b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix.go new file mode 100644 index 000000000..8496900f1 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "fmt" + + packr "github.com/gobuffalo/packr/v2" + "github.com/gobuffalo/packr/v2/packr2/cmd/fix" + "github.com/spf13/cobra" +) + +// fixCmd represents the info command +var fixCmd = &cobra.Command{ + Use: "fix", + Short: fmt.Sprintf("will attempt to fix a application's API to match packr version %s", packr.Version), + RunE: func(cmd *cobra.Command, args []string) error { + return fix.Run() + }, +} + +func init() { + fixCmd.Flags().BoolVarP(&fix.YesToAll, "y", "", false, "update all without asking for confirmation") + rootCmd.AddCommand(fixCmd) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix/fix.go b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix/fix.go new file mode 100644 index 000000000..f77931154 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix/fix.go @@ -0,0 +1,53 @@ +package fix + +import ( + "bufio" + "fmt" + "os" + "strings" + + "github.com/gobuffalo/envy" + "github.com/gobuffalo/packr/v2/jam/store" + "github.com/pkg/errors" +) + +var modsOn = (strings.TrimSpace(envy.Get("GO111MODULE", "off")) == "on") + +//YesToAll will be used by the command to skip the questions +var YesToAll bool + +var replace = map[string]string{ + "github.com/gobuffalo/packr": "github.com/gobuffalo/packr/v2", +} + +var ic = ImportConverter{ + Data: replace, +} + +var checks = []Check{ + // packrClean, + ic.Process, +} + +func packrClean(r *Runner) error { + pwd, err := os.Getwd() + if err != nil { + return errors.WithStack(err) + } + store.Clean(pwd) + return nil +} + +func ask(q string) bool { + if YesToAll { + return true + } + + fmt.Printf("? %s [y/n]\n", q) + + reader := bufio.NewReader(os.Stdin) + text, _ := reader.ReadString('\n') + + text = strings.ToLower(strings.TrimSpace(text)) + return text == "y" || text == "yes" +} diff --git a/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix/imports.go b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix/imports.go new file mode 100644 index 000000000..cc0479b26 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix/imports.go @@ -0,0 +1,252 @@ +package fix + +import ( + "bytes" + "fmt" + "go/ast" + "go/parser" + "go/printer" + "go/token" + "io/ioutil" + "os" + "path/filepath" + "strconv" + "strings" + + "github.com/pkg/errors" + "golang.org/x/tools/go/ast/astutil" +) + +// ImportConverter will changes imports from a -> b +type ImportConverter struct { + Data map[string]string +} + +// Process will walk all the .go files in an application, excluding ./vendor. +// It will then attempt to convert any old import paths to any new import paths +// used by this version Buffalo. +func (c ImportConverter) Process(r *Runner) error { + fmt.Println("~~~ Rewriting Imports ~~~") + + err := filepath.Walk(".", c.processFile) + if err != nil { + return errors.WithStack(err) + } + + if _, err := os.Stat("Gopkg.toml"); err != nil { + return nil + } + + b, err := ioutil.ReadFile("Gopkg.toml") + if err != nil { + return errors.WithStack(err) + } + + for k := range c.Data { + if bytes.Contains(b, []byte(k)) { + r.Warnings = append(r.Warnings, fmt.Sprintf("Your Gopkg.toml contains the following import that need to be changed MANUALLY: %s", k)) + } + } + + return nil +} + +func (c ImportConverter) processFile(p string, info os.FileInfo, err error) error { + er := onlyRelevantFiles(p, info, err, func(p string) error { + err := c.rewriteFile(p) + if err != nil { + err = errors.WithStack(err) + } + + return err + }) + + return er +} + +func (c ImportConverter) rewriteFile(name string) error { + // create an empty fileset. + fset := token.NewFileSet() + + // parse the .go file. + // we are parsing the entire file with comments, so we don't lose anything + // if we need to write it back out. + f, err := parser.ParseFile(fset, name, nil, parser.ParseComments) + if err != nil { + e := err.Error() + msg := "expected 'package', found 'EOF'" + if e[len(e)-len(msg):] == msg { + return nil + } + return err + } + + changed := false + funcs := []*ast.FuncDecl{} + for _, d := range f.Decls { + if fn, isFn := d.(*ast.FuncDecl); isFn { + funcs = append(funcs, fn) + } + } + + for _, fun := range funcs { + ast.Inspect(fun, func(node ast.Node) bool { + switch n := node.(type) { + case *ast.CallExpr: + fn, ok := n.Fun.(*ast.SelectorExpr) + if !ok || fn.Sel == nil { + return true + } + + sel := fn.Sel + i, ok := fn.X.(*ast.Ident) + if !ok { + return true + } + if i.Name != "packr" { + return true + } + if sel.Name == "NewBox" { + sel.Name = "New" + n.Args = append(n.Args, n.Args[0]) + changed = true + } + if sel.Name == "MustBytes" { + sel.Name = "Find" + changed = true + } + if sel.Name == "MustBytes" { + sel.Name = "Find" + changed = true + } + } + return true + }) + } + + for key, value := range c.Data { + if !astutil.DeleteImport(fset, f, key) { + continue + } + + astutil.AddImport(fset, f, value) + changed = true + } + + commentsChanged, err := c.handleFileComments(f) + if err != nil { + return err + } + + changed = changed || commentsChanged + + // if no change occurred, then we don't need to write to disk, just return. + if !changed { + return nil + } + + // since the imports changed, resort them. + ast.SortImports(fset, f) + + // create a temporary file, this easily avoids conflicts. + temp, err := writeTempResult(name, fset, f) + if err != nil { + return err + } + + // rename the .temp to .go + return os.Rename(temp, name) +} + +func (c ImportConverter) handleFileComments(f *ast.File) (bool, error) { + change := false + + for _, cg := range f.Comments { + for _, cl := range cg.List { + if !strings.HasPrefix(cl.Text, "// import \"") { + continue + } + + // trim off extra comment stuff + ctext := cl.Text + ctext = strings.TrimPrefix(ctext, "// import") + ctext = strings.TrimSpace(ctext) + + // unquote the comment import path value + ctext, err := strconv.Unquote(ctext) + if err != nil { + return false, err + } + + // match the comment import path with the given replacement map + if ctext, ok := c.match(ctext); ok { + cl.Text = "// import " + strconv.Quote(ctext) + change = true + } + + } + } + + return change, nil +} + +// match takes an import path and replacement map. +func (c ImportConverter) match(importpath string) (string, bool) { + for key, value := range c.Data { + if !strings.HasPrefix(importpath, key) { + continue + } + + result := strings.Replace(importpath, key, value, 1) + return result, true + } + + return importpath, false +} + +//onlyRelevantFiles processes only .go files excluding folders like node_modules and vendor. +func onlyRelevantFiles(p string, fi os.FileInfo, err error, fn func(p string) error) error { + if err != nil { + return err + } + + if fi.IsDir() && p != "." { + for _, n := range []string{"_", ".", "vendor", "node_modules", ".git"} { + base := filepath.Base(p) + if strings.HasPrefix(base, n) { + return filepath.SkipDir + } + } + + return nil + } + + ext := filepath.Ext(p) + if ext != ".go" { + return nil + } + + return fn(p) +} + +func writeTempResult(name string, fset *token.FileSet, f *ast.File) (string, error) { + temp := name + ".temp" + w, err := os.Create(temp) + if err != nil { + return "", err + } + + // write changes to .temp file, and include proper formatting. + err = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(w, fset, f) + if err != nil { + return "", err + } + + // close the writer + err = w.Close() + if err != nil { + return "", err + } + + return temp, nil +} diff --git a/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix/runner.go b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix/runner.go new file mode 100644 index 000000000..f0105da74 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/fix/runner.go @@ -0,0 +1,48 @@ +package fix + +import ( + "fmt" + + packr "github.com/gobuffalo/packr/v2" + "github.com/pkg/errors" +) + +// Check interface for runnable checker functions +type Check func(*Runner) error + +// Runner will run all compatible checks +type Runner struct { + Warnings []string +} + +// Run all compatible checks +func Run() error { + fmt.Printf("! This updater will attempt to update your application to packr version: %s\n", packr.Version) + if !ask("Do you wish to continue?") { + fmt.Println("~~~ cancelling update ~~~") + return nil + } + + r := &Runner{ + Warnings: []string{}, + } + + defer func() { + if len(r.Warnings) == 0 { + return + } + + fmt.Println("\n\n----------------------------") + fmt.Printf("!!! (%d) Warnings Were Found !!!\n\n", len(r.Warnings)) + for _, w := range r.Warnings { + fmt.Printf("[WARNING]: %s\n", w) + } + }() + + for _, c := range checks { + if err := c(r); err != nil { + return errors.WithStack(err) + } + } + return nil +} diff --git a/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/gocmd.go b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/gocmd.go new file mode 100644 index 000000000..dc50fd428 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/gocmd.go @@ -0,0 +1,64 @@ +package cmd + +import ( + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "strings" + + "github.com/gobuffalo/genny" + "github.com/gobuffalo/packr/v2/plog" + "github.com/pkg/errors" +) + +func goCmd(name string, args ...string) error { + cargs := []string{name} + cargs = append(cargs, args...) + if len(args) > 0 { + err := func() error { + path := "." + + pwd, err := os.Getwd() + if err != nil { + return errors.WithStack(err) + } + + if fi, err := os.Stat(filepath.Join(pwd, args[len(args)-1])); err == nil { + if fi.IsDir() { + return nil + } + path = fi.Name() + } + + if filepath.Ext(path) != ".go" { + return nil + } + + path, err = filepath.Abs(filepath.Dir(path)) + if err != nil { + return errors.WithStack(err) + } + + files, err := ioutil.ReadDir(path) + if err != nil { + return errors.WithStack(err) + } + for _, f := range files { + if strings.HasSuffix(f.Name(), "-packr.go") { + cargs = append(cargs, f.Name()) + } + } + return nil + }() + if err != nil { + return errors.WithStack(err) + } + } + cp := exec.Command(genny.GoBin(), cargs...) + plog.Logger.Debug(strings.Join(cp.Args, " ")) + cp.Stderr = os.Stderr + cp.Stdin = os.Stdin + cp.Stdout = os.Stdout + return cp.Run() +} diff --git a/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/install.go b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/install.go new file mode 100644 index 000000000..b1acecff5 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/install.go @@ -0,0 +1,30 @@ +package cmd + +import ( + "github.com/pkg/errors" + "github.com/spf13/cobra" +) + +var installCmd = &cobra.Command{ + Use: "install", + Short: "Wraps the go install command with packr", + DisableFlagParsing: true, + RunE: func(cmd *cobra.Command, args []string) error { + var cargs []string + for _, a := range args { + if a == "--legacy" { + globalOptions.Legacy = true + continue + } + cargs = append(cargs, a) + } + if err := pack(); err != nil { + return errors.WithStack(err) + } + return goCmd("install", cargs...) + }, +} + +func init() { + rootCmd.AddCommand(installCmd) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/pack.go b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/pack.go new file mode 100644 index 000000000..3c3ed7634 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/pack.go @@ -0,0 +1,80 @@ +package cmd + +import ( + "context" + "encoding/json" + "io" + "os" + "os/exec" + "time" + + "github.com/gobuffalo/packr/v2/jam/parser" + "github.com/gobuffalo/packr/v2/jam/store" + "github.com/gobuffalo/packr/v2/plog" + "github.com/pkg/errors" +) + +func pack(args ...string) error { + if err := clean(args...); err != nil { + return errors.WithStack(err) + } + pwd, err := os.Getwd() + if err != nil { + return errors.WithStack(err) + } + + roots := append(args, pwd) + p, err := parser.NewFromRoots(roots, &parser.RootsOptions{ + IgnoreImports: globalOptions.IgnoreImports, + }) + if err != nil { + return errors.WithStack(err) + } + boxes, err := p.Run() + if err != nil { + return errors.WithStack(err) + } + + // reduce boxes - remove ones we don't want + // MB: current assumption is we want all these + // boxes, just adding a comment suggesting they're + // might be a reason to exclude some + + plog.Logger.Debugf("found %d boxes", len(boxes)) + + if len(globalOptions.StoreCmd) != 0 { + return shellPack(boxes) + } + + var st store.Store = store.NewDisk("", "") + + if globalOptions.Legacy { + st = store.NewLegacy() + } + + for _, b := range boxes { + if b.Name == store.DISK_GLOBAL_KEY { + continue + } + if err := st.Pack(b); err != nil { + return errors.WithStack(err) + } + } + if cl, ok := st.(io.Closer); ok { + return cl.Close() + } + return nil +} + +func shellPack(boxes parser.Boxes) error { + b, err := json.Marshal(boxes) + if err != nil { + return errors.WithStack(err) + } + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + c := exec.CommandContext(ctx, globalOptions.StoreCmd, string(b)) + c.Stdout = os.Stdout + c.Stderr = os.Stderr + return c.Run() +} diff --git a/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/root.go b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/root.go new file mode 100644 index 000000000..77e16f919 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/root.go @@ -0,0 +1,63 @@ +package cmd + +import ( + "os" + + "github.com/gobuffalo/genny" + "github.com/gobuffalo/logger" + "github.com/gobuffalo/packr/v2/plog" + "github.com/spf13/cobra" +) + +var globalOptions = struct { + Verbose bool + IgnoreImports bool + Legacy bool + Silent bool + StoreCmd string +}{} + +var rootCmd = &cobra.Command{ + Use: "packr2", + Short: "Packr is a simple solution for bundling static assets inside of Go binaries.", + PersistentPreRun: func(cmd *cobra.Command, args []string) { + genny.DefaultLogLvl = logger.ErrorLevel + for _, a := range args { + if a == "--legacy" { + globalOptions.Legacy = true + continue + } + if a == "-v" || a == "--verbose" { + globalOptions.Verbose = true + continue + } + } + if globalOptions.Verbose { + genny.DefaultLogLvl = logger.DebugLevel + plog.Logger = logger.New(logger.DebugLevel) + } + if globalOptions.Silent { + genny.DefaultLogLvl = logger.FatalLevel + plog.Logger = logger.New(logger.FatalLevel) + } + }, + RunE: func(cmd *cobra.Command, args []string) error { + return pack(args...) + }, +} + +// Execute adds all child commands to the root command and sets flags appropriately. +// This is called by main.main(). It only needs to happen once to the rootCmd. +func Execute() { + if err := rootCmd.Execute(); err != nil { + os.Exit(1) + } +} + +func init() { + rootCmd.PersistentFlags().BoolVarP(&globalOptions.Verbose, "verbose", "v", false, "enables verbose logging") + rootCmd.PersistentFlags().BoolVar(&globalOptions.Legacy, "legacy", false, "uses the legacy resolution and packing system (assumes first arg || pwd for input path)") + rootCmd.PersistentFlags().BoolVar(&globalOptions.Silent, "silent", false, "silences all output") + rootCmd.PersistentFlags().BoolVar(&globalOptions.IgnoreImports, "ignore-imports", false, "when set to true packr won't resolve imports for boxes") + rootCmd.PersistentFlags().StringVar(&globalOptions.StoreCmd, "store-cmd", "", "sub command to use for packing") +} diff --git a/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/version.go b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/version.go new file mode 100644 index 000000000..6cb14b750 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/cmd/version.go @@ -0,0 +1,21 @@ +package cmd + +import ( + "fmt" + + packr "github.com/gobuffalo/packr/v2" + "github.com/spf13/cobra" +) + +var versionCmd = &cobra.Command{ + Use: "version", + Short: "shows packr version", + RunE: func(cmd *cobra.Command, args []string) error { + fmt.Print(packr.Version) + return nil + }, +} + +func init() { + rootCmd.AddCommand(versionCmd) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/packr2/main.go b/vendor/github.com/gobuffalo/packr/v2/packr2/main.go new file mode 100644 index 000000000..efb252840 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr2/main.go @@ -0,0 +1,7 @@ +package main + +import "github.com/gobuffalo/packr/v2/packr2/cmd" + +func main() { + cmd.Execute() +} diff --git a/vendor/github.com/gobuffalo/packr/v2/packr_test.go b/vendor/github.com/gobuffalo/packr/v2/packr_test.go new file mode 100644 index 000000000..adc6b33ee --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/packr_test.go @@ -0,0 +1,11 @@ +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/vendor/github.com/gobuffalo/packr/v2/plog/plog.go b/vendor/github.com/gobuffalo/packr/v2/plog/plog.go new file mode 100644 index 000000000..8b1eec109 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/plog/plog.go @@ -0,0 +1,41 @@ +package plog + +import ( + "encoding/json" + "fmt" + + "github.com/gobuffalo/logger" + "github.com/sirupsen/logrus" +) + +var Logger = logger.New(logger.ErrorLevel) + +func Debug(t interface{}, m string, args ...interface{}) { + if len(args)%2 == 1 { + args = append(args, "") + } + f := logrus.Fields{} + for i := 0; i < len(args); i += 2 { + k := fmt.Sprint(args[i]) + v := args[i+1] + if s, ok := v.(fmt.Stringer); ok { + f[k] = s.String() + continue + } + if s, ok := v.(string); ok { + f[k] = s + continue + } + if b, err := json.Marshal(v); err == nil { + f[k] = string(b) + continue + } + f[k] = v + } + e := Logger.WithFields(f) + if s, ok := t.(string); ok { + e.Debugf("%s#%s", s, m) + return + } + e.Debugf("%T#%s", t, m) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/pointer.go b/vendor/github.com/gobuffalo/packr/v2/pointer.go new file mode 100644 index 000000000..70e91c99e --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/pointer.go @@ -0,0 +1,29 @@ +package packr + +import ( + "github.com/gobuffalo/packr/v2/file" + "github.com/gobuffalo/packr/v2/file/resolver" + "github.com/gobuffalo/packr/v2/plog" + "github.com/pkg/errors" +) + +type Pointer struct { + ForwardBox string + ForwardPath string +} + +var _ resolver.Resolver = Pointer{} + +func (p Pointer) Resolve(box string, path string) (file.File, error) { + plog.Debug(p, "Resolve", "box", box, "path", path, "forward-box", p.ForwardBox, "forward-path", p.ForwardPath) + b, err := findBox(p.ForwardBox) + if err != nil { + return nil, errors.WithStack(err) + } + f, err := b.Resolve(p.ForwardPath) + if err != nil { + return f, errors.WithStack(errors.Wrap(err, path)) + } + plog.Debug(p, "Resolve", "box", box, "path", path, "file", f) + return f, nil +} diff --git a/vendor/github.com/gobuffalo/packr/v2/pointer_test.go b/vendor/github.com/gobuffalo/packr/v2/pointer_test.go new file mode 100644 index 000000000..fba9e9dfe --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/pointer_test.go @@ -0,0 +1,24 @@ +package packr + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_Pointer_Find(t *testing.T) { + r := require.New(t) + + b1 := New("b1", "") + r.NoError(b1.AddString("foo.txt", "FOO!")) + + b2 := New("b2", "") + b2.SetResolver("bar.txt", &Pointer{ + ForwardBox: "b1", + ForwardPath: "foo.txt", + }) + + s, err := b2.FindString("bar.txt") + r.NoError(err) + r.Equal("FOO!", s) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/travis.sh b/vendor/github.com/gobuffalo/packr/v2/travis.sh new file mode 100755 index 000000000..ad511a26f --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/travis.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +go get -t ./... +go install -v ./packr2 +packr2 -v clean +packr2 -v +go test -v -timeout=5s -race ./... diff --git a/vendor/github.com/gobuffalo/packr/v2/version.go b/vendor/github.com/gobuffalo/packr/v2/version.go new file mode 100644 index 000000000..3952f10d5 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/version.go @@ -0,0 +1,3 @@ +package packr + +const Version = "v2.0.0-rc.13" diff --git a/vendor/github.com/gobuffalo/packr/v2/walk.go b/vendor/github.com/gobuffalo/packr/v2/walk.go new file mode 100644 index 000000000..88dcf0f62 --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/walk.go @@ -0,0 +1,77 @@ +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" + "github.com/pkg/errors" +) + +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: string(cd)} + } + if fm, ok := dr.(file.FileMappable); ok { + for n, f := range fm.FileMap() { + m[n] = f + } + } + + b.moot.RLock() + for n, r := range b.resolvers { + f, err := r.Resolve("", n) + if err != nil { + return errors.WithStack(err) + } + keep := true + for k := range m { + if strings.ToLower(k) == strings.ToLower(n) { + keep = false + } + } + if keep { + m[n] = f + } + } + b.moot.RUnlock() + + 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 errors.WithStack(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 errors.WithStack(err) + } + } + return nil + }) +} diff --git a/vendor/github.com/gobuffalo/packr/v2/walk_test.go b/vendor/github.com/gobuffalo/packr/v2/walk_test.go new file mode 100644 index 000000000..f9bb25afc --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/v2/walk_test.go @@ -0,0 +1,39 @@ +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/vendor/github.com/gobuffalo/packr/version.go b/vendor/github.com/gobuffalo/packr/version.go new file mode 100644 index 000000000..b26b0908b --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/version.go @@ -0,0 +1,3 @@ +package packr + +const Version = "v1.21.9" diff --git a/vendor/github.com/gobuffalo/packr/virtual_file.go b/vendor/github.com/gobuffalo/packr/virtual_file.go deleted file mode 100644 index 955db8c79..000000000 --- a/vendor/github.com/gobuffalo/packr/virtual_file.go +++ /dev/null @@ -1,57 +0,0 @@ -package packr - -import ( - "bytes" - "fmt" - "os" - "time" -) - -var virtualFileModTime = time.Now() -var _ File = virtualFile{} - -type virtualFile struct { - *bytes.Reader - Name string - info fileInfo -} - -func (f virtualFile) FileInfo() (os.FileInfo, error) { - return f.info, nil -} - -func (f virtualFile) Close() error { - return nil -} - -func (f virtualFile) Write(p []byte) (n int, err error) { - return 0, fmt.Errorf("not implemented") -} - -func (f virtualFile) Readdir(count int) ([]os.FileInfo, error) { - return []os.FileInfo{f.info}, nil -} - -func (f virtualFile) Stat() (os.FileInfo, error) { - return f.info, nil -} - -func newVirtualFile(name string, b []byte) File { - return virtualFile{ - Reader: bytes.NewReader(b), - Name: name, - info: fileInfo{ - Path: name, - Contents: b, - size: int64(len(b)), - modTime: virtualFileModTime, - }, - } -} - -func newVirtualDir(name string) File { - var b []byte - v := newVirtualFile(name, b).(virtualFile) - v.info.isDir = true - return v -} diff --git a/vendor/github.com/gobuffalo/packr/walk.go b/vendor/github.com/gobuffalo/packr/walk.go new file mode 100644 index 000000000..b1664d8be --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/walk.go @@ -0,0 +1,64 @@ +package packr + +import ( + "os" + "path/filepath" + "strings" + + "github.com/gobuffalo/packd" + "github.com/pkg/errors" +) + +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)) + if err != nil { + return errors.WithStack(err) + } + 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 + } + + file, err := fileFor(path, cleanName) + if err != nil { + return err + } + return wf(cleanName, file) + }) + } + for n := range data[b.Path] { + f, err := b.find(n) + if err != nil { + return err + } + err = wf(n, f) + if 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 { + opre := osPath(prefix) + return b.Walk(func(path string, f File) error { + if strings.HasPrefix(osPath(path), opre) { + if err := wf(path, f); err != nil { + return errors.WithStack(err) + } + } + return nil + }) +} diff --git a/vendor/github.com/gobuffalo/packr/walk_test.go b/vendor/github.com/gobuffalo/packr/walk_test.go new file mode 100644 index 000000000..26454379e --- /dev/null +++ b/vendor/github.com/gobuffalo/packr/walk_test.go @@ -0,0 +1,55 @@ +package packr + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_Box_Walk_Physical(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) +} + +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) + return nil + }) + r.NoError(err) + r.Equal(2, len(files)) + mustHave := osPaths("foo/a.txt", "foo/bar/b.txt") + r.Equal(mustHave, files) +} + +func Test_Box_WalkPrefix_Virtual(t *testing.T) { + r := require.New(t) + var files []string + err := virtualBox.WalkPrefix("d", func(path string, f File) error { + files = append(files, path) + return nil + }) + r.NoError(err) + r.Equal(1, len(files)) + r.Equal([]string{"d/a"}, files) +} diff --git a/vendor/github.com/gobuffalo/syncx/.gitignore b/vendor/github.com/gobuffalo/syncx/.gitignore new file mode 100644 index 000000000..368971859 --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/.gitignore @@ -0,0 +1,29 @@ +*.log +.DS_Store +doc +tmp +pkg +*.gem +*.pid +coverage +coverage.data +build/* +*.pbxuser +*.mode1v3 +.svn +profile +.console_history +.sass-cache/* +.rake_tasks~ +*.log.lck +solr/ +.jhw-cache/ +jhw.* +*.sublime* +node_modules/ +dist/ +generated/ +.vendor/ +bin/* +gin-bin +.idea/ diff --git a/vendor/github.com/gobuffalo/syncx/.gometalinter.json b/vendor/github.com/gobuffalo/syncx/.gometalinter.json new file mode 100644 index 000000000..e4f65a36e --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/.gometalinter.json @@ -0,0 +1,3 @@ +{ + "Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"] +} diff --git a/vendor/github.com/gobuffalo/syncx/.travis.yml b/vendor/github.com/gobuffalo/syncx/.travis.yml new file mode 100644 index 000000000..1fb041a25 --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/.travis.yml @@ -0,0 +1,36 @@ +language: go + +sudo: false + +matrix: + include: + - os: linux + go: "1.9.x" + - os: windows + go: "1.9.x" + - os: linux + go: "1.10.x" + - os: windows + go: "1.10.x" + - os: linux + go: "1.11.x" + env: + - GO111MODULE=off + - os: windows + go: "1.11.x" + env: + - GO111MODULE=off + - os: linux + go: "1.11.x" + env: + - GO111MODULE=on + - os: windows + go: "1.11.x" + env: + - GO111MODULE=on + +install: false + +script: + - go get -v -t ./... + - go test -v -timeout=5s -race ./... diff --git a/vendor/github.com/gobuffalo/syncx/LICENSE b/vendor/github.com/gobuffalo/syncx/LICENSE new file mode 100644 index 000000000..a538bcbf2 --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Mark Bates + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/gobuffalo/syncx/Makefile b/vendor/github.com/gobuffalo/syncx/Makefile new file mode 100644 index 000000000..2b893c0a2 --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/Makefile @@ -0,0 +1,52 @@ +TAGS ?= "sqlite" +GO_BIN ?= go + +install: + $(GO_BIN) install -tags ${TAGS} -v . + make tidy + +tidy: +ifeq ($(GO111MODULE),on) + $(GO_BIN) mod tidy +else + echo skipping go mod tidy +endif + +deps: + $(GO_BIN) get github.com/gobuffalo/release + $(GO_BIN) get -tags ${TAGS} -t ./... + make tidy + +build: + $(GO_BIN) build -v . + make tidy + +test: + $(GO_BIN) test -tags ${TAGS} ./... + make tidy + +ci-deps: + $(GO_BIN) get -tags ${TAGS} -t ./... + +ci-test: + $(GO_BIN) test -tags ${TAGS} -race ./... + +lint: + gometalinter --vendor ./... --deadline=1m --skip=internal + make tidy + +update: + $(GO_BIN) get -u -tags ${TAGS} + make tidy + make test + make install + make tidy + +release-test: + $(GO_BIN) test -tags ${TAGS} -race ./... + make tidy + +release: + make tidy + release -y -f version.go + make tidy diff --git a/vendor/github.com/gobuffalo/syncx/README.md b/vendor/github.com/gobuffalo/syncx/README.md new file mode 100644 index 000000000..0f0d02b20 --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/README.md @@ -0,0 +1,18 @@ +

+ +

+GoDoc +Go Report Card +

+ +# github.com/gobuffalo/syncx + +This package provides a set of types and tools for working in current environments. + +See [https://godoc.org/github.com/gobuffalo/syncx](https://godoc.org/github.com/gobuffalo/syncx) for more details. + +# Installation + +```bash +$ go get github.com/gobuffalo/syncx +``` diff --git a/vendor/github.com/gobuffalo/syncx/byte_map.go b/vendor/github.com/gobuffalo/syncx/byte_map.go new file mode 100644 index 000000000..39b7dae16 --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/byte_map.go @@ -0,0 +1,73 @@ +//go:generate mapgen -name "Byte" -zero "[]byte(``)" -go-type "[]byte" -pkg "" -a "[]byte(`A`)" -b "[]byte(`B`)" -c "[]byte(`C`)" -bb "[]byte(`BB`)" -destination "syncx" +// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. + +package syncx + +import ( + "sort" + "sync" +) + +// ByteMap wraps sync.Map and uses the following types: +// key: string +// value: []byte +type ByteMap struct { + data sync.Map +} + +// Delete the key from the map +func (m *ByteMap) Delete(key string) { + m.data.Delete(key) +} + +// Load the key from the map. +// Returns []byte or bool. +// A false return indicates either the key was not found +// or the value is not of type []byte +func (m *ByteMap) Load(key string) ([]byte, bool) { + i, ok := m.data.Load(key) + if !ok { + return []byte(``), false + } + s, ok := i.([]byte) + return s, ok +} + +// LoadOrStore will return an existing key or +// store the value if not already in the map +func (m *ByteMap) LoadOrStore(key string, value []byte) ([]byte, bool) { + i, _ := m.data.LoadOrStore(key, value) + s, ok := i.([]byte) + return s, ok +} + +// Range over the []byte values in the map +func (m *ByteMap) Range(f func(key string, value []byte) bool) { + m.data.Range(func(k, v interface{}) bool { + key, ok := k.(string) + if !ok { + return false + } + value, ok := v.([]byte) + if !ok { + return false + } + return f(key, value) + }) +} + +// Store a []byte in the map +func (m *ByteMap) Store(key string, value []byte) { + m.data.Store(key, value) +} + +// Keys returns a list of keys in the map +func (m *ByteMap) Keys() []string { + var keys []string + m.Range(func(key string, value []byte) bool { + keys = append(keys, key) + return true + }) + sort.Strings(keys) + return keys +} diff --git a/vendor/github.com/gobuffalo/syncx/byte_map_test.go b/vendor/github.com/gobuffalo/syncx/byte_map_test.go new file mode 100644 index 000000000..084137cc8 --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/byte_map_test.go @@ -0,0 +1,55 @@ +// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. + +package syncx + +import ( + "sort" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_ByteMap(t *testing.T) { + r := require.New(t) + + sm := &ByteMap{} + + sm.Store("a", []byte(`A`)) + + s, ok := sm.Load("a") + r.True(ok) + r.Equal([]byte(`A`), s) + + s, ok = sm.LoadOrStore("b", []byte(`B`)) + r.True(ok) + r.Equal([]byte(`B`), s) + + s, ok = sm.LoadOrStore("b", []byte(`BB`)) + r.True(ok) + r.Equal([]byte(`B`), s) + + var keys []string + + sm.Range(func(key string, value []byte) bool { + keys = append(keys, key) + return true + }) + + sort.Strings(keys) + + r.Equal(sm.Keys(), keys) + + sm.Delete("b") + r.Equal([]string{"a", "b"}, keys) + + sm.Delete("b") + _, ok = sm.Load("b") + r.False(ok) + + func(m *ByteMap) { + m.Store("c", []byte(`C`)) + }(sm) + s, ok = sm.Load("c") + r.True(ok) + r.Equal([]byte(`C`), s) +} diff --git a/vendor/github.com/gobuffalo/syncx/go.mod b/vendor/github.com/gobuffalo/syncx/go.mod new file mode 100644 index 000000000..7474082fa --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/go.mod @@ -0,0 +1,7 @@ +module github.com/gobuffalo/syncx + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/stretchr/testify v1.2.2 +) diff --git a/vendor/github.com/gobuffalo/syncx/go.sum b/vendor/github.com/gobuffalo/syncx/go.sum new file mode 100644 index 000000000..e03ee77d9 --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/go.sum @@ -0,0 +1,6 @@ +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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= diff --git a/vendor/github.com/gobuffalo/syncx/int_map.go b/vendor/github.com/gobuffalo/syncx/int_map.go new file mode 100644 index 000000000..f6eba4dce --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/int_map.go @@ -0,0 +1,73 @@ +//go:generate mapgen -name "Int" -zero "0" -go-type "int" -pkg "" -a "0" -b "1" -c "2" -bb "-1" -destination "syncx" +// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. + +package syncx + +import ( + "sort" + "sync" +) + +// IntMap wraps sync.Map and uses the following types: +// key: string +// value: int +type IntMap struct { + data sync.Map +} + +// Delete the key from the map +func (m *IntMap) Delete(key string) { + m.data.Delete(key) +} + +// Load the key from the map. +// Returns int or bool. +// A false return indicates either the key was not found +// or the value is not of type int +func (m *IntMap) Load(key string) (int, bool) { + i, ok := m.data.Load(key) + if !ok { + return 0, false + } + s, ok := i.(int) + return s, ok +} + +// LoadOrStore will return an existing key or +// store the value if not already in the map +func (m *IntMap) LoadOrStore(key string, value int) (int, bool) { + i, _ := m.data.LoadOrStore(key, value) + s, ok := i.(int) + return s, ok +} + +// Range over the int values in the map +func (m *IntMap) Range(f func(key string, value int) bool) { + m.data.Range(func(k, v interface{}) bool { + key, ok := k.(string) + if !ok { + return false + } + value, ok := v.(int) + if !ok { + return false + } + return f(key, value) + }) +} + +// Store a int in the map +func (m *IntMap) Store(key string, value int) { + m.data.Store(key, value) +} + +// Keys returns a list of keys in the map +func (m *IntMap) Keys() []string { + var keys []string + m.Range(func(key string, value int) bool { + keys = append(keys, key) + return true + }) + sort.Strings(keys) + return keys +} diff --git a/vendor/github.com/gobuffalo/syncx/int_map_test.go b/vendor/github.com/gobuffalo/syncx/int_map_test.go new file mode 100644 index 000000000..71039d04f --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/int_map_test.go @@ -0,0 +1,55 @@ +// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. + +package syncx + +import ( + "sort" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_IntMap(t *testing.T) { + r := require.New(t) + + sm := &IntMap{} + + sm.Store("a", 0) + + s, ok := sm.Load("a") + r.True(ok) + r.Equal(0, s) + + s, ok = sm.LoadOrStore("b", 1) + r.True(ok) + r.Equal(1, s) + + s, ok = sm.LoadOrStore("b", -1) + r.True(ok) + r.Equal(1, s) + + var keys []string + + sm.Range(func(key string, value int) bool { + keys = append(keys, key) + return true + }) + + sort.Strings(keys) + + r.Equal(sm.Keys(), keys) + + sm.Delete("b") + r.Equal([]string{"a", "b"}, keys) + + sm.Delete("b") + _, ok = sm.Load("b") + r.False(ok) + + func(m *IntMap) { + m.Store("c", 2) + }(sm) + s, ok = sm.Load("c") + r.True(ok) + r.Equal(2, s) +} diff --git a/vendor/github.com/gobuffalo/syncx/interface_map.go b/vendor/github.com/gobuffalo/syncx/interface_map.go new file mode 100644 index 000000000..93376135d --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/interface_map.go @@ -0,0 +1,73 @@ +//go:generate mapgen -name "" -zero "nil" -go-type "interface{}" -pkg "" -a "0" -b "1" -c "2" -bb "-1" -destination "syncx" +// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. + +package syncx + +import ( + "sort" + "sync" +) + +// Map wraps sync.Map and uses the following types: +// key: string +// value: interface{} +type Map struct { + data sync.Map +} + +// Delete the key from the map +func (m *Map) Delete(key string) { + m.data.Delete(key) +} + +// Load the key from the map. +// Returns interface{} or bool. +// A false return indicates either the key was not found +// or the value is not of type interface{} +func (m *Map) Load(key string) (interface{}, bool) { + i, ok := m.data.Load(key) + if !ok { + return nil, false + } + s, ok := i.(interface{}) + return s, ok +} + +// LoadOrStore will return an existing key or +// store the value if not already in the map +func (m *Map) LoadOrStore(key string, value interface{}) (interface{}, bool) { + i, _ := m.data.LoadOrStore(key, value) + s, ok := i.(interface{}) + return s, ok +} + +// Range over the interface{} values in the map +func (m *Map) Range(f func(key string, value interface{}) bool) { + m.data.Range(func(k, v interface{}) bool { + key, ok := k.(string) + if !ok { + return false + } + value, ok := v.(interface{}) + if !ok { + return false + } + return f(key, value) + }) +} + +// Store a interface{} in the map +func (m *Map) Store(key string, value interface{}) { + m.data.Store(key, value) +} + +// Keys returns a list of keys in the map +func (m *Map) Keys() []string { + var keys []string + m.Range(func(key string, value interface{}) bool { + keys = append(keys, key) + return true + }) + sort.Strings(keys) + return keys +} diff --git a/vendor/github.com/gobuffalo/syncx/interface_map_test.go b/vendor/github.com/gobuffalo/syncx/interface_map_test.go new file mode 100644 index 000000000..ad72f37cf --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/interface_map_test.go @@ -0,0 +1,55 @@ +// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. + +package syncx + +import ( + "sort" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_Map(t *testing.T) { + r := require.New(t) + + sm := &Map{} + + sm.Store("a", 0) + + s, ok := sm.Load("a") + r.True(ok) + r.Equal(0, s) + + s, ok = sm.LoadOrStore("b", 1) + r.True(ok) + r.Equal(1, s) + + s, ok = sm.LoadOrStore("b", -1) + r.True(ok) + r.Equal(1, s) + + var keys []string + + sm.Range(func(key string, value interface{}) bool { + keys = append(keys, key) + return true + }) + + sort.Strings(keys) + + r.Equal(sm.Keys(), keys) + + sm.Delete("b") + r.Equal([]string{"a", "b"}, keys) + + sm.Delete("b") + _, ok = sm.Load("b") + r.False(ok) + + func(m *Map) { + m.Store("c", 2) + }(sm) + s, ok = sm.Load("c") + r.True(ok) + r.Equal(2, s) +} diff --git a/vendor/github.com/gobuffalo/syncx/string_map.go b/vendor/github.com/gobuffalo/syncx/string_map.go new file mode 100644 index 000000000..2bb37cf4b --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/string_map.go @@ -0,0 +1,73 @@ +//go:generate mapgen -name "String" -zero "``" -go-type "string" -pkg "" -a "`A`" -b "`B`" -c "`C`" -bb "`BB`" -destination "syncx" +// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. + +package syncx + +import ( + "sort" + "sync" +) + +// StringMap wraps sync.Map and uses the following types: +// key: string +// value: string +type StringMap struct { + data sync.Map +} + +// Delete the key from the map +func (m *StringMap) Delete(key string) { + m.data.Delete(key) +} + +// Load the key from the map. +// Returns string or bool. +// A false return indicates either the key was not found +// or the value is not of type string +func (m *StringMap) Load(key string) (string, bool) { + i, ok := m.data.Load(key) + if !ok { + return ``, false + } + s, ok := i.(string) + return s, ok +} + +// LoadOrStore will return an existing key or +// store the value if not already in the map +func (m *StringMap) LoadOrStore(key string, value string) (string, bool) { + i, _ := m.data.LoadOrStore(key, value) + s, ok := i.(string) + return s, ok +} + +// Range over the string values in the map +func (m *StringMap) Range(f func(key string, value string) bool) { + m.data.Range(func(k, v interface{}) bool { + key, ok := k.(string) + if !ok { + return false + } + value, ok := v.(string) + if !ok { + return false + } + return f(key, value) + }) +} + +// Store a string in the map +func (m *StringMap) Store(key string, value string) { + m.data.Store(key, value) +} + +// Keys returns a list of keys in the map +func (m *StringMap) Keys() []string { + var keys []string + m.Range(func(key string, value string) bool { + keys = append(keys, key) + return true + }) + sort.Strings(keys) + return keys +} diff --git a/vendor/github.com/gobuffalo/syncx/string_map_test.go b/vendor/github.com/gobuffalo/syncx/string_map_test.go new file mode 100644 index 000000000..5fd14e5ee --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/string_map_test.go @@ -0,0 +1,55 @@ +// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. + +package syncx + +import ( + "sort" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_StringMap(t *testing.T) { + r := require.New(t) + + sm := &StringMap{} + + sm.Store("a", `A`) + + s, ok := sm.Load("a") + r.True(ok) + r.Equal(`A`, s) + + s, ok = sm.LoadOrStore("b", `B`) + r.True(ok) + r.Equal(`B`, s) + + s, ok = sm.LoadOrStore("b", `BB`) + r.True(ok) + r.Equal(`B`, s) + + var keys []string + + sm.Range(func(key string, value string) bool { + keys = append(keys, key) + return true + }) + + sort.Strings(keys) + + r.Equal(sm.Keys(), keys) + + sm.Delete("b") + r.Equal([]string{"a", "b"}, keys) + + sm.Delete("b") + _, ok = sm.Load("b") + r.False(ok) + + func(m *StringMap) { + m.Store("c", `C`) + }(sm) + s, ok = sm.Load("c") + r.True(ok) + r.Equal(`C`, s) +} diff --git a/vendor/github.com/gobuffalo/syncx/version.go b/vendor/github.com/gobuffalo/syncx/version.go new file mode 100644 index 000000000..97ee3e4ca --- /dev/null +++ b/vendor/github.com/gobuffalo/syncx/version.go @@ -0,0 +1,4 @@ +package syncx + +// Version of syncx +const Version = "v0.0.1" diff --git a/vendor/github.com/joho/godotenv/.gitignore b/vendor/github.com/joho/godotenv/.gitignore new file mode 100644 index 000000000..e43b0f988 --- /dev/null +++ b/vendor/github.com/joho/godotenv/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/vendor/github.com/joho/godotenv/.travis.yml b/vendor/github.com/joho/godotenv/.travis.yml new file mode 100644 index 000000000..f0db1adcd --- /dev/null +++ b/vendor/github.com/joho/godotenv/.travis.yml @@ -0,0 +1,8 @@ +language: go + +go: + - 1.x + +os: + - linux + - osx diff --git a/vendor/github.com/joho/godotenv/LICENCE b/vendor/github.com/joho/godotenv/LICENCE new file mode 100644 index 000000000..e7ddd51be --- /dev/null +++ b/vendor/github.com/joho/godotenv/LICENCE @@ -0,0 +1,23 @@ +Copyright (c) 2013 John Barton + +MIT License + +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/vendor/github.com/joho/godotenv/README.md b/vendor/github.com/joho/godotenv/README.md new file mode 100644 index 000000000..4e8fcf2e9 --- /dev/null +++ b/vendor/github.com/joho/godotenv/README.md @@ -0,0 +1,163 @@ +# GoDotEnv [![Build Status](https://travis-ci.org/joho/godotenv.svg?branch=master)](https://travis-ci.org/joho/godotenv) [![Build status](https://ci.appveyor.com/api/projects/status/9v40vnfvvgde64u4?svg=true)](https://ci.appveyor.com/project/joho/godotenv) [![Go Report Card](https://goreportcard.com/badge/github.com/joho/godotenv)](https://goreportcard.com/report/github.com/joho/godotenv) + +A Go (golang) port of the Ruby dotenv project (which loads env vars from a .env file) + +From the original Library: + +> Storing configuration in the environment is one of the tenets of a twelve-factor app. Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables. +> +> But it is not always practical to set environment variables on development machines or continuous integration servers where multiple projects are run. Dotenv load variables from a .env file into ENV when the environment is bootstrapped. + +It can be used as a library (for loading in env for your own daemons etc) or as a bin command. + +There is test coverage and CI for both linuxish and windows environments, but I make no guarantees about the bin version working on windows. + +## Installation + +As a library + +```shell +go get github.com/joho/godotenv +``` + +or if you want to use it as a bin command +```shell +go get github.com/joho/godotenv/cmd/godotenv +``` + +## Usage + +Add your application configuration to your `.env` file in the root of your project: + +```shell +S3_BUCKET=YOURS3BUCKET +SECRET_KEY=YOURSECRETKEYGOESHERE +``` + +Then in your Go app you can do something like + +```go +package main + +import ( + "github.com/joho/godotenv" + "log" + "os" +) + +func main() { + err := godotenv.Load() + if err != nil { + log.Fatal("Error loading .env file") + } + + s3Bucket := os.Getenv("S3_BUCKET") + secretKey := os.Getenv("SECRET_KEY") + + // now do something with s3 or whatever +} +``` + +If you're even lazier than that, you can just take advantage of the autoload package which will read in `.env` on import + +```go +import _ "github.com/joho/godotenv/autoload" +``` + +While `.env` in the project root is the default, you don't have to be constrained, both examples below are 100% legit + +```go +_ = godotenv.Load("somerandomfile") +_ = godotenv.Load("filenumberone.env", "filenumbertwo.env") +``` + +If you want to be really fancy with your env file you can do comments and exports (below is a valid env file) + +```shell +# I am a comment and that is OK +SOME_VAR=someval +FOO=BAR # comments at line end are OK too +export BAR=BAZ +``` + +Or finally you can do YAML(ish) style + +```yaml +FOO: bar +BAR: baz +``` + +as a final aside, if you don't want godotenv munging your env you can just get a map back instead + +```go +var myEnv map[string]string +myEnv, err := godotenv.Read() + +s3Bucket := myEnv["S3_BUCKET"] +``` + +... or from an `io.Reader` instead of a local file + +```go +reader := getRemoteFile() +myEnv, err := godotenv.Parse(reader) +``` + +... or from a `string` if you so desire + +```go +content := getRemoteFileContent() +myEnv, err := godotenv.Unmarshal(content) +``` + +### Command Mode + +Assuming you've installed the command as above and you've got `$GOPATH/bin` in your `$PATH` + +``` +godotenv -f /some/path/to/.env some_command with some args +``` + +If you don't specify `-f` it will fall back on the default of loading `.env` in `PWD` + +### Writing Env Files + +Godotenv can also write a map representing the environment to a correctly-formatted and escaped file + +```go +env, err := godotenv.Unmarshal("KEY=value") +err := godotenv.Write(env, "./.env") +``` + +... or to a string + +```go +env, err := godotenv.Unmarshal("KEY=value") +content, err := godotenv.Marshal(env) +``` + +## Contributing + +Contributions are most welcome! The parser itself is pretty stupidly naive and I wouldn't be surprised if it breaks with edge cases. + +*code changes without tests will not be accepted* + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Added some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request + +## Releases + +Releases should follow [Semver](http://semver.org/) though the first couple of releases are `v1` and `v1.1`. + +Use [annotated tags for all releases](https://github.com/joho/godotenv/issues/30). Example `git tag -a v1.2.1` + +## CI + +Linux: [![Build Status](https://travis-ci.org/joho/godotenv.svg?branch=master)](https://travis-ci.org/joho/godotenv) Windows: [![Build status](https://ci.appveyor.com/api/projects/status/9v40vnfvvgde64u4)](https://ci.appveyor.com/project/joho/godotenv) + +## Who? + +The original library [dotenv](https://github.com/bkeepers/dotenv) was written by [Brandon Keepers](http://opensoul.org/), and this port was done by [John Barton](https://johnbarton.co/) based off the tests/fixtures in the original library. diff --git a/vendor/github.com/joho/godotenv/autoload/autoload.go b/vendor/github.com/joho/godotenv/autoload/autoload.go new file mode 100644 index 000000000..fbcd2bdf8 --- /dev/null +++ b/vendor/github.com/joho/godotenv/autoload/autoload.go @@ -0,0 +1,15 @@ +package autoload + +/* + You can just read the .env file on import just by doing + + import _ "github.com/joho/godotenv/autoload" + + And bob's your mother's brother +*/ + +import "github.com/joho/godotenv" + +func init() { + godotenv.Load() +} diff --git a/vendor/github.com/joho/godotenv/cmd/godotenv/cmd.go b/vendor/github.com/joho/godotenv/cmd/godotenv/cmd.go new file mode 100644 index 000000000..04a9f6497 --- /dev/null +++ b/vendor/github.com/joho/godotenv/cmd/godotenv/cmd.go @@ -0,0 +1,54 @@ +package main + +import ( + "flag" + "fmt" + "log" + + "strings" + + "github.com/joho/godotenv" +) + +func main() { + var showHelp bool + flag.BoolVar(&showHelp, "h", false, "show help") + var rawEnvFilenames string + flag.StringVar(&rawEnvFilenames, "f", "", "comma separated paths to .env files") + + flag.Parse() + + usage := ` +Run a process with a env setup from a .env file + +godotenv [-f ENV_FILE_PATHS] COMMAND_ARGS + +ENV_FILE_PATHS: comma separated paths to .env files +COMMAND_ARGS: command and args you want to run + +example + godotenv -f /path/to/something/.env,/another/path/.env fortune +` + // if no args or -h flag + // print usage and return + args := flag.Args() + if showHelp || len(args) == 0 { + fmt.Println(usage) + return + } + + // load env + var envFilenames []string + if rawEnvFilenames != "" { + envFilenames = strings.Split(rawEnvFilenames, ",") + } + + // take rest of args and "exec" them + cmd := args[0] + cmdArgs := args[1:] + + err := godotenv.Exec(envFilenames, cmd, cmdArgs) + if err != nil { + log.Fatal(err) + } +} diff --git a/vendor/github.com/joho/godotenv/fixtures/equals.env b/vendor/github.com/joho/godotenv/fixtures/equals.env new file mode 100644 index 000000000..594c5328a --- /dev/null +++ b/vendor/github.com/joho/godotenv/fixtures/equals.env @@ -0,0 +1,2 @@ +export OPTION_A='postgres://localhost:5432/database?sslmode=disable' + diff --git a/vendor/github.com/joho/godotenv/fixtures/exported.env b/vendor/github.com/joho/godotenv/fixtures/exported.env new file mode 100644 index 000000000..5821377c7 --- /dev/null +++ b/vendor/github.com/joho/godotenv/fixtures/exported.env @@ -0,0 +1,2 @@ +export OPTION_A=2 +export OPTION_B='\n' diff --git a/vendor/github.com/joho/godotenv/fixtures/invalid1.env b/vendor/github.com/joho/godotenv/fixtures/invalid1.env new file mode 100644 index 000000000..38f7e0e8b --- /dev/null +++ b/vendor/github.com/joho/godotenv/fixtures/invalid1.env @@ -0,0 +1,2 @@ +INVALID LINE +foo=bar diff --git a/vendor/github.com/joho/godotenv/fixtures/plain.env b/vendor/github.com/joho/godotenv/fixtures/plain.env new file mode 100644 index 000000000..43f7e44cc --- /dev/null +++ b/vendor/github.com/joho/godotenv/fixtures/plain.env @@ -0,0 +1,7 @@ +OPTION_A=1 +OPTION_B=2 +OPTION_C= 3 +OPTION_D =4 +OPTION_E = 5 +OPTION_F = +OPTION_G= \ No newline at end of file diff --git a/vendor/github.com/joho/godotenv/fixtures/quoted.env b/vendor/github.com/joho/godotenv/fixtures/quoted.env new file mode 100644 index 000000000..cc6376a3f --- /dev/null +++ b/vendor/github.com/joho/godotenv/fixtures/quoted.env @@ -0,0 +1,9 @@ +OPTION_A='1' +OPTION_B='2' +OPTION_C='' +OPTION_D='\n' +OPTION_E="1" +OPTION_F="2" +OPTION_G="" +OPTION_H="\n" +OPTION_I = "echo 'asd'" diff --git a/vendor/github.com/joho/godotenv/fixtures/substitutions.env b/vendor/github.com/joho/godotenv/fixtures/substitutions.env new file mode 100644 index 000000000..44337a998 --- /dev/null +++ b/vendor/github.com/joho/godotenv/fixtures/substitutions.env @@ -0,0 +1,5 @@ +OPTION_A=1 +OPTION_B=${OPTION_A} +OPTION_C=$OPTION_B +OPTION_D=${OPTION_A}${OPTION_B} +OPTION_E=${OPTION_NOT_DEFINED} diff --git a/vendor/github.com/joho/godotenv/godotenv.go b/vendor/github.com/joho/godotenv/godotenv.go new file mode 100644 index 000000000..29b436c77 --- /dev/null +++ b/vendor/github.com/joho/godotenv/godotenv.go @@ -0,0 +1,346 @@ +// Package godotenv is a go port of the ruby dotenv library (https://github.com/bkeepers/dotenv) +// +// Examples/readme can be found on the github page at https://github.com/joho/godotenv +// +// The TL;DR is that you make a .env file that looks something like +// +// SOME_ENV_VAR=somevalue +// +// and then in your go code you can call +// +// godotenv.Load() +// +// and all the env vars declared in .env will be available through os.Getenv("SOME_ENV_VAR") +package godotenv + +import ( + "bufio" + "errors" + "fmt" + "io" + "os" + "os/exec" + "regexp" + "sort" + "strings" +) + +const doubleQuoteSpecialChars = "\\\n\r\"!$`" + +// Load will read your env file(s) and load them into ENV for this process. +// +// Call this function as close as possible to the start of your program (ideally in main) +// +// If you call Load without any args it will default to loading .env in the current path +// +// You can otherwise tell it which files to load (there can be more than one) like +// +// godotenv.Load("fileone", "filetwo") +// +// It's important to note that it WILL NOT OVERRIDE an env variable that already exists - consider the .env file to set dev vars or sensible defaults +func Load(filenames ...string) (err error) { + filenames = filenamesOrDefault(filenames) + + for _, filename := range filenames { + err = loadFile(filename, false) + if err != nil { + return // return early on a spazout + } + } + return +} + +// Overload will read your env file(s) and load them into ENV for this process. +// +// Call this function as close as possible to the start of your program (ideally in main) +// +// If you call Overload without any args it will default to loading .env in the current path +// +// You can otherwise tell it which files to load (there can be more than one) like +// +// godotenv.Overload("fileone", "filetwo") +// +// It's important to note this WILL OVERRIDE an env variable that already exists - consider the .env file to forcefilly set all vars. +func Overload(filenames ...string) (err error) { + filenames = filenamesOrDefault(filenames) + + for _, filename := range filenames { + err = loadFile(filename, true) + if err != nil { + return // return early on a spazout + } + } + return +} + +// Read all env (with same file loading semantics as Load) but return values as +// a map rather than automatically writing values into env +func Read(filenames ...string) (envMap map[string]string, err error) { + filenames = filenamesOrDefault(filenames) + envMap = make(map[string]string) + + for _, filename := range filenames { + individualEnvMap, individualErr := readFile(filename) + + if individualErr != nil { + err = individualErr + return // return early on a spazout + } + + for key, value := range individualEnvMap { + envMap[key] = value + } + } + + return +} + +// Parse reads an env file from io.Reader, returning a map of keys and values. +func Parse(r io.Reader) (envMap map[string]string, err error) { + envMap = make(map[string]string) + + var lines []string + scanner := bufio.NewScanner(r) + for scanner.Scan() { + lines = append(lines, scanner.Text()) + } + + if err = scanner.Err(); err != nil { + return + } + + for _, fullLine := range lines { + if !isIgnoredLine(fullLine) { + var key, value string + key, value, err = parseLine(fullLine, envMap) + + if err != nil { + return + } + envMap[key] = value + } + } + return +} + +//Unmarshal reads an env file from a string, returning a map of keys and values. +func Unmarshal(str string) (envMap map[string]string, err error) { + return Parse(strings.NewReader(str)) +} + +// Exec loads env vars from the specified filenames (empty map falls back to default) +// then executes the cmd specified. +// +// Simply hooks up os.Stdin/err/out to the command and calls Run() +// +// If you want more fine grained control over your command it's recommended +// that you use `Load()` or `Read()` and the `os/exec` package yourself. +func Exec(filenames []string, cmd string, cmdArgs []string) error { + Load(filenames...) + + command := exec.Command(cmd, cmdArgs...) + command.Stdin = os.Stdin + command.Stdout = os.Stdout + command.Stderr = os.Stderr + return command.Run() +} + +// Write serializes the given environment and writes it to a file +func Write(envMap map[string]string, filename string) error { + content, error := Marshal(envMap) + if error != nil { + return error + } + file, error := os.Create(filename) + if error != nil { + return error + } + _, err := file.WriteString(content) + return err +} + +// Marshal outputs the given environment as a dotenv-formatted environment file. +// Each line is in the format: KEY="VALUE" where VALUE is backslash-escaped. +func Marshal(envMap map[string]string) (string, error) { + lines := make([]string, 0, len(envMap)) + for k, v := range envMap { + lines = append(lines, fmt.Sprintf(`%s="%s"`, k, doubleQuoteEscape(v))) + } + sort.Strings(lines) + return strings.Join(lines, "\n"), nil +} + +func filenamesOrDefault(filenames []string) []string { + if len(filenames) == 0 { + return []string{".env"} + } + return filenames +} + +func loadFile(filename string, overload bool) error { + envMap, err := readFile(filename) + if err != nil { + return err + } + + currentEnv := map[string]bool{} + rawEnv := os.Environ() + for _, rawEnvLine := range rawEnv { + key := strings.Split(rawEnvLine, "=")[0] + currentEnv[key] = true + } + + for key, value := range envMap { + if !currentEnv[key] || overload { + os.Setenv(key, value) + } + } + + return nil +} + +func readFile(filename string) (envMap map[string]string, err error) { + file, err := os.Open(filename) + if err != nil { + return + } + defer file.Close() + + return Parse(file) +} + +func parseLine(line string, envMap map[string]string) (key string, value string, err error) { + if len(line) == 0 { + err = errors.New("zero length string") + return + } + + // ditch the comments (but keep quoted hashes) + if strings.Contains(line, "#") { + segmentsBetweenHashes := strings.Split(line, "#") + quotesAreOpen := false + var segmentsToKeep []string + for _, segment := range segmentsBetweenHashes { + if strings.Count(segment, "\"") == 1 || strings.Count(segment, "'") == 1 { + if quotesAreOpen { + quotesAreOpen = false + segmentsToKeep = append(segmentsToKeep, segment) + } else { + quotesAreOpen = true + } + } + + if len(segmentsToKeep) == 0 || quotesAreOpen { + segmentsToKeep = append(segmentsToKeep, segment) + } + } + + line = strings.Join(segmentsToKeep, "#") + } + + firstEquals := strings.Index(line, "=") + firstColon := strings.Index(line, ":") + splitString := strings.SplitN(line, "=", 2) + if firstColon != -1 && (firstColon < firstEquals || firstEquals == -1) { + //this is a yaml-style line + splitString = strings.SplitN(line, ":", 2) + } + + if len(splitString) != 2 { + err = errors.New("Can't separate key from value") + return + } + + // Parse the key + key = splitString[0] + if strings.HasPrefix(key, "export") { + key = strings.TrimPrefix(key, "export") + } + key = strings.Trim(key, " ") + + // Parse the value + value = parseValue(splitString[1], envMap) + return +} + +func parseValue(value string, envMap map[string]string) string { + + // trim + value = strings.Trim(value, " ") + + // check if we've got quoted values or possible escapes + if len(value) > 1 { + rs := regexp.MustCompile(`\A'(.*)'\z`) + singleQuotes := rs.FindStringSubmatch(value) + + rd := regexp.MustCompile(`\A"(.*)"\z`) + doubleQuotes := rd.FindStringSubmatch(value) + + if singleQuotes != nil || doubleQuotes != nil { + // pull the quotes off the edges + value = value[1 : len(value)-1] + } + + if doubleQuotes != nil { + // expand newlines + escapeRegex := regexp.MustCompile(`\\.`) + value = escapeRegex.ReplaceAllStringFunc(value, func(match string) string { + c := strings.TrimPrefix(match, `\`) + switch c { + case "n": + return "\n" + case "r": + return "\r" + default: + return match + } + }) + // unescape characters + e := regexp.MustCompile(`\\([^$])`) + value = e.ReplaceAllString(value, "$1") + } + + if singleQuotes == nil { + value = expandVariables(value, envMap) + } + } + + return value +} + +func expandVariables(v string, m map[string]string) string { + r := regexp.MustCompile(`(\\)?(\$)(\()?\{?([A-Z0-9_]+)?\}?`) + + return r.ReplaceAllStringFunc(v, func(s string) string { + submatch := r.FindStringSubmatch(s) + + if submatch == nil { + return s + } + if submatch[1] == "\\" || submatch[2] == "(" { + return submatch[0][1:] + } else if submatch[4] != "" { + return m[submatch[4]] + } + return s + }) +} + +func isIgnoredLine(line string) bool { + trimmedLine := strings.Trim(line, " \n\t") + return len(trimmedLine) == 0 || strings.HasPrefix(trimmedLine, "#") +} + +func doubleQuoteEscape(line string) string { + for _, c := range doubleQuoteSpecialChars { + toReplace := "\\" + string(c) + if c == '\n' { + toReplace = `\n` + } + if c == '\r' { + toReplace = `\r` + } + line = strings.Replace(line, string(c), toReplace, -1) + } + return line +} diff --git a/vendor/github.com/joho/godotenv/godotenv_test.go b/vendor/github.com/joho/godotenv/godotenv_test.go new file mode 100644 index 000000000..acc213108 --- /dev/null +++ b/vendor/github.com/joho/godotenv/godotenv_test.go @@ -0,0 +1,456 @@ +package godotenv + +import ( + "bytes" + "fmt" + "os" + "reflect" + "testing" + "strings" +) + +var noopPresets = make(map[string]string) + +func parseAndCompare(t *testing.T, rawEnvLine string, expectedKey string, expectedValue string) { + key, value, _ := parseLine(rawEnvLine, noopPresets) + if key != expectedKey || value != expectedValue { + t.Errorf("Expected '%v' to parse as '%v' => '%v', got '%v' => '%v' instead", rawEnvLine, expectedKey, expectedValue, key, value) + } +} + +func loadEnvAndCompareValues(t *testing.T, loader func(files ...string) error, envFileName string, expectedValues map[string]string, presets map[string]string) { + // first up, clear the env + os.Clearenv() + + for k, v := range presets { + os.Setenv(k, v) + } + + err := loader(envFileName) + if err != nil { + t.Fatalf("Error loading %v", envFileName) + } + + for k := range expectedValues { + envValue := os.Getenv(k) + v := expectedValues[k] + if envValue != v { + t.Errorf("Mismatch for key '%v': expected '%v' got '%v'", k, v, envValue) + } + } +} + +func TestLoadWithNoArgsLoadsDotEnv(t *testing.T) { + err := Load() + pathError := err.(*os.PathError) + if pathError == nil || pathError.Op != "open" || pathError.Path != ".env" { + t.Errorf("Didn't try and open .env by default") + } +} + +func TestOverloadWithNoArgsOverloadsDotEnv(t *testing.T) { + err := Overload() + pathError := err.(*os.PathError) + if pathError == nil || pathError.Op != "open" || pathError.Path != ".env" { + t.Errorf("Didn't try and open .env by default") + } +} + +func TestLoadFileNotFound(t *testing.T) { + err := Load("somefilethatwillneverexistever.env") + if err == nil { + t.Error("File wasn't found but Load didn't return an error") + } +} + +func TestOverloadFileNotFound(t *testing.T) { + err := Overload("somefilethatwillneverexistever.env") + if err == nil { + t.Error("File wasn't found but Overload didn't return an error") + } +} + +func TestReadPlainEnv(t *testing.T) { + envFileName := "fixtures/plain.env" + expectedValues := map[string]string{ + "OPTION_A": "1", + "OPTION_B": "2", + "OPTION_C": "3", + "OPTION_D": "4", + "OPTION_E": "5", + "OPTION_F": "", + "OPTION_G": "", + } + + envMap, err := Read(envFileName) + if err != nil { + t.Error("Error reading file") + } + + if len(envMap) != len(expectedValues) { + t.Error("Didn't get the right size map back") + } + + for key, value := range expectedValues { + if envMap[key] != value { + t.Error("Read got one of the keys wrong") + } + } +} + +func TestParse(t *testing.T) { + envMap, err := Parse(bytes.NewReader([]byte("ONE=1\nTWO='2'\nTHREE = \"3\""))) + expectedValues := map[string]string{ + "ONE": "1", + "TWO": "2", + "THREE": "3", + } + if err != nil { + t.Fatalf("error parsing env: %v", err) + } + for key, value := range expectedValues { + if envMap[key] != value { + t.Errorf("expected %s to be %s, got %s", key, value, envMap[key]) + } + } +} + +func TestLoadDoesNotOverride(t *testing.T) { + envFileName := "fixtures/plain.env" + + // ensure NO overload + presets := map[string]string{ + "OPTION_A": "do_not_override", + "OPTION_B": "", + } + + expectedValues := map[string]string{ + "OPTION_A": "do_not_override", + "OPTION_B": "", + } + loadEnvAndCompareValues(t, Load, envFileName, expectedValues, presets) +} + +func TestOveroadDoesOverride(t *testing.T) { + envFileName := "fixtures/plain.env" + + // ensure NO overload + presets := map[string]string{ + "OPTION_A": "do_not_override", + } + + expectedValues := map[string]string{ + "OPTION_A": "1", + } + loadEnvAndCompareValues(t, Overload, envFileName, expectedValues, presets) +} + +func TestLoadPlainEnv(t *testing.T) { + envFileName := "fixtures/plain.env" + expectedValues := map[string]string{ + "OPTION_A": "1", + "OPTION_B": "2", + "OPTION_C": "3", + "OPTION_D": "4", + "OPTION_E": "5", + } + + loadEnvAndCompareValues(t, Load, envFileName, expectedValues, noopPresets) +} + +func TestLoadExportedEnv(t *testing.T) { + envFileName := "fixtures/exported.env" + expectedValues := map[string]string{ + "OPTION_A": "2", + "OPTION_B": "\\n", + } + + loadEnvAndCompareValues(t, Load, envFileName, expectedValues, noopPresets) +} + +func TestLoadEqualsEnv(t *testing.T) { + envFileName := "fixtures/equals.env" + expectedValues := map[string]string{ + "OPTION_A": "postgres://localhost:5432/database?sslmode=disable", + } + + loadEnvAndCompareValues(t, Load, envFileName, expectedValues, noopPresets) +} + +func TestLoadQuotedEnv(t *testing.T) { + envFileName := "fixtures/quoted.env" + expectedValues := map[string]string{ + "OPTION_A": "1", + "OPTION_B": "2", + "OPTION_C": "", + "OPTION_D": "\\n", + "OPTION_E": "1", + "OPTION_F": "2", + "OPTION_G": "", + "OPTION_H": "\n", + "OPTION_I": "echo 'asd'", + } + + loadEnvAndCompareValues(t, Load, envFileName, expectedValues, noopPresets) +} + +func TestSubstitutions(t *testing.T) { + envFileName := "fixtures/substitutions.env" + expectedValues := map[string]string{ + "OPTION_A": "1", + "OPTION_B": "1", + "OPTION_C": "1", + "OPTION_D": "11", + "OPTION_E": "", + } + + loadEnvAndCompareValues(t, Load, envFileName, expectedValues, noopPresets) +} + +func TestExpanding(t *testing.T) { + tests := []struct { + name string + input string + expected map[string]string + }{ + { + "expands variables found in values", + "FOO=test\nBAR=$FOO", + map[string]string{"FOO": "test", "BAR": "test"}, + }, + { + "parses variables wrapped in brackets", + "FOO=test\nBAR=${FOO}bar", + map[string]string{"FOO": "test", "BAR": "testbar"}, + }, + { + "expands undefined variables to an empty string", + "BAR=$FOO", + map[string]string{"BAR": ""}, + }, + { + "expands variables in double quoted strings", + "FOO=test\nBAR=\"quote $FOO\"", + map[string]string{"FOO": "test", "BAR": "quote test"}, + }, + { + "does not expand variables in single quoted strings", + "BAR='quote $FOO'", + map[string]string{"BAR": "quote $FOO"}, + }, + { + "does not expand escaped variables", + `FOO="foo\$BAR"`, + map[string]string{"FOO": "foo$BAR"}, + }, + { + "does not expand escaped variables", + `FOO="foo\${BAR}"`, + map[string]string{"FOO": "foo${BAR}"}, + }, + { + "does not expand escaped variables", + "FOO=test\nBAR=\"foo\\${FOO} ${FOO}\"", + map[string]string{"FOO": "test", "BAR": "foo${FOO} test"}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + env, err := Parse(strings.NewReader(tt.input)) + if err != nil { + t.Errorf("Error: %s", err.Error()) + } + for k, v := range tt.expected { + if strings.Compare(env[k], v) != 0 { + t.Errorf("Expected: %s, Actual: %s", v, env[k]) + } + } + }) + } + +} + +func TestActualEnvVarsAreLeftAlone(t *testing.T) { + os.Clearenv() + os.Setenv("OPTION_A", "actualenv") + _ = Load("fixtures/plain.env") + + if os.Getenv("OPTION_A") != "actualenv" { + t.Error("An ENV var set earlier was overwritten") + } +} + +func TestParsing(t *testing.T) { + // unquoted values + parseAndCompare(t, "FOO=bar", "FOO", "bar") + + // parses values with spaces around equal sign + parseAndCompare(t, "FOO =bar", "FOO", "bar") + parseAndCompare(t, "FOO= bar", "FOO", "bar") + + // parses double quoted values + parseAndCompare(t, `FOO="bar"`, "FOO", "bar") + + // parses single quoted values + parseAndCompare(t, "FOO='bar'", "FOO", "bar") + + // parses escaped double quotes + parseAndCompare(t, `FOO="escaped\"bar"`, "FOO", `escaped"bar`) + + // parses single quotes inside double quotes + parseAndCompare(t, `FOO="'d'"`, "FOO", `'d'`) + + // parses yaml style options + parseAndCompare(t, "OPTION_A: 1", "OPTION_A", "1") + + //parses yaml values with equal signs + parseAndCompare(t, "OPTION_A: Foo=bar", "OPTION_A", "Foo=bar") + + // parses non-yaml options with colons + parseAndCompare(t, "OPTION_A=1:B", "OPTION_A", "1:B") + + // parses export keyword + parseAndCompare(t, "export OPTION_A=2", "OPTION_A", "2") + parseAndCompare(t, `export OPTION_B='\n'`, "OPTION_B", "\\n") + + // it 'expands newlines in quoted strings' do + // expect(env('FOO="bar\nbaz"')).to eql('FOO' => "bar\nbaz") + parseAndCompare(t, `FOO="bar\nbaz"`, "FOO", "bar\nbaz") + + // it 'parses varibales with "." in the name' do + // expect(env('FOO.BAR=foobar')).to eql('FOO.BAR' => 'foobar') + parseAndCompare(t, "FOO.BAR=foobar", "FOO.BAR", "foobar") + + // it 'parses varibales with several "=" in the value' do + // expect(env('FOO=foobar=')).to eql('FOO' => 'foobar=') + parseAndCompare(t, "FOO=foobar=", "FOO", "foobar=") + + // it 'strips unquoted values' do + // expect(env('foo=bar ')).to eql('foo' => 'bar') # not 'bar ' + parseAndCompare(t, "FOO=bar ", "FOO", "bar") + + // it 'ignores inline comments' do + // expect(env("foo=bar # this is foo")).to eql('foo' => 'bar') + parseAndCompare(t, "FOO=bar # this is foo", "FOO", "bar") + + // it 'allows # in quoted value' do + // expect(env('foo="bar#baz" # comment')).to eql('foo' => 'bar#baz') + parseAndCompare(t, `FOO="bar#baz" # comment`, "FOO", "bar#baz") + parseAndCompare(t, "FOO='bar#baz' # comment", "FOO", "bar#baz") + parseAndCompare(t, `FOO="bar#baz#bang" # comment`, "FOO", "bar#baz#bang") + + // it 'parses # in quoted values' do + // expect(env('foo="ba#r"')).to eql('foo' => 'ba#r') + // expect(env("foo='ba#r'")).to eql('foo' => 'ba#r') + parseAndCompare(t, `FOO="ba#r"`, "FOO", "ba#r") + parseAndCompare(t, "FOO='ba#r'", "FOO", "ba#r") + + //newlines and backslashes should be escaped + parseAndCompare(t, `FOO="bar\n\ b\az"`, "FOO", "bar\n baz") + parseAndCompare(t, `FOO="bar\\\n\ b\az"`, "FOO", "bar\\\n baz") + parseAndCompare(t, `FOO="bar\\r\ b\az"`, "FOO", "bar\\r baz") + + parseAndCompare(t, `="value"`, "", "value") + parseAndCompare(t, `KEY="`, "KEY", "\"") + parseAndCompare(t, `KEY="value`, "KEY", "\"value") + + // it 'throws an error if line format is incorrect' do + // expect{env('lol$wut')}.to raise_error(Dotenv::FormatError) + badlyFormattedLine := "lol$wut" + _, _, err := parseLine(badlyFormattedLine, noopPresets) + if err == nil { + t.Errorf("Expected \"%v\" to return error, but it didn't", badlyFormattedLine) + } +} + +func TestLinesToIgnore(t *testing.T) { + // it 'ignores empty lines' do + // expect(env("\n \t \nfoo=bar\n \nfizz=buzz")).to eql('foo' => 'bar', 'fizz' => 'buzz') + if !isIgnoredLine("\n") { + t.Error("Line with nothing but line break wasn't ignored") + } + + if !isIgnoredLine("\t\t ") { + t.Error("Line full of whitespace wasn't ignored") + } + + // it 'ignores comment lines' do + // expect(env("\n\n\n # HERE GOES FOO \nfoo=bar")).to eql('foo' => 'bar') + if !isIgnoredLine("# comment") { + t.Error("Comment wasn't ignored") + } + + if !isIgnoredLine("\t#comment") { + t.Error("Indented comment wasn't ignored") + } + + // make sure we're not getting false positives + if isIgnoredLine(`export OPTION_B='\n'`) { + t.Error("ignoring a perfectly valid line to parse") + } +} + +func TestErrorReadDirectory(t *testing.T) { + envFileName := "fixtures/" + envMap, err := Read(envFileName) + + if err == nil { + t.Errorf("Expected error, got %v", envMap) + } +} + +func TestErrorParsing(t *testing.T) { + envFileName := "fixtures/invalid1.env" + envMap, err := Read(envFileName) + if err == nil { + t.Errorf("Expected error, got %v", envMap) + } +} + +func TestWrite(t *testing.T) { + writeAndCompare := func(env string, expected string) { + envMap, _ := Unmarshal(env) + actual, _ := Marshal(envMap) + if expected != actual { + t.Errorf("Expected '%v' (%v) to write as '%v', got '%v' instead.", env, envMap, expected, actual) + } + } + //just test some single lines to show the general idea + //TestRoundtrip makes most of the good assertions + + //values are always double-quoted + writeAndCompare(`key=value`, `key="value"`) + //double-quotes are escaped + writeAndCompare(`key=va"lu"e`, `key="va\"lu\"e"`) + //but single quotes are left alone + writeAndCompare(`key=va'lu'e`, `key="va'lu'e"`) + // newlines, backslashes, and some other special chars are escaped + writeAndCompare(`foo="\n\r\\r!"`, `foo="\n\r\\r\!"`) + // lines should be sorted + writeAndCompare("foo=bar\nbaz=buzz", "baz=\"buzz\"\nfoo=\"bar\"") + +} + +func TestRoundtrip(t *testing.T) { + fixtures := []string{"equals.env", "exported.env", "plain.env", "quoted.env"} + for _, fixture := range fixtures { + fixtureFilename := fmt.Sprintf("fixtures/%s", fixture) + env, err := readFile(fixtureFilename) + if err != nil { + t.Errorf("Expected '%s' to read without error (%v)", fixtureFilename, err) + } + rep, err := Marshal(env) + if err != nil { + t.Errorf("Expected '%s' to Marshal (%v)", fixtureFilename, err) + } + roundtripped, err := Unmarshal(rep) + if err != nil { + t.Errorf("Expected '%s' to Mashal and Unmarshal (%v)", fixtureFilename, err) + } + if !reflect.DeepEqual(env, roundtripped) { + t.Errorf("Expected '%s' to roundtrip as '%v', got '%v' instead", fixtureFilename, env, roundtripped) + } + + } +} diff --git a/vendor/github.com/markbates/oncer/.gitignore b/vendor/github.com/markbates/oncer/.gitignore new file mode 100644 index 000000000..368971859 --- /dev/null +++ b/vendor/github.com/markbates/oncer/.gitignore @@ -0,0 +1,29 @@ +*.log +.DS_Store +doc +tmp +pkg +*.gem +*.pid +coverage +coverage.data +build/* +*.pbxuser +*.mode1v3 +.svn +profile +.console_history +.sass-cache/* +.rake_tasks~ +*.log.lck +solr/ +.jhw-cache/ +jhw.* +*.sublime* +node_modules/ +dist/ +generated/ +.vendor/ +bin/* +gin-bin +.idea/ diff --git a/vendor/github.com/markbates/oncer/LICENSE b/vendor/github.com/markbates/oncer/LICENSE new file mode 100644 index 000000000..a538bcbf2 --- /dev/null +++ b/vendor/github.com/markbates/oncer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Mark Bates + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/markbates/oncer/Makefile b/vendor/github.com/markbates/oncer/Makefile new file mode 100644 index 000000000..187cb8a3f --- /dev/null +++ b/vendor/github.com/markbates/oncer/Makefile @@ -0,0 +1,40 @@ +TAGS ?= "sqlite" +GO_BIN ?= go + +install: + packr + $(GO_BIN) install -v . + +deps: + $(GO_BIN) get github.com/gobuffalo/release + $(GO_BIN) get github.com/gobuffalo/packr/packr + $(GO_BIN) get -tags ${TAGS} -t ./... + $(GO_BIN) mod tidy + +build: + packr + $(GO_BIN) build -v . + +test: + packr + $(GO_BIN) test -tags ${TAGS} ./... + +ci-test: deps + $(GO_BIN) test -tags ${TAGS} -race ./... + +lint: + gometalinter --vendor ./... --deadline=1m --skip=internal + +update: + $(GO_BIN) get -u -tags ${TAGS} + $(GO_BIN) mod tidy + packr + make test + make install + $(GO_BIN) mod tidy + +release-test: + $(GO_BIN) test -tags ${TAGS} -race ./... + +release: + release -y -f version.go diff --git a/vendor/github.com/markbates/oncer/deprecate.go b/vendor/github.com/markbates/oncer/deprecate.go new file mode 100644 index 000000000..4eb3a443e --- /dev/null +++ b/vendor/github.com/markbates/oncer/deprecate.go @@ -0,0 +1,20 @@ +package oncer + +import ( + "fmt" + "io" + "os" +) + +const deprecated = "DEPRECATED" + +var deprecationWriter io.Writer = os.Stdout + +func Deprecate(depth int, name string, msg string) { + Do(deprecated+name, func() { + fmt.Fprintf(deprecationWriter, "[%s] %s has been deprecated.\n", deprecated, name) + if len(msg) > 0 { + fmt.Fprintf(deprecationWriter, "\t%s\n", msg) + } + }) +} diff --git a/vendor/github.com/markbates/oncer/deprecate_test.go b/vendor/github.com/markbates/oncer/deprecate_test.go new file mode 100644 index 000000000..322a5cfe6 --- /dev/null +++ b/vendor/github.com/markbates/oncer/deprecate_test.go @@ -0,0 +1,32 @@ +package oncer + +import ( + "bytes" + "strings" + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_Deprecate_NoMessage(t *testing.T) { + r := require.New(t) + + bb := &bytes.Buffer{} + deprecationWriter = bb + + Deprecate(4, "Test_Deprecate_NoMessage", "") + act := bb.String() + r.True(strings.HasPrefix(act, "[DEPRECATED] Test_Deprecate_NoMessage has been deprecated.")) +} + +func Test_Deprecate_Message(t *testing.T) { + r := require.New(t) + + bb := &bytes.Buffer{} + deprecationWriter = bb + + Deprecate(4, "Test_Deprecate_Message", "Use something else instead") + act := bb.String() + r.True(strings.HasPrefix(act, "[DEPRECATED] Test_Deprecate_Message has been deprecated.")) + r.Contains(act, "Use something else instead") +} diff --git a/vendor/github.com/markbates/oncer/go.mod b/vendor/github.com/markbates/oncer/go.mod new file mode 100644 index 000000000..950e99b23 --- /dev/null +++ b/vendor/github.com/markbates/oncer/go.mod @@ -0,0 +1,7 @@ +module github.com/markbates/oncer + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/stretchr/testify v1.2.2 +) diff --git a/vendor/github.com/markbates/oncer/go.sum b/vendor/github.com/markbates/oncer/go.sum new file mode 100644 index 000000000..e03ee77d9 --- /dev/null +++ b/vendor/github.com/markbates/oncer/go.sum @@ -0,0 +1,6 @@ +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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= diff --git a/vendor/github.com/markbates/oncer/log.go b/vendor/github.com/markbates/oncer/log.go new file mode 100644 index 000000000..ed4346396 --- /dev/null +++ b/vendor/github.com/markbates/oncer/log.go @@ -0,0 +1,7 @@ +//+build !debug + +package oncer + +func log(name string, fn func()) func() { + return fn +} diff --git a/vendor/github.com/markbates/oncer/log_debug.go b/vendor/github.com/markbates/oncer/log_debug.go new file mode 100644 index 000000000..76d0e1149 --- /dev/null +++ b/vendor/github.com/markbates/oncer/log_debug.go @@ -0,0 +1,19 @@ +//+build debug + +package oncer + +import ( + "fmt" + "time" +) + +func log(name string, fn func()) func() { + return func() { + start := time.Now() + if len(name) > 80 { + name = name[(len(name) - 80):] + } + defer fmt.Println(name, time.Now().Sub(start)) + fn() + } +} diff --git a/vendor/github.com/markbates/oncer/oncer.go b/vendor/github.com/markbates/oncer/oncer.go new file mode 100644 index 000000000..5b3ab8df0 --- /dev/null +++ b/vendor/github.com/markbates/oncer/oncer.go @@ -0,0 +1,26 @@ +package oncer + +import ( + "sync" +) + +var onces = &sync.Map{} + +func Do(name string, fn func()) { + o, _ := onces.LoadOrStore(name, &sync.Once{}) + if once, ok := o.(*sync.Once); ok { + once.Do(log(name, fn)) + } +} + +func Reset(names ...string) { + if len(names) == 0 { + onces = &sync.Map{} + return + } + + for _, n := range names { + onces.Delete(n) + onces.Delete(deprecated + n) + } +} diff --git a/vendor/github.com/markbates/oncer/oncer_test.go b/vendor/github.com/markbates/oncer/oncer_test.go new file mode 100644 index 000000000..5fa2a40a8 --- /dev/null +++ b/vendor/github.com/markbates/oncer/oncer_test.go @@ -0,0 +1,61 @@ +package oncer + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func Test_Do(t *testing.T) { + r := require.New(t) + + var counter int + for i := 0; i < 5; i++ { + Do("foo", func() { + counter++ + }) + } + r.Equal(1, counter) +} + +func Test_Reset_ByName(t *testing.T) { + r := require.New(t) + + Do("foo", func() {}) + Do("bar", func() {}) + + _, ok := onces.Load("foo") + r.True(ok) + + _, ok = onces.Load("bar") + r.True(ok) + + Reset("foo") + + _, ok = onces.Load("foo") + r.False(ok) + + _, ok = onces.Load("bar") + r.True(ok) +} + +func Test_Reset_All(t *testing.T) { + r := require.New(t) + + Do("foo", func() {}) + Do("bar", func() {}) + + _, ok := onces.Load("foo") + r.True(ok) + + _, ok = onces.Load("bar") + r.True(ok) + + Reset() + + _, ok = onces.Load("foo") + r.False(ok) + + _, ok = onces.Load("bar") + r.False(ok) +} diff --git a/vendor/github.com/rogpeppe/go-internal/.travis.yml b/vendor/github.com/rogpeppe/go-internal/.travis.yml new file mode 100644 index 000000000..2418bec3f --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/.travis.yml @@ -0,0 +1,12 @@ +language: go +env: + - GO111MODULE=on +go_import_path: github.com/rogpeppe/go-internal +install: "echo no install step required" +go: + - "1.11.x" +script: + - go test ./... + - go mod tidy + - go list all > /dev/null # https://github.com/golang/go/issues/27868#issuecomment-431413621 + - test -z "$(git status --porcelain)" || (git status; git diff && false) diff --git a/vendor/github.com/rogpeppe/go-internal/README.md b/vendor/github.com/rogpeppe/go-internal/README.md new file mode 100644 index 000000000..2a7c7f3db --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/README.md @@ -0,0 +1,16 @@ +This repository factors out an opinionated selection of internal packages and functionality from the Go standard +library. Currently this consists mostly of packages and testing code from within the Go tool implementation. + +Included are the following: + +- dirhash: calculate hashes over directory trees the same way that the Go tool does. +- goproxytest: a GOPROXY implementation designed for test use. +- gotooltest: Use the Go tool inside test scripts (see testscript below) +- imports: list of known architectures and OSs, and support for reading import import statements. +- modfile: read and write `go.mod` files while preserving formatting and comments. +- module: module paths and versions. +- par: do work in parallel. +- semver: semantic version parsing. +- testenv: information on the current testing environment. +- testscript: script-based testing based on txtar files +- txtar: simple text-based file archives for testing. diff --git a/vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/addmod.go b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/addmod.go new file mode 100644 index 000000000..f67dafe49 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/addmod.go @@ -0,0 +1,160 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// The txtar-addmod command adds a module as a txtar archive to the a testdata module directory +// as understood by the goproxytest package (see https://godoc.org/github.com/rogpeppe/go-internal/goproxytest). +// +// Usage: +// +// txtar-addmod dir path@version... +// +// where dir is the directory to add the module to. +// +// In general, it's intended to be used only for very small modules - we do not want to check +// very large files into testdata/mod. +// +// It is acceptable to edit the archive afterward to remove or shorten files. +// +package main + +import ( + "bytes" + "flag" + "fmt" + "io/ioutil" + "log" + "os" + "os/exec" + "path/filepath" + "strings" + + "github.com/rogpeppe/go-internal/txtar" +) + +func usage() { + fmt.Fprintf(os.Stderr, "usage: txtar-addmod dir path@version...\n") + os.Exit(2) +} + +var tmpdir string + +func fatalf(format string, args ...interface{}) { + os.RemoveAll(tmpdir) + log.Fatalf(format, args...) +} + +const goCmd = "go" + +func main() { + os.Exit(main1()) +} + +func main1() int { + flag.Usage = usage + flag.Parse() + if flag.NArg() < 2 { + usage() + } + targetDir := flag.Arg(0) + modules := flag.Args()[1:] + + log.SetPrefix("txtar-addmod: ") + log.SetFlags(0) + + var err error + tmpdir, err = ioutil.TempDir("", "txtar-addmod-") + if err != nil { + log.Fatal(err) + } + + run := func(command string, args ...string) string { + cmd := exec.Command(command, args...) + cmd.Dir = tmpdir + var stderr bytes.Buffer + cmd.Stderr = &stderr + out, err := cmd.Output() + if err != nil { + fatalf("%s %s: %v\n%s", command, strings.Join(args, " "), err, stderr.Bytes()) + } + return string(out) + } + + gopath := strings.TrimSpace(run("go", "env", "GOPATH")) + if gopath == "" { + fatalf("cannot find GOPATH") + } + + exitCode := 0 + for _, arg := range modules { + if err := ioutil.WriteFile(filepath.Join(tmpdir, "go.mod"), []byte("module m\n"), 0666); err != nil { + fatalf("%v", err) + } + run(goCmd, "get", "-d", arg) + path := arg + if i := strings.Index(path, "@"); i >= 0 { + path = path[:i] + } + out := run(goCmd, "list", "-m", "-f={{.Path}} {{.Version}} {{.Dir}}", path) + f := strings.Fields(out) + if len(f) != 3 { + log.Printf("go list -m %s: unexpected output %q", arg, out) + exitCode = 1 + continue + } + path, vers, dir := f[0], f[1], f[2] + mod, err := ioutil.ReadFile(filepath.Join(gopath, "pkg/mod/cache/download", path, "@v", vers+".mod")) + if err != nil { + log.Printf("%s: %v", arg, err) + exitCode = 1 + continue + } + info, err := ioutil.ReadFile(filepath.Join(gopath, "pkg/mod/cache/download", path, "@v", vers+".info")) + if err != nil { + log.Printf("%s: %v", arg, err) + exitCode = 1 + continue + } + + a := new(txtar.Archive) + title := arg + if !strings.Contains(arg, "@") { + title += "@" + vers + } + a.Comment = []byte(fmt.Sprintf("module %s\n\n", title)) + a.Files = []txtar.File{ + {Name: ".mod", Data: mod}, + {Name: ".info", Data: info}, + } + dir = filepath.Clean(dir) + err = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { + if !info.Mode().IsRegular() { + return nil + } + name := info.Name() + if name == "go.mod" || strings.HasSuffix(name, ".go") { + data, err := ioutil.ReadFile(path) + if err != nil { + return err + } + a.Files = append(a.Files, txtar.File{Name: strings.TrimPrefix(path, dir+string(filepath.Separator)), Data: data}) + } + return nil + }) + if err != nil { + log.Printf("%s: %v", arg, err) + exitCode = 1 + continue + } + + data := txtar.Format(a) + target := filepath.Join(targetDir, strings.Replace(path, "/", "_", -1)+"_"+vers+".txt") + if err := ioutil.WriteFile(target, data, 0666); err != nil { + log.Printf("%s: %v", arg, err) + exitCode = 1 + continue + } + } + os.RemoveAll(tmpdir) + return exitCode +} diff --git a/vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/script_test.go b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/script_test.go new file mode 100644 index 000000000..9d2ac577d --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/script_test.go @@ -0,0 +1,49 @@ +package main + +import ( + "fmt" + "os" + "testing" + + "github.com/rogpeppe/go-internal/goproxytest" + "github.com/rogpeppe/go-internal/gotooltest" + "github.com/rogpeppe/go-internal/testscript" +) + +var proxyURL string + +func TestMain(m *testing.M) { + os.Exit(testscript.RunMain(gobinMain{m}, map[string]func() int{ + "txtar-addmod": main1, + })) +} + +type gobinMain struct { + m *testing.M +} + +func (m gobinMain) Run() int { + // Start the Go proxy server running for all tests. + srv, err := goproxytest.NewServer("testdata/mod", "") + if err != nil { + fmt.Fprintf(os.Stderr, "cannot start proxy: %v", err) + return 1 + } + proxyURL = srv.URL + + return m.m.Run() +} + +func TestScripts(t *testing.T) { + p := testscript.Params{ + Dir: "testdata", + Setup: func(e *testscript.Env) error { + e.Vars = append(e.Vars, "GOPROXY="+proxyURL) + return nil + }, + } + if err := gotooltest.Setup(&p); err != nil { + t.Fatal(err) + } + testscript.Run(t, p) +} diff --git a/vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/testdata/mod/github.com_gobin-testrepos_simple-main_v1.0.0.txt b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/testdata/mod/github.com_gobin-testrepos_simple-main_v1.0.0.txt new file mode 100644 index 000000000..aa2d7163a --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/testdata/mod/github.com_gobin-testrepos_simple-main_v1.0.0.txt @@ -0,0 +1,16 @@ +module github.com/gobin-testrepos/simple-main@v1.0.0 + +-- .mod -- +module github.com/gobin-testrepos/simple-main +-- .info -- +{"Version":"v1.0.0","Time":"2018-10-22T18:45:39Z"} +-- go.mod -- +module github.com/gobin-testrepos/simple-main +-- main.go -- +package main + +import "fmt" + +func main() { + fmt.Println("I am a simple module-based main") +} diff --git a/vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/testdata/txtar-addmod-self.txt b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/testdata/txtar-addmod-self.txt new file mode 100644 index 000000000..f4879195d --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-addmod/testdata/txtar-addmod-self.txt @@ -0,0 +1,5 @@ +mkdir $WORK/out +txtar-addmod $WORK/out github.com/gobin-testrepos/simple-main +! stdout .+ +! stderr .+ +exists $WORK/out/github.com_gobin-testrepos_simple-main_v1.0.0.txt diff --git a/vendor/github.com/rogpeppe/go-internal/cmd/txtar-goproxy/main.go b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-goproxy/main.go new file mode 100644 index 000000000..161cc7696 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-goproxy/main.go @@ -0,0 +1,47 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// The txtar-goproxy command runs a Go module proxy from a txtar module +// directory (as manipulated by the txtar-addmod command). +// +// This allows interactive experimentation with the set of proxied modules. +// For example: +// +// cd cmd/go +// go test -proxy=localhost:1234 & +// export GOPROXY=http://localhost:1234/mod +// +// and then run go commands as usual. +package main + +import ( + "flag" + "fmt" + "log" + "os" + + "github.com/rogpeppe/go-internal/goproxytest" +) + +var proxyAddr = flag.String("addr", "", "run proxy on this network address") + +func usage() { + fmt.Fprintf(os.Stderr, "usage: txtar-goproxy [flags] dir\n") + flag.PrintDefaults() + os.Exit(2) +} + +func main() { + flag.Usage = usage + flag.Parse() + if flag.NArg() != 1 { + usage() + } + srv, err := goproxytest.NewServer(flag.Arg(0), *proxyAddr) + if err != nil { + log.Fatal(err) + } + fmt.Printf("export GOPROXY=%s\n", srv.URL) + select {} +} diff --git a/vendor/github.com/rogpeppe/go-internal/cmd/txtar-savedir/savedir.go b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-savedir/savedir.go new file mode 100644 index 000000000..4165e028e --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-savedir/savedir.go @@ -0,0 +1,84 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// The txtar-savedir command archives a directory tree as a txtar archive printed to standard output. +// +// Usage: +// +// txtar-savedir /path/to/dir >saved.txt +// +// See https://godoc.org/github.com/rogpeppe/go-internal/txtar for details of the format +// and how to parse a txtar file. +// +package main + +import ( + "flag" + "fmt" + "io/ioutil" + "log" + "os" + "path/filepath" + "strings" + "unicode/utf8" + + "github.com/rogpeppe/go-internal/txtar" +) + +func usage() { + fmt.Fprintf(os.Stderr, "usage: savedir dir >saved.txt\n") + os.Exit(2) +} + +const goCmd = "go" + +func main() { + os.Exit(main1()) +} + +func main1() int { + flag.Usage = usage + flag.Parse() + if flag.NArg() != 1 { + usage() + } + + log.SetPrefix("savedir: ") + log.SetFlags(0) + + dir := flag.Arg(0) + + a := new(txtar.Archive) + dir = filepath.Clean(dir) + filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { + if path == dir { + return nil + } + name := info.Name() + if strings.HasPrefix(name, ".") { + if info.IsDir() { + return filepath.SkipDir + } + return nil + } + if !info.Mode().IsRegular() { + return nil + } + data, err := ioutil.ReadFile(path) + if err != nil { + log.Fatal(err) + } + if !utf8.Valid(data) { + log.Printf("%s: ignoring invalid UTF-8 data", path) + return nil + } + a.Files = append(a.Files, txtar.File{Name: strings.TrimPrefix(path, dir+string(filepath.Separator)), Data: data}) + return nil + }) + + data := txtar.Format(a) + os.Stdout.Write(data) + + return 0 +} diff --git a/vendor/github.com/rogpeppe/go-internal/cmd/txtar-savedir/script_test.go b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-savedir/script_test.go new file mode 100644 index 000000000..191557bf3 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-savedir/script_test.go @@ -0,0 +1,19 @@ +package main + +import ( + "os" + "testing" + + "github.com/rogpeppe/go-internal/testscript" +) + +func TestMain(m *testing.M) { + os.Exit(testscript.RunMain(m, map[string]func() int{ + "txtar-savedir": main1, + })) +} + +func TestScripts(t *testing.T) { + p := testscript.Params{Dir: "testdata"} + testscript.Run(t, p) +} diff --git a/vendor/github.com/rogpeppe/go-internal/cmd/txtar-savedir/testdata/txtar-savedir-self.txt b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-savedir/testdata/txtar-savedir-self.txt new file mode 100644 index 000000000..f61f02a5a --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/cmd/txtar-savedir/testdata/txtar-savedir-self.txt @@ -0,0 +1,19 @@ +# Because of https://github.com/rogpeppe/go-internal/issues/11 we cannot +# define a txtar archive-generated file that is the golden output from txtar-savedir +# So we can't actually test the output for now, instead we just rely on a simple +# stdout check +txtar-savedir blah +! stderr .+ +stdout '^module example.com/blah$' + +-- blah/go.mod -- +module example.com/blah + +-- blah/main.go -- +package main + +import "fmt" + +func main() { + fmt.Println("Hello, world!") +} diff --git a/vendor/github.com/rogpeppe/go-internal/dirhash/hash.go b/vendor/github.com/rogpeppe/go-internal/dirhash/hash.go new file mode 100644 index 000000000..61d8face5 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/dirhash/hash.go @@ -0,0 +1,103 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package dirhash defines hashes over directory trees. +package dirhash + +import ( + "archive/zip" + "crypto/sha256" + "encoding/base64" + "errors" + "fmt" + "io" + "os" + "path/filepath" + "sort" + "strings" +) + +var DefaultHash = Hash1 + +type Hash func(files []string, open func(string) (io.ReadCloser, error)) (string, error) + +func Hash1(files []string, open func(string) (io.ReadCloser, error)) (string, error) { + h := sha256.New() + files = append([]string(nil), files...) + sort.Strings(files) + for _, file := range files { + if strings.Contains(file, "\n") { + return "", errors.New("filenames with newlines are not supported") + } + r, err := open(file) + if err != nil { + return "", err + } + hf := sha256.New() + _, err = io.Copy(hf, r) + r.Close() + if err != nil { + return "", err + } + fmt.Fprintf(h, "%x %s\n", hf.Sum(nil), file) + } + return "h1:" + base64.StdEncoding.EncodeToString(h.Sum(nil)), nil +} + +func HashDir(dir, prefix string, hash Hash) (string, error) { + files, err := DirFiles(dir, prefix) + if err != nil { + return "", err + } + osOpen := func(name string) (io.ReadCloser, error) { + return os.Open(filepath.Join(dir, strings.TrimPrefix(name, prefix))) + } + return hash(files, osOpen) +} + +func DirFiles(dir, prefix string) ([]string, error) { + var files []string + dir = filepath.Clean(dir) + err := filepath.Walk(dir, func(file string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + return nil + } + rel := file + if dir != "." { + rel = file[len(dir)+1:] + } + f := filepath.Join(prefix, rel) + files = append(files, filepath.ToSlash(f)) + return nil + }) + if err != nil { + return nil, err + } + return files, nil +} + +func HashZip(zipfile string, hash Hash) (string, error) { + z, err := zip.OpenReader(zipfile) + if err != nil { + return "", err + } + defer z.Close() + var files []string + zfiles := make(map[string]*zip.File) + for _, file := range z.File { + files = append(files, file.Name) + zfiles[file.Name] = file + } + zipOpen := func(name string) (io.ReadCloser, error) { + f := zfiles[name] + if f == nil { + return nil, fmt.Errorf("file %q not found in zip", name) // should never happen + } + return f.Open() + } + return hash(files, zipOpen) +} diff --git a/vendor/github.com/rogpeppe/go-internal/dirhash/hash_test.go b/vendor/github.com/rogpeppe/go-internal/dirhash/hash_test.go new file mode 100644 index 000000000..ed463c194 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/dirhash/hash_test.go @@ -0,0 +1,135 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package dirhash + +import ( + "archive/zip" + "crypto/sha256" + "encoding/base64" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + "testing" +) + +func h(s string) string { + return fmt.Sprintf("%x", sha256.Sum256([]byte(s))) +} + +func htop(k string, s string) string { + sum := sha256.Sum256([]byte(s)) + return k + ":" + base64.StdEncoding.EncodeToString(sum[:]) +} + +func TestHash1(t *testing.T) { + files := []string{"xyz", "abc"} + open := func(name string) (io.ReadCloser, error) { + return ioutil.NopCloser(strings.NewReader("data for " + name)), nil + } + want := htop("h1", fmt.Sprintf("%s %s\n%s %s\n", h("data for abc"), "abc", h("data for xyz"), "xyz")) + out, err := Hash1(files, open) + if err != nil { + t.Fatal(err) + } + if out != want { + t.Errorf("Hash1(...) = %s, want %s", out, want) + } + + _, err = Hash1([]string{"xyz", "a\nbc"}, open) + if err == nil { + t.Error("Hash1: expected error on newline in filenames") + } +} + +func TestHashDir(t *testing.T) { + dir, err := ioutil.TempDir("", "dirhash-test-") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(dir) + if err := ioutil.WriteFile(filepath.Join(dir, "xyz"), []byte("data for xyz"), 0666); err != nil { + t.Fatal(err) + } + if err := ioutil.WriteFile(filepath.Join(dir, "abc"), []byte("data for abc"), 0666); err != nil { + t.Fatal(err) + } + want := htop("h1", fmt.Sprintf("%s %s\n%s %s\n", h("data for abc"), "prefix/abc", h("data for xyz"), "prefix/xyz")) + out, err := HashDir(dir, "prefix", Hash1) + if err != nil { + t.Fatalf("HashDir: %v", err) + } + if out != want { + t.Errorf("HashDir(...) = %s, want %s", out, want) + } +} + +func TestHashZip(t *testing.T) { + f, err := ioutil.TempFile("", "dirhash-test-") + if err != nil { + t.Fatal(err) + } + defer os.Remove(f.Name()) + defer f.Close() + + z := zip.NewWriter(f) + w, err := z.Create("prefix/xyz") + if err != nil { + t.Fatal(err) + } + w.Write([]byte("data for xyz")) + w, err = z.Create("prefix/abc") + if err != nil { + t.Fatal(err) + } + w.Write([]byte("data for abc")) + if err := z.Close(); err != nil { + t.Fatal(err) + } + if err := f.Close(); err != nil { + t.Fatal(err) + } + + want := htop("h1", fmt.Sprintf("%s %s\n%s %s\n", h("data for abc"), "prefix/abc", h("data for xyz"), "prefix/xyz")) + out, err := HashZip(f.Name(), Hash1) + if err != nil { + t.Fatalf("HashDir: %v", err) + } + if out != want { + t.Errorf("HashDir(...) = %s, want %s", out, want) + } +} + +func TestDirFiles(t *testing.T) { + dir, err := ioutil.TempDir("", "dirfiles-test-") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(dir) + if err := ioutil.WriteFile(filepath.Join(dir, "xyz"), []byte("data for xyz"), 0666); err != nil { + t.Fatal(err) + } + if err := ioutil.WriteFile(filepath.Join(dir, "abc"), []byte("data for abc"), 0666); err != nil { + t.Fatal(err) + } + if err := os.Mkdir(filepath.Join(dir, "subdir"), 0777); err != nil { + t.Fatal(err) + } + if err := ioutil.WriteFile(filepath.Join(dir, "subdir", "xyz"), []byte("data for subdir xyz"), 0666); err != nil { + t.Fatal(err) + } + prefix := "foo/bar@v2.3.4" + out, err := DirFiles(dir, prefix) + if err != nil { + t.Fatalf("DirFiles: %v", err) + } + for _, file := range out { + if !strings.HasPrefix(file, prefix) { + t.Errorf("Dir file = %s, want prefix %s", file, prefix) + } + } +} diff --git a/vendor/github.com/rogpeppe/go-internal/go.mod b/vendor/github.com/rogpeppe/go-internal/go.mod new file mode 100644 index 000000000..9c350f74a --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/go.mod @@ -0,0 +1,3 @@ +module github.com/rogpeppe/go-internal + +require gopkg.in/errgo.v2 v2.1.0 diff --git a/vendor/github.com/rogpeppe/go-internal/go.sum b/vendor/github.com/rogpeppe/go-internal/go.sum new file mode 100644 index 000000000..ce65fe1d5 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/go.sum @@ -0,0 +1,9 @@ +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= +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 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= diff --git a/vendor/github.com/rogpeppe/go-internal/goproxytest/allhex.go b/vendor/github.com/rogpeppe/go-internal/goproxytest/allhex.go new file mode 100644 index 000000000..c77e52e4f --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/goproxytest/allhex.go @@ -0,0 +1,19 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package goproxytest + +// This code was taken from src/cmd/go/internal/modfetch/codehost. + +// allHex reports whether the revision rev is entirely lower-case hexadecimal digits. +func allHex(rev string) bool { + for i := 0; i < len(rev); i++ { + c := rev[i] + if '0' <= c && c <= '9' || 'a' <= c && c <= 'f' { + continue + } + return false + } + return true +} diff --git a/vendor/github.com/rogpeppe/go-internal/goproxytest/proxy.go b/vendor/github.com/rogpeppe/go-internal/goproxytest/proxy.go new file mode 100644 index 000000000..63087ba45 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/goproxytest/proxy.go @@ -0,0 +1,287 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package goproxytest serves Go modules from a proxy +server designed to run on localhost during tests, both to make tests avoid +requiring specific network servers and also to make them +significantly faster. + +Each module archive is named path_vers.txt, where slashes in path +have been replaced with underscores. The archive must contain +two files ".info" and ".mod", to be served as the info and mod files +in the proxy protocol (see https://research.swtch.com/vgo-module). +The remaining files are served as the content of the module zip file. +The path@vers prefix required of files in the zip file is added +automatically by the proxy: the files in the archive have names without +the prefix, like plain "go.mod", "x.go", and so on. + +See ../cmd/txtar-addmod and ../cmd/txtar-savedir for tools +generate txtar files, although it's fine to write them by hand. +*/ +package goproxytest + +import ( + "archive/zip" + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "log" + "net" + "net/http" + "os" + "path/filepath" + "strings" + + "github.com/rogpeppe/go-internal/module" + "github.com/rogpeppe/go-internal/par" + "github.com/rogpeppe/go-internal/semver" + "github.com/rogpeppe/go-internal/txtar" +) + +type Server struct { + URL string + dir string + listener net.Listener + modList []module.Version + zipCache par.Cache + archiveCache par.Cache +} + +// StartProxy starts the Go module proxy listening on the given +// network address. It serves modules taken from the given directory +// name. If addr is empty, it will listen on an arbitrary +// localhost port. If dir is empty, "testmod" will be used. +// +// The returned Server should be closed after use. +func NewServer(dir, addr string) (*Server, error) { + var srv Server + if addr == "" { + addr = "localhost:0" + } + if dir == "" { + dir = "testmod" + } + srv.dir = dir + if err := srv.readModList(); err != nil { + return nil, fmt.Errorf("cannot read modules: %v", err) + } + l, err := net.Listen("tcp", addr) + if err != nil { + return nil, fmt.Errorf("cannot listen on %q: %v", addr, err) + } + addr = l.Addr().String() + srv.URL = "http://" + addr + "/mod" + go func() { + log.Printf("go proxy: http.Serve: %v", http.Serve(l, http.HandlerFunc(srv.handler))) + }() + return &srv, nil +} + +// Close shuts down the proxy. +func (srv *Server) Close() { + srv.listener.Close() +} + +func (srv *Server) readModList() error { + infos, err := ioutil.ReadDir(srv.dir) + if err != nil { + return err + } + for _, info := range infos { + name := info.Name() + if !strings.HasSuffix(name, ".txt") { + continue + } + name = strings.TrimSuffix(name, ".txt") + i := strings.LastIndex(name, "_v") + if i < 0 { + continue + } + encPath := strings.Replace(name[:i], "_", "/", -1) + path, err := module.DecodePath(encPath) + if err != nil { + return fmt.Errorf("cannot decode module path in %q: %v", name, err) + } + encVers := name[i+1:] + vers, err := module.DecodeVersion(encVers) + if err != nil { + return fmt.Errorf("cannot decode module version in %q: %v", name, err) + } + srv.modList = append(srv.modList, module.Version{Path: path, Version: vers}) + } + return nil +} + +// handler serves the Go module proxy protocol. +// See the proxy section of https://research.swtch.com/vgo-module. +func (srv *Server) handler(w http.ResponseWriter, r *http.Request) { + if !strings.HasPrefix(r.URL.Path, "/mod/") { + http.NotFound(w, r) + return + } + path := strings.TrimPrefix(r.URL.Path, "/mod/") + i := strings.Index(path, "/@v/") + if i < 0 { + http.NotFound(w, r) + return + } + enc, file := path[:i], path[i+len("/@v/"):] + path, err := module.DecodePath(enc) + if err != nil { + fmt.Fprintf(os.Stderr, "go proxy_test: %v\n", err) + http.NotFound(w, r) + return + } + if file == "list" { + n := 0 + for _, m := range srv.modList { + if m.Path == path && !isPseudoVersion(m.Version) { + if err := module.Check(m.Path, m.Version); err == nil { + fmt.Fprintf(w, "%s\n", m.Version) + n++ + } + } + } + if n == 0 { + http.NotFound(w, r) + } + return + } + + i = strings.LastIndex(file, ".") + if i < 0 { + http.NotFound(w, r) + return + } + encVers, ext := file[:i], file[i+1:] + vers, err := module.DecodeVersion(encVers) + if err != nil { + fmt.Fprintf(os.Stderr, "go proxy_test: %v\n", err) + http.NotFound(w, r) + return + } + + if allHex(vers) { + var best string + // Convert commit hash (only) to known version. + // Use latest version in semver priority, to match similar logic + // in the repo-based module server (see modfetch.(*codeRepo).convert). + for _, m := range srv.modList { + if m.Path == path && semver.Compare(best, m.Version) < 0 { + var hash string + if isPseudoVersion(m.Version) { + hash = m.Version[strings.LastIndex(m.Version, "-")+1:] + } else { + hash = srv.findHash(m) + } + if strings.HasPrefix(hash, vers) || strings.HasPrefix(vers, hash) { + best = m.Version + } + } + } + if best != "" { + vers = best + } + } + + a := srv.readArchive(path, vers) + if a == nil { + fmt.Fprintf(os.Stderr, "go proxy: no archive %s %s\n", path, vers) + http.Error(w, "cannot load archive", 500) + return + } + + switch ext { + case "info", "mod": + want := "." + ext + for _, f := range a.Files { + if f.Name == want { + w.Write(f.Data) + return + } + } + + case "zip": + type cached struct { + zip []byte + err error + } + c := srv.zipCache.Do(a, func() interface{} { + var buf bytes.Buffer + z := zip.NewWriter(&buf) + for _, f := range a.Files { + if strings.HasPrefix(f.Name, ".") { + continue + } + zf, err := z.Create(path + "@" + vers + "/" + f.Name) + if err != nil { + return cached{nil, err} + } + if _, err := zf.Write(f.Data); err != nil { + return cached{nil, err} + } + } + if err := z.Close(); err != nil { + return cached{nil, err} + } + return cached{buf.Bytes(), nil} + }).(cached) + + if c.err != nil { + fmt.Fprintf(os.Stderr, "go proxy: %v\n", c.err) + http.Error(w, c.err.Error(), 500) + return + } + w.Write(c.zip) + return + + } + http.NotFound(w, r) +} + +func (srv *Server) findHash(m module.Version) string { + a := srv.readArchive(m.Path, m.Version) + if a == nil { + return "" + } + var data []byte + for _, f := range a.Files { + if f.Name == ".info" { + data = f.Data + break + } + } + var info struct{ Short string } + json.Unmarshal(data, &info) + return info.Short +} + +func (srv *Server) readArchive(path, vers string) *txtar.Archive { + enc, err := module.EncodePath(path) + if err != nil { + fmt.Fprintf(os.Stderr, "go proxy: %v\n", err) + return nil + } + encVers, err := module.EncodeVersion(vers) + if err != nil { + fmt.Fprintf(os.Stderr, "go proxy: %v\n", err) + return nil + } + + prefix := strings.Replace(enc, "/", "_", -1) + name := filepath.Join(srv.dir, prefix+"_"+encVers+".txt") + a := srv.archiveCache.Do(name, func() interface{} { + a, err := txtar.ParseFile(name) + if err != nil { + if !os.IsNotExist(err) { + fmt.Fprintf(os.Stderr, "go proxy: %v\n", err) + } + a = nil + } + return a + }).(*txtar.Archive) + return a +} diff --git a/vendor/github.com/rogpeppe/go-internal/goproxytest/pseudo.go b/vendor/github.com/rogpeppe/go-internal/goproxytest/pseudo.go new file mode 100644 index 000000000..570acaae1 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/goproxytest/pseudo.go @@ -0,0 +1,21 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package goproxytest + +import ( + "regexp" + "strings" + + "github.com/rogpeppe/go-internal/semver" +) + +// This code was taken from cmd/go/internal/modfetch/pseudo.go + +var pseudoVersionRE = regexp.MustCompile(`^v[0-9]+\.(0\.0-|\d+\.\d+-([^+]*\.)?0\.)\d{14}-[A-Za-z0-9]+(\+incompatible)?$`) + +// isPseudoVersion reports whether v is a pseudo-version. +func isPseudoVersion(v string) bool { + return strings.Count(v, "-") >= 2 && semver.IsValid(v) && pseudoVersionRE.MatchString(v) +} diff --git a/vendor/github.com/rogpeppe/go-internal/gotooltest/setup.go b/vendor/github.com/rogpeppe/go-internal/gotooltest/setup.go new file mode 100644 index 000000000..5c598e0a7 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/gotooltest/setup.go @@ -0,0 +1,140 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package gotooltest implements functionality useful for testing +// tools that use the go command. +package gotooltest + +import ( + "fmt" + "os/exec" + "path/filepath" + "runtime" + "strings" + + "github.com/rogpeppe/go-internal/imports" + "github.com/rogpeppe/go-internal/testscript" +) + +type testContext struct { + goroot string + gocache string +} + +// Setup sets up the given test environment for tests that use the go +// command. It adds support for go tags to p.Condition and adds the go +// command to p.Cmds. It also wraps p.Setup to set up the environment +// variables for running the go command appropriately. +// +// It checks go command can run, but not that it can build or run +// binaries. +func Setup(p *testscript.Params) error { + var c testContext + if err := c.init(); err != nil { + return err + } + origSetup := p.Setup + p.Setup = func(e *testscript.Env) error { + e.Vars = c.goEnviron(e.Vars) + if origSetup != nil { + return origSetup(e) + } + return nil + } + if p.Cmds == nil { + p.Cmds = make(map[string]func(ts *testscript.TestScript, neg bool, args []string)) + } + p.Cmds["go"] = cmdGo + origCondition := p.Condition + p.Condition = func(cond string) (bool, error) { + switch cond { + case runtime.GOOS, runtime.GOARCH, runtime.Compiler: + return true, nil + default: + if imports.KnownArch[cond] || imports.KnownOS[cond] || cond == "gc" || cond == "gccgo" { + return false, nil + } + } + if origCondition == nil { + return false, fmt.Errorf("unknown condition %q", cond) + } + return origCondition(cond) + } + return nil +} + +func (c *testContext) init() error { + goEnv := func(name string) (string, error) { + out, err := exec.Command("go", "env", name).CombinedOutput() + if err != nil { + return "", fmt.Errorf("go env %s: %v (%s)", name, err, out) + } + return strings.TrimSpace(string(out)), nil + } + var err error + c.goroot, err = goEnv("GOROOT") + if err != nil { + return err + } + c.gocache, err = goEnv("GOCACHE") + if err != nil { + return err + } + return nil +} + +func (c *testContext) goEnviron(env0 []string) []string { + env := environ(env0) + workdir := env.get("WORK") + return append(env, []string{ + "GOPATH=" + filepath.Join(workdir, "gopath"), + "CCACHE_DISABLE=1", // ccache breaks with non-existent HOME + "GOARCH=" + runtime.GOARCH, + "GOOS=" + runtime.GOOS, + "GOROOT=" + c.goroot, + "GOCACHE=" + c.gocache, + }...) +} + +func cmdGo(ts *testscript.TestScript, neg bool, args []string) { + if len(args) < 1 { + ts.Fatalf("usage: go subcommand ...") + } + err := ts.Exec("go", args...) + if err != nil { + ts.Logf("[%v]\n", err) + if !neg { + ts.Fatalf("unexpected go command failure") + } + } else { + if neg { + ts.Fatalf("unexpected go command success") + } + } +} + +type environ []string + +func (e0 *environ) get(name string) string { + e := *e0 + for i := len(e) - 1; i >= 0; i-- { + v := e[i] + if len(v) <= len(name) { + continue + } + if strings.HasPrefix(v, name) && v[len(name)] == '=' { + return v[len(name)+1:] + } + } + return "" +} + +func (e *environ) set(name, val string) { + *e = append(*e, name+"="+val) +} + +func (e *environ) unset(name string) { + // TODO actually remove the name from the environment. + e.set(name, "") +} diff --git a/vendor/github.com/rogpeppe/go-internal/imports/build.go b/vendor/github.com/rogpeppe/go-internal/imports/build.go new file mode 100644 index 000000000..d1adf9440 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/imports/build.go @@ -0,0 +1,211 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Copied from Go distribution src/go/build/build.go, syslist.go + +package imports + +import ( + "bytes" + "strings" + "unicode" +) + +var slashslash = []byte("//") + +// ShouldBuild reports whether it is okay to use this file, +// The rule is that in the file's leading run of // comments +// and blank lines, which must be followed by a blank line +// (to avoid including a Go package clause doc comment), +// lines beginning with '// +build' are taken as build directives. +// +// The file is accepted only if each such line lists something +// matching the file. For example: +// +// // +build windows linux +// +// marks the file as applicable only on Windows and Linux. +// +// If tags["*"] is true, then ShouldBuild will consider every +// build tag except "ignore" to be both true and false for +// the purpose of satisfying build tags, in order to estimate +// (conservatively) whether a file could ever possibly be used +// in any build. +// +func ShouldBuild(content []byte, tags map[string]bool) bool { + // Pass 1. Identify leading run of // comments and blank lines, + // which must be followed by a blank line. + end := 0 + p := content + for len(p) > 0 { + line := p + if i := bytes.IndexByte(line, '\n'); i >= 0 { + line, p = line[:i], p[i+1:] + } else { + p = p[len(p):] + } + line = bytes.TrimSpace(line) + if len(line) == 0 { // Blank line + end = len(content) - len(p) + continue + } + if !bytes.HasPrefix(line, slashslash) { // Not comment line + break + } + } + content = content[:end] + + // Pass 2. Process each line in the run. + p = content + allok := true + for len(p) > 0 { + line := p + if i := bytes.IndexByte(line, '\n'); i >= 0 { + line, p = line[:i], p[i+1:] + } else { + p = p[len(p):] + } + line = bytes.TrimSpace(line) + if !bytes.HasPrefix(line, slashslash) { + continue + } + line = bytes.TrimSpace(line[len(slashslash):]) + if len(line) > 0 && line[0] == '+' { + // Looks like a comment +line. + f := strings.Fields(string(line)) + if f[0] == "+build" { + ok := false + for _, tok := range f[1:] { + if matchTags(tok, tags) { + ok = true + } + } + if !ok { + allok = false + } + } + } + } + + return allok +} + +// matchTags reports whether the name is one of: +// +// tag (if tags[tag] is true) +// !tag (if tags[tag] is false) +// a comma-separated list of any of these +// +func matchTags(name string, tags map[string]bool) bool { + if name == "" { + return false + } + if i := strings.Index(name, ","); i >= 0 { + // comma-separated list + ok1 := matchTags(name[:i], tags) + ok2 := matchTags(name[i+1:], tags) + return ok1 && ok2 + } + if strings.HasPrefix(name, "!!") { // bad syntax, reject always + return false + } + if strings.HasPrefix(name, "!") { // negation + return len(name) > 1 && matchTag(name[1:], tags, false) + } + return matchTag(name, tags, true) +} + +// matchTag reports whether the tag name is valid and satisfied by tags[name]==want. +func matchTag(name string, tags map[string]bool, want bool) bool { + // Tags must be letters, digits, underscores or dots. + // Unlike in Go identifiers, all digits are fine (e.g., "386"). + for _, c := range name { + if !unicode.IsLetter(c) && !unicode.IsDigit(c) && c != '_' && c != '.' { + return false + } + } + + if tags["*"] && name != "" && name != "ignore" { + // Special case for gathering all possible imports: + // if we put * in the tags map then all tags + // except "ignore" are considered both present and not + // (so we return true no matter how 'want' is set). + return true + } + + have := tags[name] + if name == "linux" { + have = have || tags["android"] + } + return have == want +} + +// MatchFile returns false if the name contains a $GOOS or $GOARCH +// suffix which does not match the current system. +// The recognized name formats are: +// +// name_$(GOOS).* +// name_$(GOARCH).* +// name_$(GOOS)_$(GOARCH).* +// name_$(GOOS)_test.* +// name_$(GOARCH)_test.* +// name_$(GOOS)_$(GOARCH)_test.* +// +// An exception: if GOOS=android, then files with GOOS=linux are also matched. +// +// If tags["*"] is true, then MatchFile will consider all possible +// GOOS and GOARCH to be available and will consequently +// always return true. +func MatchFile(name string, tags map[string]bool) bool { + if tags["*"] { + return true + } + if dot := strings.Index(name, "."); dot != -1 { + name = name[:dot] + } + + // Before Go 1.4, a file called "linux.go" would be equivalent to having a + // build tag "linux" in that file. For Go 1.4 and beyond, we require this + // auto-tagging to apply only to files with a non-empty prefix, so + // "foo_linux.go" is tagged but "linux.go" is not. This allows new operating + // systems, such as android, to arrive without breaking existing code with + // innocuous source code in "android.go". The easiest fix: cut everything + // in the name before the initial _. + i := strings.Index(name, "_") + if i < 0 { + return true + } + name = name[i:] // ignore everything before first _ + + l := strings.Split(name, "_") + if n := len(l); n > 0 && l[n-1] == "test" { + l = l[:n-1] + } + n := len(l) + if n >= 2 && KnownOS[l[n-2]] && KnownArch[l[n-1]] { + return tags[l[n-2]] && tags[l[n-1]] + } + if n >= 1 && KnownOS[l[n-1]] { + return tags[l[n-1]] + } + if n >= 1 && KnownArch[l[n-1]] { + return tags[l[n-1]] + } + return true +} + +var KnownOS = make(map[string]bool) +var KnownArch = make(map[string]bool) + +func init() { + for _, v := range strings.Fields(goosList) { + KnownOS[v] = true + } + for _, v := range strings.Fields(goarchList) { + KnownArch[v] = true + } +} + +const goosList = "android darwin dragonfly freebsd js linux nacl netbsd openbsd plan9 solaris windows zos " +const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc riscv riscv64 s390 s390x sparc sparc64 wasm " diff --git a/vendor/github.com/rogpeppe/go-internal/imports/read.go b/vendor/github.com/rogpeppe/go-internal/imports/read.go new file mode 100644 index 000000000..58c2abdc2 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/imports/read.go @@ -0,0 +1,249 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Copied from Go distribution src/go/build/read.go. + +package imports + +import ( + "bufio" + "errors" + "io" + "unicode/utf8" +) + +type importReader struct { + b *bufio.Reader + buf []byte + peek byte + err error + eof bool + nerr int +} + +func isIdent(c byte) bool { + return 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' || c == '_' || c >= utf8.RuneSelf +} + +var ( + errSyntax = errors.New("syntax error") + errNUL = errors.New("unexpected NUL in input") +) + +// syntaxError records a syntax error, but only if an I/O error has not already been recorded. +func (r *importReader) syntaxError() { + if r.err == nil { + r.err = errSyntax + } +} + +// readByte reads the next byte from the input, saves it in buf, and returns it. +// If an error occurs, readByte records the error in r.err and returns 0. +func (r *importReader) readByte() byte { + c, err := r.b.ReadByte() + if err == nil { + r.buf = append(r.buf, c) + if c == 0 { + err = errNUL + } + } + if err != nil { + if err == io.EOF { + r.eof = true + } else if r.err == nil { + r.err = err + } + c = 0 + } + return c +} + +// peekByte returns the next byte from the input reader but does not advance beyond it. +// If skipSpace is set, peekByte skips leading spaces and comments. +func (r *importReader) peekByte(skipSpace bool) byte { + if r.err != nil { + if r.nerr++; r.nerr > 10000 { + panic("go/build: import reader looping") + } + return 0 + } + + // Use r.peek as first input byte. + // Don't just return r.peek here: it might have been left by peekByte(false) + // and this might be peekByte(true). + c := r.peek + if c == 0 { + c = r.readByte() + } + for r.err == nil && !r.eof { + if skipSpace { + // For the purposes of this reader, semicolons are never necessary to + // understand the input and are treated as spaces. + switch c { + case ' ', '\f', '\t', '\r', '\n', ';': + c = r.readByte() + continue + + case '/': + c = r.readByte() + if c == '/' { + for c != '\n' && r.err == nil && !r.eof { + c = r.readByte() + } + } else if c == '*' { + var c1 byte + for (c != '*' || c1 != '/') && r.err == nil { + if r.eof { + r.syntaxError() + } + c, c1 = c1, r.readByte() + } + } else { + r.syntaxError() + } + c = r.readByte() + continue + } + } + break + } + r.peek = c + return r.peek +} + +// nextByte is like peekByte but advances beyond the returned byte. +func (r *importReader) nextByte(skipSpace bool) byte { + c := r.peekByte(skipSpace) + r.peek = 0 + return c +} + +// readKeyword reads the given keyword from the input. +// If the keyword is not present, readKeyword records a syntax error. +func (r *importReader) readKeyword(kw string) { + r.peekByte(true) + for i := 0; i < len(kw); i++ { + if r.nextByte(false) != kw[i] { + r.syntaxError() + return + } + } + if isIdent(r.peekByte(false)) { + r.syntaxError() + } +} + +// readIdent reads an identifier from the input. +// If an identifier is not present, readIdent records a syntax error. +func (r *importReader) readIdent() { + c := r.peekByte(true) + if !isIdent(c) { + r.syntaxError() + return + } + for isIdent(r.peekByte(false)) { + r.peek = 0 + } +} + +// readString reads a quoted string literal from the input. +// If an identifier is not present, readString records a syntax error. +func (r *importReader) readString(save *[]string) { + switch r.nextByte(true) { + case '`': + start := len(r.buf) - 1 + for r.err == nil { + if r.nextByte(false) == '`' { + if save != nil { + *save = append(*save, string(r.buf[start:])) + } + break + } + if r.eof { + r.syntaxError() + } + } + case '"': + start := len(r.buf) - 1 + for r.err == nil { + c := r.nextByte(false) + if c == '"' { + if save != nil { + *save = append(*save, string(r.buf[start:])) + } + break + } + if r.eof || c == '\n' { + r.syntaxError() + } + if c == '\\' { + r.nextByte(false) + } + } + default: + r.syntaxError() + } +} + +// readImport reads an import clause - optional identifier followed by quoted string - +// from the input. +func (r *importReader) readImport(imports *[]string) { + c := r.peekByte(true) + if c == '.' { + r.peek = 0 + } else if isIdent(c) { + r.readIdent() + } + r.readString(imports) +} + +// ReadComments is like ioutil.ReadAll, except that it only reads the leading +// block of comments in the file. +func ReadComments(f io.Reader) ([]byte, error) { + r := &importReader{b: bufio.NewReader(f)} + r.peekByte(true) + if r.err == nil && !r.eof { + // Didn't reach EOF, so must have found a non-space byte. Remove it. + r.buf = r.buf[:len(r.buf)-1] + } + return r.buf, r.err +} + +// ReadImports is like ioutil.ReadAll, except that it expects a Go file as input +// and stops reading the input once the imports have completed. +func ReadImports(f io.Reader, reportSyntaxError bool, imports *[]string) ([]byte, error) { + r := &importReader{b: bufio.NewReader(f)} + + r.readKeyword("package") + r.readIdent() + for r.peekByte(true) == 'i' { + r.readKeyword("import") + if r.peekByte(true) == '(' { + r.nextByte(false) + for r.peekByte(true) != ')' && r.err == nil { + r.readImport(imports) + } + r.nextByte(false) + } else { + r.readImport(imports) + } + } + + // If we stopped successfully before EOF, we read a byte that told us we were done. + // Return all but that last byte, which would cause a syntax error if we let it through. + if r.err == nil && !r.eof { + return r.buf[:len(r.buf)-1], nil + } + + // If we stopped for a syntax error, consume the whole file so that + // we are sure we don't change the errors that go/parser returns. + if r.err == errSyntax && !reportSyntaxError { + r.err = nil + for r.err == nil && !r.eof { + r.readByte() + } + } + + return r.buf, r.err +} diff --git a/vendor/github.com/rogpeppe/go-internal/imports/read_test.go b/vendor/github.com/rogpeppe/go-internal/imports/read_test.go new file mode 100644 index 000000000..6ea356f1f --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/imports/read_test.go @@ -0,0 +1,228 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Copied from Go distribution src/go/build/read.go. + +package imports + +import ( + "io" + "strings" + "testing" +) + +const quote = "`" + +type readTest struct { + // Test input contains ℙ where readImports should stop. + in string + err string +} + +var readImportsTests = []readTest{ + { + `package p`, + "", + }, + { + `package p; import "x"`, + "", + }, + { + `package p; import . "x"`, + "", + }, + { + `package p; import "x";ℙvar x = 1`, + "", + }, + { + `package p + + // comment + + import "x" + import _ "x" + import a "x" + + /* comment */ + + import ( + "x" /* comment */ + _ "x" + a "x" // comment + ` + quote + `x` + quote + ` + _ /*comment*/ ` + quote + `x` + quote + ` + a ` + quote + `x` + quote + ` + ) + import ( + ) + import () + import()import()import() + import();import();import() + + ℙvar x = 1 + `, + "", + }, +} + +var readCommentsTests = []readTest{ + { + `ℙpackage p`, + "", + }, + { + `ℙpackage p; import "x"`, + "", + }, + { + `ℙpackage p; import . "x"`, + "", + }, + { + `// foo + + /* bar */ + + /* quux */ // baz + + /*/ zot */ + + // asdf + ℙHello, world`, + "", + }, +} + +func testRead(t *testing.T, tests []readTest, read func(io.Reader) ([]byte, error)) { + for i, tt := range tests { + var in, testOut string + j := strings.Index(tt.in, "ℙ") + if j < 0 { + in = tt.in + testOut = tt.in + } else { + in = tt.in[:j] + tt.in[j+len("ℙ"):] + testOut = tt.in[:j] + } + r := strings.NewReader(in) + buf, err := read(r) + if err != nil { + if tt.err == "" { + t.Errorf("#%d: err=%q, expected success (%q)", i, err, string(buf)) + continue + } + if !strings.Contains(err.Error(), tt.err) { + t.Errorf("#%d: err=%q, expected %q", i, err, tt.err) + continue + } + continue + } + if err == nil && tt.err != "" { + t.Errorf("#%d: success, expected %q", i, tt.err) + continue + } + + out := string(buf) + if out != testOut { + t.Errorf("#%d: wrong output:\nhave %q\nwant %q\n", i, out, testOut) + } + } +} + +func TestReadImports(t *testing.T) { + testRead(t, readImportsTests, func(r io.Reader) ([]byte, error) { return ReadImports(r, true, nil) }) +} + +func TestReadComments(t *testing.T) { + testRead(t, readCommentsTests, ReadComments) +} + +var readFailuresTests = []readTest{ + { + `package`, + "syntax error", + }, + { + "package p\n\x00\nimport `math`\n", + "unexpected NUL in input", + }, + { + `package p; import`, + "syntax error", + }, + { + `package p; import "`, + "syntax error", + }, + { + "package p; import ` \n\n", + "syntax error", + }, + { + `package p; import "x`, + "syntax error", + }, + { + `package p; import _`, + "syntax error", + }, + { + `package p; import _ "`, + "syntax error", + }, + { + `package p; import _ "x`, + "syntax error", + }, + { + `package p; import .`, + "syntax error", + }, + { + `package p; import . "`, + "syntax error", + }, + { + `package p; import . "x`, + "syntax error", + }, + { + `package p; import (`, + "syntax error", + }, + { + `package p; import ("`, + "syntax error", + }, + { + `package p; import ("x`, + "syntax error", + }, + { + `package p; import ("x"`, + "syntax error", + }, +} + +func TestReadFailures(t *testing.T) { + // Errors should be reported (true arg to readImports). + testRead(t, readFailuresTests, func(r io.Reader) ([]byte, error) { return ReadImports(r, true, nil) }) +} + +func TestReadFailuresIgnored(t *testing.T) { + // Syntax errors should not be reported (false arg to readImports). + // Instead, entire file should be the output and no error. + // Convert tests not to return syntax errors. + tests := make([]readTest, len(readFailuresTests)) + copy(tests, readFailuresTests) + for i := range tests { + tt := &tests[i] + if !strings.Contains(tt.err, "NUL") { + tt.err = "" + } + } + testRead(t, tests, func(r io.Reader) ([]byte, error) { return ReadImports(r, false, nil) }) +} diff --git a/vendor/github.com/rogpeppe/go-internal/imports/scan.go b/vendor/github.com/rogpeppe/go-internal/imports/scan.go new file mode 100644 index 000000000..d944e9572 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/imports/scan.go @@ -0,0 +1,96 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package imports + +import ( + "fmt" + "io/ioutil" + "os" + "path/filepath" + "sort" + "strconv" + "strings" +) + +func ScanDir(dir string, tags map[string]bool) ([]string, []string, error) { + infos, err := ioutil.ReadDir(dir) + if err != nil { + return nil, nil, err + } + var files []string + for _, info := range infos { + name := info.Name() + if info.Mode().IsRegular() && !strings.HasPrefix(name, "_") && strings.HasSuffix(name, ".go") && MatchFile(name, tags) { + files = append(files, filepath.Join(dir, name)) + } + } + return scanFiles(files, tags, false) +} + +func ScanFiles(files []string, tags map[string]bool) ([]string, []string, error) { + return scanFiles(files, tags, true) +} + +func scanFiles(files []string, tags map[string]bool, explicitFiles bool) ([]string, []string, error) { + imports := make(map[string]bool) + testImports := make(map[string]bool) + numFiles := 0 +Files: + for _, name := range files { + r, err := os.Open(name) + if err != nil { + return nil, nil, err + } + var list []string + data, err := ReadImports(r, false, &list) + r.Close() + if err != nil { + return nil, nil, fmt.Errorf("reading %s: %v", name, err) + } + + // import "C" is implicit requirement of cgo tag. + // When listing files on the command line (explicitFiles=true) + // we do not apply build tag filtering but we still do apply + // cgo filtering, so no explicitFiles check here. + // Why? Because we always have, and it's not worth breaking + // that behavior now. + for _, path := range list { + if path == `"C"` && !tags["cgo"] && !tags["*"] { + continue Files + } + } + + if !explicitFiles && !ShouldBuild(data, tags) { + continue + } + numFiles++ + m := imports + if strings.HasSuffix(name, "_test.go") { + m = testImports + } + for _, p := range list { + q, err := strconv.Unquote(p) + if err != nil { + continue + } + m[q] = true + } + } + if numFiles == 0 { + return nil, nil, ErrNoGo + } + return keys(imports), keys(testImports), nil +} + +var ErrNoGo = fmt.Errorf("no Go source files") + +func keys(m map[string]bool) []string { + var list []string + for k := range m { + list = append(list, k) + } + sort.Strings(list) + return list +} diff --git a/vendor/github.com/rogpeppe/go-internal/imports/scan_test.go b/vendor/github.com/rogpeppe/go-internal/imports/scan_test.go new file mode 100644 index 000000000..253bce1aa --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/imports/scan_test.go @@ -0,0 +1,68 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package imports + +import ( + "path/filepath" + "reflect" + "runtime" + "testing" + + "github.com/rogpeppe/go-internal/testenv" +) + +func TestScan(t *testing.T) { + testenv.MustHaveGoBuild(t) + + imports, testImports, err := ScanDir(filepath.Join(runtime.GOROOT(), "src/encoding/json"), nil) + if err != nil { + t.Fatal(err) + } + foundBase64 := false + for _, p := range imports { + if p == "encoding/base64" { + foundBase64 = true + } + if p == "encoding/binary" { + // A dependency but not an import + t.Errorf("json reported as importing encoding/binary but does not") + } + if p == "net/http" { + // A test import but not an import + t.Errorf("json reported as importing encoding/binary but does not") + } + } + if !foundBase64 { + t.Errorf("json missing import encoding/base64 (%q)", imports) + } + + foundHTTP := false + for _, p := range testImports { + if p == "net/http" { + foundHTTP = true + } + if p == "unicode/utf16" { + // A package import but not a test import + t.Errorf("json reported as test-importing unicode/utf16 but does not") + } + } + if !foundHTTP { + t.Errorf("json missing test import net/http (%q)", testImports) + } +} + +func TestScanStar(t *testing.T) { + testenv.MustHaveGoBuild(t) + + imports, _, err := ScanDir("testdata/import1", map[string]bool{"*": true}) + if err != nil { + t.Fatal(err) + } + + want := []string{"import1", "import2", "import3", "import4"} + if !reflect.DeepEqual(imports, want) { + t.Errorf("ScanDir testdata/import1:\nhave %v\nwant %v", imports, want) + } +} diff --git a/vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x.go b/vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x.go new file mode 100644 index 000000000..98f919105 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x.go @@ -0,0 +1,3 @@ +package x + +import "import1" diff --git a/vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x1.go b/vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x1.go new file mode 100644 index 000000000..6a9594aed --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x1.go @@ -0,0 +1,9 @@ +// +build blahblh +// +build linux +// +build !linux +// +build windows +// +build darwin + +package x + +import "import4" diff --git a/vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x_darwin.go b/vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x_darwin.go new file mode 100644 index 000000000..a0c3fdd21 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x_darwin.go @@ -0,0 +1,3 @@ +package xxxx + +import "import3" diff --git a/vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x_windows.go b/vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x_windows.go new file mode 100644 index 000000000..63c508248 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/imports/testdata/import1/x_windows.go @@ -0,0 +1,3 @@ +package x + +import "import2" diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/gopkgin.go b/vendor/github.com/rogpeppe/go-internal/modfile/gopkgin.go new file mode 100644 index 000000000..c94b3848a --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/gopkgin.go @@ -0,0 +1,47 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// TODO: Figure out what gopkg.in should do. + +package modfile + +import "strings" + +// ParseGopkgIn splits gopkg.in import paths into their constituent parts +func ParseGopkgIn(path string) (root, repo, major, subdir string, ok bool) { + if !strings.HasPrefix(path, "gopkg.in/") { + return + } + f := strings.Split(path, "/") + if len(f) >= 2 { + if elem, v, ok := dotV(f[1]); ok { + root = strings.Join(f[:2], "/") + repo = "github.com/go-" + elem + "/" + elem + major = v + subdir = strings.Join(f[2:], "/") + return root, repo, major, subdir, true + } + } + if len(f) >= 3 { + if elem, v, ok := dotV(f[2]); ok { + root = strings.Join(f[:3], "/") + repo = "github.com/" + f[1] + "/" + elem + major = v + subdir = strings.Join(f[3:], "/") + return root, repo, major, subdir, true + } + } + return +} + +func dotV(name string) (elem, v string, ok bool) { + i := len(name) - 1 + for i >= 0 && '0' <= name[i] && name[i] <= '9' { + i-- + } + if i <= 2 || i+1 >= len(name) || name[i-1] != '.' || name[i] != 'v' || name[i+1] == '0' && len(name) != i+2 { + return "", "", false + } + return name[:i-1], name[i:], true +} diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/print.go b/vendor/github.com/rogpeppe/go-internal/modfile/print.go new file mode 100644 index 000000000..7b1dd8f95 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/print.go @@ -0,0 +1,164 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package modfile implements parsing and formatting for +// go.mod files. +package modfile + +import ( + "bytes" + "fmt" + "strings" +) + +func Format(f *FileSyntax) []byte { + pr := &printer{} + pr.file(f) + return pr.Bytes() +} + +// A printer collects the state during printing of a file or expression. +type printer struct { + bytes.Buffer // output buffer + comment []Comment // pending end-of-line comments + margin int // left margin (indent), a number of tabs +} + +// printf prints to the buffer. +func (p *printer) printf(format string, args ...interface{}) { + fmt.Fprintf(p, format, args...) +} + +// indent returns the position on the current line, in bytes, 0-indexed. +func (p *printer) indent() int { + b := p.Bytes() + n := 0 + for n < len(b) && b[len(b)-1-n] != '\n' { + n++ + } + return n +} + +// newline ends the current line, flushing end-of-line comments. +func (p *printer) newline() { + if len(p.comment) > 0 { + p.printf(" ") + for i, com := range p.comment { + if i > 0 { + p.trim() + p.printf("\n") + for i := 0; i < p.margin; i++ { + p.printf("\t") + } + } + p.printf("%s", strings.TrimSpace(com.Token)) + } + p.comment = p.comment[:0] + } + + p.trim() + p.printf("\n") + for i := 0; i < p.margin; i++ { + p.printf("\t") + } +} + +// trim removes trailing spaces and tabs from the current line. +func (p *printer) trim() { + // Remove trailing spaces and tabs from line we're about to end. + b := p.Bytes() + n := len(b) + for n > 0 && (b[n-1] == '\t' || b[n-1] == ' ') { + n-- + } + p.Truncate(n) +} + +// file formats the given file into the print buffer. +func (p *printer) file(f *FileSyntax) { + for _, com := range f.Before { + p.printf("%s", strings.TrimSpace(com.Token)) + p.newline() + } + + for i, stmt := range f.Stmt { + switch x := stmt.(type) { + case *CommentBlock: + // comments already handled + p.expr(x) + + default: + p.expr(x) + p.newline() + } + + for _, com := range stmt.Comment().After { + p.printf("%s", strings.TrimSpace(com.Token)) + p.newline() + } + + if i+1 < len(f.Stmt) { + p.newline() + } + } +} + +func (p *printer) expr(x Expr) { + // Emit line-comments preceding this expression. + if before := x.Comment().Before; len(before) > 0 { + // Want to print a line comment. + // Line comments must be at the current margin. + p.trim() + if p.indent() > 0 { + // There's other text on the line. Start a new line. + p.printf("\n") + } + // Re-indent to margin. + for i := 0; i < p.margin; i++ { + p.printf("\t") + } + for _, com := range before { + p.printf("%s", strings.TrimSpace(com.Token)) + p.newline() + } + } + + switch x := x.(type) { + default: + panic(fmt.Errorf("printer: unexpected type %T", x)) + + case *CommentBlock: + // done + + case *LParen: + p.printf("(") + case *RParen: + p.printf(")") + + case *Line: + sep := "" + for _, tok := range x.Token { + p.printf("%s%s", sep, tok) + sep = " " + } + + case *LineBlock: + for _, tok := range x.Token { + p.printf("%s ", tok) + } + p.expr(&x.LParen) + p.margin++ + for _, l := range x.Line { + p.newline() + p.expr(l) + } + p.margin-- + p.newline() + p.expr(&x.RParen) + } + + // Queue end-of-line comments for printing when we + // reach the end of the line. + p.comment = append(p.comment, x.Comment().Suffix...) +} diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/read.go b/vendor/github.com/rogpeppe/go-internal/modfile/read.go new file mode 100644 index 000000000..1d81ff1ab --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/read.go @@ -0,0 +1,869 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Module file parser. +// This is a simplified copy of Google's buildifier parser. + +package modfile + +import ( + "bytes" + "fmt" + "os" + "strconv" + "strings" + "unicode" + "unicode/utf8" +) + +// A Position describes the position between two bytes of input. +type Position struct { + Line int // line in input (starting at 1) + LineRune int // rune in line (starting at 1) + Byte int // byte in input (starting at 0) +} + +// add returns the position at the end of s, assuming it starts at p. +func (p Position) add(s string) Position { + p.Byte += len(s) + if n := strings.Count(s, "\n"); n > 0 { + p.Line += n + s = s[strings.LastIndex(s, "\n")+1:] + p.LineRune = 1 + } + p.LineRune += utf8.RuneCountInString(s) + return p +} + +// An Expr represents an input element. +type Expr interface { + // Span returns the start and end position of the expression, + // excluding leading or trailing comments. + Span() (start, end Position) + + // Comment returns the comments attached to the expression. + // This method would normally be named 'Comments' but that + // would interfere with embedding a type of the same name. + Comment() *Comments +} + +// A Comment represents a single // comment. +type Comment struct { + Start Position + Token string // without trailing newline + Suffix bool // an end of line (not whole line) comment +} + +// Comments collects the comments associated with an expression. +type Comments struct { + Before []Comment // whole-line comments before this expression + Suffix []Comment // end-of-line comments after this expression + + // For top-level expressions only, After lists whole-line + // comments following the expression. + After []Comment +} + +// Comment returns the receiver. This isn't useful by itself, but +// a Comments struct is embedded into all the expression +// implementation types, and this gives each of those a Comment +// method to satisfy the Expr interface. +func (c *Comments) Comment() *Comments { + return c +} + +// A FileSyntax represents an entire go.mod file. +type FileSyntax struct { + Name string // file path + Comments + Stmt []Expr +} + +func (x *FileSyntax) Span() (start, end Position) { + if len(x.Stmt) == 0 { + return + } + start, _ = x.Stmt[0].Span() + _, end = x.Stmt[len(x.Stmt)-1].Span() + return start, end +} + +func (x *FileSyntax) addLine(hint Expr, tokens ...string) *Line { + if hint == nil { + // If no hint given, add to the last statement of the given type. + Loop: + for i := len(x.Stmt) - 1; i >= 0; i-- { + stmt := x.Stmt[i] + switch stmt := stmt.(type) { + case *Line: + if stmt.Token != nil && stmt.Token[0] == tokens[0] { + hint = stmt + break Loop + } + case *LineBlock: + if stmt.Token[0] == tokens[0] { + hint = stmt + break Loop + } + } + } + } + + if hint != nil { + for i, stmt := range x.Stmt { + switch stmt := stmt.(type) { + case *Line: + if stmt == hint { + // Convert line to line block. + stmt.InBlock = true + block := &LineBlock{Token: stmt.Token[:1], Line: []*Line{stmt}} + stmt.Token = stmt.Token[1:] + x.Stmt[i] = block + new := &Line{Token: tokens[1:], InBlock: true} + block.Line = append(block.Line, new) + return new + } + case *LineBlock: + if stmt == hint { + new := &Line{Token: tokens[1:], InBlock: true} + stmt.Line = append(stmt.Line, new) + return new + } + for j, line := range stmt.Line { + if line == hint { + // Add new line after hint. + stmt.Line = append(stmt.Line, nil) + copy(stmt.Line[j+2:], stmt.Line[j+1:]) + new := &Line{Token: tokens[1:], InBlock: true} + stmt.Line[j+1] = new + return new + } + } + } + } + } + + new := &Line{Token: tokens} + x.Stmt = append(x.Stmt, new) + return new +} + +func (x *FileSyntax) updateLine(line *Line, tokens ...string) { + if line.InBlock { + tokens = tokens[1:] + } + line.Token = tokens +} + +func (x *FileSyntax) removeLine(line *Line) { + line.Token = nil +} + +// Cleanup cleans up the file syntax x after any edit operations. +// To avoid quadratic behavior, removeLine marks the line as dead +// by setting line.Token = nil but does not remove it from the slice +// in which it appears. After edits have all been indicated, +// calling Cleanup cleans out the dead lines. +func (x *FileSyntax) Cleanup() { + w := 0 + for _, stmt := range x.Stmt { + switch stmt := stmt.(type) { + case *Line: + if stmt.Token == nil { + continue + } + case *LineBlock: + ww := 0 + for _, line := range stmt.Line { + if line.Token != nil { + stmt.Line[ww] = line + ww++ + } + } + if ww == 0 { + continue + } + if ww == 1 { + // Collapse block into single line. + line := &Line{ + Comments: Comments{ + Before: commentsAdd(stmt.Before, stmt.Line[0].Before), + Suffix: commentsAdd(stmt.Line[0].Suffix, stmt.Suffix), + After: commentsAdd(stmt.Line[0].After, stmt.After), + }, + Token: stringsAdd(stmt.Token, stmt.Line[0].Token), + } + x.Stmt[w] = line + w++ + continue + } + stmt.Line = stmt.Line[:ww] + } + x.Stmt[w] = stmt + w++ + } + x.Stmt = x.Stmt[:w] +} + +func commentsAdd(x, y []Comment) []Comment { + return append(x[:len(x):len(x)], y...) +} + +func stringsAdd(x, y []string) []string { + return append(x[:len(x):len(x)], y...) +} + +// A CommentBlock represents a top-level block of comments separate +// from any rule. +type CommentBlock struct { + Comments + Start Position +} + +func (x *CommentBlock) Span() (start, end Position) { + return x.Start, x.Start +} + +// A Line is a single line of tokens. +type Line struct { + Comments + Start Position + Token []string + InBlock bool + End Position +} + +func (x *Line) Span() (start, end Position) { + return x.Start, x.End +} + +// A LineBlock is a factored block of lines, like +// +// require ( +// "x" +// "y" +// ) +// +type LineBlock struct { + Comments + Start Position + LParen LParen + Token []string + Line []*Line + RParen RParen +} + +func (x *LineBlock) Span() (start, end Position) { + return x.Start, x.RParen.Pos.add(")") +} + +// An LParen represents the beginning of a parenthesized line block. +// It is a place to store suffix comments. +type LParen struct { + Comments + Pos Position +} + +func (x *LParen) Span() (start, end Position) { + return x.Pos, x.Pos.add(")") +} + +// An RParen represents the end of a parenthesized line block. +// It is a place to store whole-line (before) comments. +type RParen struct { + Comments + Pos Position +} + +func (x *RParen) Span() (start, end Position) { + return x.Pos, x.Pos.add(")") +} + +// An input represents a single input file being parsed. +type input struct { + // Lexing state. + filename string // name of input file, for errors + complete []byte // entire input + remaining []byte // remaining input + token []byte // token being scanned + lastToken string // most recently returned token, for error messages + pos Position // current input position + comments []Comment // accumulated comments + endRule int // position of end of current rule + + // Parser state. + file *FileSyntax // returned top-level syntax tree + parseError error // error encountered during parsing + + // Comment assignment state. + pre []Expr // all expressions, in preorder traversal + post []Expr // all expressions, in postorder traversal +} + +func newInput(filename string, data []byte) *input { + return &input{ + filename: filename, + complete: data, + remaining: data, + pos: Position{Line: 1, LineRune: 1, Byte: 0}, + } +} + +// parse parses the input file. +func parse(file string, data []byte) (f *FileSyntax, err error) { + in := newInput(file, data) + // The parser panics for both routine errors like syntax errors + // and for programmer bugs like array index errors. + // Turn both into error returns. Catching bug panics is + // especially important when processing many files. + defer func() { + if e := recover(); e != nil { + if e == in.parseError { + err = in.parseError + } else { + err = fmt.Errorf("%s:%d:%d: internal error: %v", in.filename, in.pos.Line, in.pos.LineRune, e) + } + } + }() + + // Invoke the parser. + in.parseFile() + if in.parseError != nil { + return nil, in.parseError + } + in.file.Name = in.filename + + // Assign comments to nearby syntax. + in.assignComments() + + return in.file, nil +} + +// Error is called to report an error. +// The reason s is often "syntax error". +// Error does not return: it panics. +func (in *input) Error(s string) { + if s == "syntax error" && in.lastToken != "" { + s += " near " + in.lastToken + } + in.parseError = fmt.Errorf("%s:%d:%d: %v", in.filename, in.pos.Line, in.pos.LineRune, s) + panic(in.parseError) +} + +// eof reports whether the input has reached end of file. +func (in *input) eof() bool { + return len(in.remaining) == 0 +} + +// peekRune returns the next rune in the input without consuming it. +func (in *input) peekRune() int { + if len(in.remaining) == 0 { + return 0 + } + r, _ := utf8.DecodeRune(in.remaining) + return int(r) +} + +// peekPrefix reports whether the remaining input begins with the given prefix. +func (in *input) peekPrefix(prefix string) bool { + // This is like bytes.HasPrefix(in.remaining, []byte(prefix)) + // but without the allocation of the []byte copy of prefix. + for i := 0; i < len(prefix); i++ { + if i >= len(in.remaining) || in.remaining[i] != prefix[i] { + return false + } + } + return true +} + +// readRune consumes and returns the next rune in the input. +func (in *input) readRune() int { + if len(in.remaining) == 0 { + in.Error("internal lexer error: readRune at EOF") + } + r, size := utf8.DecodeRune(in.remaining) + in.remaining = in.remaining[size:] + if r == '\n' { + in.pos.Line++ + in.pos.LineRune = 1 + } else { + in.pos.LineRune++ + } + in.pos.Byte += size + return int(r) +} + +type symType struct { + pos Position + endPos Position + text string +} + +// startToken marks the beginning of the next input token. +// It must be followed by a call to endToken, once the token has +// been consumed using readRune. +func (in *input) startToken(sym *symType) { + in.token = in.remaining + sym.text = "" + sym.pos = in.pos +} + +// endToken marks the end of an input token. +// It records the actual token string in sym.text if the caller +// has not done that already. +func (in *input) endToken(sym *symType) { + if sym.text == "" { + tok := string(in.token[:len(in.token)-len(in.remaining)]) + sym.text = tok + in.lastToken = sym.text + } + sym.endPos = in.pos +} + +// lex is called from the parser to obtain the next input token. +// It returns the token value (either a rune like '+' or a symbolic token _FOR) +// and sets val to the data associated with the token. +// For all our input tokens, the associated data is +// val.Pos (the position where the token begins) +// and val.Token (the input string corresponding to the token). +func (in *input) lex(sym *symType) int { + // Skip past spaces, stopping at non-space or EOF. + countNL := 0 // number of newlines we've skipped past + for !in.eof() { + // Skip over spaces. Count newlines so we can give the parser + // information about where top-level blank lines are, + // for top-level comment assignment. + c := in.peekRune() + if c == ' ' || c == '\t' || c == '\r' { + in.readRune() + continue + } + + // Comment runs to end of line. + if in.peekPrefix("//") { + in.startToken(sym) + + // Is this comment the only thing on its line? + // Find the last \n before this // and see if it's all + // spaces from there to here. + i := bytes.LastIndex(in.complete[:in.pos.Byte], []byte("\n")) + suffix := len(bytes.TrimSpace(in.complete[i+1:in.pos.Byte])) > 0 + in.readRune() + in.readRune() + + // Consume comment. + for len(in.remaining) > 0 && in.readRune() != '\n' { + } + in.endToken(sym) + + sym.text = strings.TrimRight(sym.text, "\n") + in.lastToken = "comment" + + // If we are at top level (not in a statement), hand the comment to + // the parser as a _COMMENT token. The grammar is written + // to handle top-level comments itself. + if !suffix { + // Not in a statement. Tell parser about top-level comment. + return _COMMENT + } + + // Otherwise, save comment for later attachment to syntax tree. + if countNL > 1 { + in.comments = append(in.comments, Comment{sym.pos, "", false}) + } + in.comments = append(in.comments, Comment{sym.pos, sym.text, suffix}) + countNL = 1 + return _EOL + } + + if in.peekPrefix("/*") { + in.Error(fmt.Sprintf("mod files must use // comments (not /* */ comments)")) + } + + // Found non-space non-comment. + break + } + + // Found the beginning of the next token. + in.startToken(sym) + defer in.endToken(sym) + + // End of file. + if in.eof() { + in.lastToken = "EOF" + return _EOF + } + + // Punctuation tokens. + switch c := in.peekRune(); c { + case '\n': + in.readRune() + return c + + case '(': + in.readRune() + return c + + case ')': + in.readRune() + return c + + case '"', '`': // quoted string + quote := c + in.readRune() + for { + if in.eof() { + in.pos = sym.pos + in.Error("unexpected EOF in string") + } + if in.peekRune() == '\n' { + in.Error("unexpected newline in string") + } + c := in.readRune() + if c == quote { + break + } + if c == '\\' && quote != '`' { + if in.eof() { + in.pos = sym.pos + in.Error("unexpected EOF in string") + } + in.readRune() + } + } + in.endToken(sym) + return _STRING + } + + // Checked all punctuation. Must be identifier token. + if c := in.peekRune(); !isIdent(c) { + in.Error(fmt.Sprintf("unexpected input character %#q", c)) + } + + // Scan over identifier. + for isIdent(in.peekRune()) { + if in.peekPrefix("//") { + break + } + if in.peekPrefix("/*") { + in.Error(fmt.Sprintf("mod files must use // comments (not /* */ comments)")) + } + in.readRune() + } + return _IDENT +} + +// isIdent reports whether c is an identifier rune. +// We treat nearly all runes as identifier runes. +func isIdent(c int) bool { + return c != 0 && !unicode.IsSpace(rune(c)) +} + +// Comment assignment. +// We build two lists of all subexpressions, preorder and postorder. +// The preorder list is ordered by start location, with outer expressions first. +// The postorder list is ordered by end location, with outer expressions last. +// We use the preorder list to assign each whole-line comment to the syntax +// immediately following it, and we use the postorder list to assign each +// end-of-line comment to the syntax immediately preceding it. + +// order walks the expression adding it and its subexpressions to the +// preorder and postorder lists. +func (in *input) order(x Expr) { + if x != nil { + in.pre = append(in.pre, x) + } + switch x := x.(type) { + default: + panic(fmt.Errorf("order: unexpected type %T", x)) + case nil: + // nothing + case *LParen, *RParen: + // nothing + case *CommentBlock: + // nothing + case *Line: + // nothing + case *FileSyntax: + for _, stmt := range x.Stmt { + in.order(stmt) + } + case *LineBlock: + in.order(&x.LParen) + for _, l := range x.Line { + in.order(l) + } + in.order(&x.RParen) + } + if x != nil { + in.post = append(in.post, x) + } +} + +// assignComments attaches comments to nearby syntax. +func (in *input) assignComments() { + const debug = false + + // Generate preorder and postorder lists. + in.order(in.file) + + // Split into whole-line comments and suffix comments. + var line, suffix []Comment + for _, com := range in.comments { + if com.Suffix { + suffix = append(suffix, com) + } else { + line = append(line, com) + } + } + + if debug { + for _, c := range line { + fmt.Fprintf(os.Stderr, "LINE %q :%d:%d #%d\n", c.Token, c.Start.Line, c.Start.LineRune, c.Start.Byte) + } + } + + // Assign line comments to syntax immediately following. + for _, x := range in.pre { + start, _ := x.Span() + if debug { + fmt.Printf("pre %T :%d:%d #%d\n", x, start.Line, start.LineRune, start.Byte) + } + xcom := x.Comment() + for len(line) > 0 && start.Byte >= line[0].Start.Byte { + if debug { + fmt.Fprintf(os.Stderr, "ASSIGN LINE %q #%d\n", line[0].Token, line[0].Start.Byte) + } + xcom.Before = append(xcom.Before, line[0]) + line = line[1:] + } + } + + // Remaining line comments go at end of file. + in.file.After = append(in.file.After, line...) + + if debug { + for _, c := range suffix { + fmt.Fprintf(os.Stderr, "SUFFIX %q :%d:%d #%d\n", c.Token, c.Start.Line, c.Start.LineRune, c.Start.Byte) + } + } + + // Assign suffix comments to syntax immediately before. + for i := len(in.post) - 1; i >= 0; i-- { + x := in.post[i] + + start, end := x.Span() + if debug { + fmt.Printf("post %T :%d:%d #%d :%d:%d #%d\n", x, start.Line, start.LineRune, start.Byte, end.Line, end.LineRune, end.Byte) + } + + // Do not assign suffix comments to end of line block or whole file. + // Instead assign them to the last element inside. + switch x.(type) { + case *FileSyntax: + continue + } + + // Do not assign suffix comments to something that starts + // on an earlier line, so that in + // + // x ( y + // z ) // comment + // + // we assign the comment to z and not to x ( ... ). + if start.Line != end.Line { + continue + } + xcom := x.Comment() + for len(suffix) > 0 && end.Byte <= suffix[len(suffix)-1].Start.Byte { + if debug { + fmt.Fprintf(os.Stderr, "ASSIGN SUFFIX %q #%d\n", suffix[len(suffix)-1].Token, suffix[len(suffix)-1].Start.Byte) + } + xcom.Suffix = append(xcom.Suffix, suffix[len(suffix)-1]) + suffix = suffix[:len(suffix)-1] + } + } + + // We assigned suffix comments in reverse. + // If multiple suffix comments were appended to the same + // expression node, they are now in reverse. Fix that. + for _, x := range in.post { + reverseComments(x.Comment().Suffix) + } + + // Remaining suffix comments go at beginning of file. + in.file.Before = append(in.file.Before, suffix...) +} + +// reverseComments reverses the []Comment list. +func reverseComments(list []Comment) { + for i, j := 0, len(list)-1; i < j; i, j = i+1, j-1 { + list[i], list[j] = list[j], list[i] + } +} + +func (in *input) parseFile() { + in.file = new(FileSyntax) + var sym symType + var cb *CommentBlock + for { + tok := in.lex(&sym) + switch tok { + case '\n': + if cb != nil { + in.file.Stmt = append(in.file.Stmt, cb) + cb = nil + } + case _COMMENT: + if cb == nil { + cb = &CommentBlock{Start: sym.pos} + } + com := cb.Comment() + com.Before = append(com.Before, Comment{Start: sym.pos, Token: sym.text}) + case _EOF: + if cb != nil { + in.file.Stmt = append(in.file.Stmt, cb) + } + return + default: + in.parseStmt(&sym) + if cb != nil { + in.file.Stmt[len(in.file.Stmt)-1].Comment().Before = cb.Before + cb = nil + } + } + } +} + +func (in *input) parseStmt(sym *symType) { + start := sym.pos + end := sym.endPos + token := []string{sym.text} + for { + tok := in.lex(sym) + switch tok { + case '\n', _EOF, _EOL: + in.file.Stmt = append(in.file.Stmt, &Line{ + Start: start, + Token: token, + End: end, + }) + return + case '(': + in.file.Stmt = append(in.file.Stmt, in.parseLineBlock(start, token, sym)) + return + default: + token = append(token, sym.text) + end = sym.endPos + } + } +} + +func (in *input) parseLineBlock(start Position, token []string, sym *symType) *LineBlock { + x := &LineBlock{ + Start: start, + Token: token, + LParen: LParen{Pos: sym.pos}, + } + var comments []Comment + for { + tok := in.lex(sym) + switch tok { + case _EOL: + // ignore + case '\n': + if len(comments) == 0 && len(x.Line) > 0 || len(comments) > 0 && comments[len(comments)-1].Token != "" { + comments = append(comments, Comment{}) + } + case _COMMENT: + comments = append(comments, Comment{Start: sym.pos, Token: sym.text}) + case _EOF: + in.Error(fmt.Sprintf("syntax error (unterminated block started at %s:%d:%d)", in.filename, x.Start.Line, x.Start.LineRune)) + case ')': + x.RParen.Before = comments + x.RParen.Pos = sym.pos + tok = in.lex(sym) + if tok != '\n' && tok != _EOF && tok != _EOL { + in.Error("syntax error (expected newline after closing paren)") + } + return x + default: + l := in.parseLine(sym) + x.Line = append(x.Line, l) + l.Comment().Before = comments + comments = nil + } + } +} + +func (in *input) parseLine(sym *symType) *Line { + start := sym.pos + end := sym.endPos + token := []string{sym.text} + for { + tok := in.lex(sym) + switch tok { + case '\n', _EOF, _EOL: + return &Line{ + Start: start, + Token: token, + End: end, + InBlock: true, + } + default: + token = append(token, sym.text) + end = sym.endPos + } + } +} + +const ( + _EOF = -(1 + iota) + _EOL + _IDENT + _STRING + _COMMENT +) + +var ( + slashSlash = []byte("//") + moduleStr = []byte("module") +) + +// ModulePath returns the module path from the gomod file text. +// If it cannot find a module path, it returns an empty string. +// It is tolerant of unrelated problems in the go.mod file. +func ModulePath(mod []byte) string { + for len(mod) > 0 { + line := mod + mod = nil + if i := bytes.IndexByte(line, '\n'); i >= 0 { + line, mod = line[:i], line[i+1:] + } + if i := bytes.Index(line, slashSlash); i >= 0 { + line = line[:i] + } + line = bytes.TrimSpace(line) + if !bytes.HasPrefix(line, moduleStr) { + continue + } + line = line[len(moduleStr):] + n := len(line) + line = bytes.TrimSpace(line) + if len(line) == n || len(line) == 0 { + continue + } + + if line[0] == '"' || line[0] == '`' { + p, err := strconv.Unquote(string(line)) + if err != nil { + return "" // malformed quoted string or multiline module path + } + return p + } + + return string(line) + } + return "" // missing module path +} diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/read_test.go b/vendor/github.com/rogpeppe/go-internal/modfile/read_test.go new file mode 100644 index 000000000..8cb1a3908 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/read_test.go @@ -0,0 +1,365 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package modfile + +import ( + "bytes" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "reflect" + "strings" + "testing" +) + +// exists reports whether the named file exists. +func exists(name string) bool { + _, err := os.Stat(name) + return err == nil +} + +// Test that reading and then writing the golden files +// does not change their output. +func TestPrintGolden(t *testing.T) { + outs, err := filepath.Glob("testdata/*.golden") + if err != nil { + t.Fatal(err) + } + for _, out := range outs { + testPrint(t, out, out) + } +} + +// testPrint is a helper for testing the printer. +// It reads the file named in, reformats it, and compares +// the result to the file named out. +func testPrint(t *testing.T, in, out string) { + data, err := ioutil.ReadFile(in) + if err != nil { + t.Error(err) + return + } + + golden, err := ioutil.ReadFile(out) + if err != nil { + t.Error(err) + return + } + + base := "testdata/" + filepath.Base(in) + f, err := parse(in, data) + if err != nil { + t.Error(err) + return + } + + ndata := Format(f) + + if !bytes.Equal(ndata, golden) { + t.Errorf("formatted %s incorrectly: diff shows -golden, +ours", base) + tdiff(t, string(golden), string(ndata)) + return + } +} + +func TestParseLax(t *testing.T) { + badFile := []byte(`module m + surprise attack + x y ( + z + ) + exclude v1.2.3 + replace <-!!! + `) + _, err := ParseLax("file", badFile, nil) + if err != nil { + t.Fatalf("ParseLax did not ignore irrelevant errors: %v", err) + } +} + +// Test that when files in the testdata directory are parsed +// and printed and parsed again, we get the same parse tree +// both times. +func TestPrintParse(t *testing.T) { + outs, err := filepath.Glob("testdata/*") + if err != nil { + t.Fatal(err) + } + for _, out := range outs { + data, err := ioutil.ReadFile(out) + if err != nil { + t.Error(err) + continue + } + + base := "testdata/" + filepath.Base(out) + f, err := parse(base, data) + if err != nil { + t.Errorf("parsing original: %v", err) + continue + } + + ndata := Format(f) + f2, err := parse(base, ndata) + if err != nil { + t.Errorf("parsing reformatted: %v", err) + continue + } + + eq := eqchecker{file: base} + if err := eq.check(f, f2); err != nil { + t.Errorf("not equal (parse/Format/parse): %v", err) + } + + pf1, err := Parse(base, data, nil) + if err != nil { + switch base { + case "testdata/replace2.in", "testdata/gopkg.in.golden": + t.Errorf("should parse %v: %v", base, err) + } + } + if err == nil { + pf2, err := Parse(base, ndata, nil) + if err != nil { + t.Errorf("Parsing reformatted: %v", err) + continue + } + eq := eqchecker{file: base} + if err := eq.check(pf1, pf2); err != nil { + t.Errorf("not equal (parse/Format/Parse): %v", err) + } + + ndata2, err := pf1.Format() + if err != nil { + t.Errorf("reformat: %v", err) + } + pf3, err := Parse(base, ndata2, nil) + if err != nil { + t.Errorf("Parsing reformatted2: %v", err) + continue + } + eq = eqchecker{file: base} + if err := eq.check(pf1, pf3); err != nil { + t.Errorf("not equal (Parse/Format/Parse): %v", err) + } + ndata = ndata2 + } + + if strings.HasSuffix(out, ".in") { + golden, err := ioutil.ReadFile(strings.TrimSuffix(out, ".in") + ".golden") + if err != nil { + t.Error(err) + continue + } + if !bytes.Equal(ndata, golden) { + t.Errorf("formatted %s incorrectly: diff shows -golden, +ours", base) + tdiff(t, string(golden), string(ndata)) + return + } + } + } +} + +// An eqchecker holds state for checking the equality of two parse trees. +type eqchecker struct { + file string + pos Position +} + +// errorf returns an error described by the printf-style format and arguments, +// inserting the current file position before the error text. +func (eq *eqchecker) errorf(format string, args ...interface{}) error { + return fmt.Errorf("%s:%d: %s", eq.file, eq.pos.Line, + fmt.Sprintf(format, args...)) +} + +// check checks that v and w represent the same parse tree. +// If not, it returns an error describing the first difference. +func (eq *eqchecker) check(v, w interface{}) error { + return eq.checkValue(reflect.ValueOf(v), reflect.ValueOf(w)) +} + +var ( + posType = reflect.TypeOf(Position{}) + commentsType = reflect.TypeOf(Comments{}) +) + +// checkValue checks that v and w represent the same parse tree. +// If not, it returns an error describing the first difference. +func (eq *eqchecker) checkValue(v, w reflect.Value) error { + // inner returns the innermost expression for v. + // if v is a non-nil interface value, it returns the concrete + // value in the interface. + inner := func(v reflect.Value) reflect.Value { + for { + if v.Kind() == reflect.Interface && !v.IsNil() { + v = v.Elem() + continue + } + break + } + return v + } + + v = inner(v) + w = inner(w) + if v.Kind() == reflect.Invalid && w.Kind() == reflect.Invalid { + return nil + } + if v.Kind() == reflect.Invalid { + return eq.errorf("nil interface became %s", w.Type()) + } + if w.Kind() == reflect.Invalid { + return eq.errorf("%s became nil interface", v.Type()) + } + + if v.Type() != w.Type() { + return eq.errorf("%s became %s", v.Type(), w.Type()) + } + + if p, ok := v.Interface().(Expr); ok { + eq.pos, _ = p.Span() + } + + switch v.Kind() { + default: + return eq.errorf("unexpected type %s", v.Type()) + + case reflect.Bool, reflect.Int, reflect.String: + vi := v.Interface() + wi := w.Interface() + if vi != wi { + return eq.errorf("%v became %v", vi, wi) + } + + case reflect.Slice: + vl := v.Len() + wl := w.Len() + for i := 0; i < vl || i < wl; i++ { + if i >= vl { + return eq.errorf("unexpected %s", w.Index(i).Type()) + } + if i >= wl { + return eq.errorf("missing %s", v.Index(i).Type()) + } + if err := eq.checkValue(v.Index(i), w.Index(i)); err != nil { + return err + } + } + + case reflect.Struct: + // Fields in struct must match. + t := v.Type() + n := t.NumField() + for i := 0; i < n; i++ { + tf := t.Field(i) + switch { + default: + if err := eq.checkValue(v.Field(i), w.Field(i)); err != nil { + return err + } + + case tf.Type == posType: // ignore positions + case tf.Type == commentsType: // ignore comment assignment + } + } + + case reflect.Ptr, reflect.Interface: + if v.IsNil() != w.IsNil() { + if v.IsNil() { + return eq.errorf("unexpected %s", w.Elem().Type()) + } + return eq.errorf("missing %s", v.Elem().Type()) + } + if err := eq.checkValue(v.Elem(), w.Elem()); err != nil { + return err + } + } + return nil +} + +// diff returns the output of running diff on b1 and b2. +func diff(b1, b2 []byte) (data []byte, err error) { + f1, err := ioutil.TempFile("", "testdiff") + if err != nil { + return nil, err + } + defer os.Remove(f1.Name()) + defer f1.Close() + + f2, err := ioutil.TempFile("", "testdiff") + if err != nil { + return nil, err + } + defer os.Remove(f2.Name()) + defer f2.Close() + + f1.Write(b1) + f2.Write(b2) + + data, err = exec.Command("diff", "-u", f1.Name(), f2.Name()).CombinedOutput() + if len(data) > 0 { + // diff exits with a non-zero status when the files don't match. + // Ignore that failure as long as we get output. + err = nil + } + return +} + +// tdiff logs the diff output to t.Error. +func tdiff(t *testing.T, a, b string) { + data, err := diff([]byte(a), []byte(b)) + if err != nil { + t.Error(err) + return + } + t.Error(string(data)) +} + +var modulePathTests = []struct { + input []byte + expected string +}{ + {input: []byte("module \"github.com/rsc/vgotest\""), expected: "github.com/rsc/vgotest"}, + {input: []byte("module github.com/rsc/vgotest"), expected: "github.com/rsc/vgotest"}, + {input: []byte("module \"github.com/rsc/vgotest\""), expected: "github.com/rsc/vgotest"}, + {input: []byte("module github.com/rsc/vgotest"), expected: "github.com/rsc/vgotest"}, + {input: []byte("module `github.com/rsc/vgotest`"), expected: "github.com/rsc/vgotest"}, + {input: []byte("module \"github.com/rsc/vgotest/v2\""), expected: "github.com/rsc/vgotest/v2"}, + {input: []byte("module github.com/rsc/vgotest/v2"), expected: "github.com/rsc/vgotest/v2"}, + {input: []byte("module \"gopkg.in/yaml.v2\""), expected: "gopkg.in/yaml.v2"}, + {input: []byte("module gopkg.in/yaml.v2"), expected: "gopkg.in/yaml.v2"}, + {input: []byte("module \"gopkg.in/check.v1\"\n"), expected: "gopkg.in/check.v1"}, + {input: []byte("module \"gopkg.in/check.v1\n\""), expected: ""}, + {input: []byte("module gopkg.in/check.v1\n"), expected: "gopkg.in/check.v1"}, + {input: []byte("module \"gopkg.in/check.v1\"\r\n"), expected: "gopkg.in/check.v1"}, + {input: []byte("module gopkg.in/check.v1\r\n"), expected: "gopkg.in/check.v1"}, + {input: []byte("module \"gopkg.in/check.v1\"\n\n"), expected: "gopkg.in/check.v1"}, + {input: []byte("module gopkg.in/check.v1\n\n"), expected: "gopkg.in/check.v1"}, + {input: []byte("module \n\"gopkg.in/check.v1\"\n\n"), expected: ""}, + {input: []byte("module \ngopkg.in/check.v1\n\n"), expected: ""}, + {input: []byte("module \"gopkg.in/check.v1\"asd"), expected: ""}, + {input: []byte("module \n\"gopkg.in/check.v1\"\n\n"), expected: ""}, + {input: []byte("module \ngopkg.in/check.v1\n\n"), expected: ""}, + {input: []byte("module \"gopkg.in/check.v1\"asd"), expected: ""}, + {input: []byte("module \nmodule a/b/c "), expected: "a/b/c"}, + {input: []byte("module \" \""), expected: " "}, + {input: []byte("module "), expected: ""}, + {input: []byte("module \" a/b/c \""), expected: " a/b/c "}, + {input: []byte("module \"github.com/rsc/vgotest1\" // with a comment"), expected: "github.com/rsc/vgotest1"}, +} + +func TestModulePath(t *testing.T) { + for _, test := range modulePathTests { + t.Run(string(test.input), func(t *testing.T) { + result := ModulePath(test.input) + if result != test.expected { + t.Fatalf("ModulePath(%q): %s, want %s", string(test.input), result, test.expected) + } + }) + } +} diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/rule.go b/vendor/github.com/rogpeppe/go-internal/modfile/rule.go new file mode 100644 index 000000000..24d275f12 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/rule.go @@ -0,0 +1,724 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package modfile + +import ( + "bytes" + "errors" + "fmt" + "path/filepath" + "regexp" + "sort" + "strconv" + "strings" + "unicode" + + "github.com/rogpeppe/go-internal/module" + "github.com/rogpeppe/go-internal/semver" +) + +// A File is the parsed, interpreted form of a go.mod file. +type File struct { + Module *Module + Go *Go + Require []*Require + Exclude []*Exclude + Replace []*Replace + + Syntax *FileSyntax +} + +// A Module is the module statement. +type Module struct { + Mod module.Version + Syntax *Line +} + +// A Go is the go statement. +type Go struct { + Version string // "1.23" + Syntax *Line +} + +// A Require is a single require statement. +type Require struct { + Mod module.Version + Indirect bool // has "// indirect" comment + Syntax *Line +} + +// An Exclude is a single exclude statement. +type Exclude struct { + Mod module.Version + Syntax *Line +} + +// A Replace is a single replace statement. +type Replace struct { + Old module.Version + New module.Version + Syntax *Line +} + +func (f *File) AddModuleStmt(path string) error { + if f.Syntax == nil { + f.Syntax = new(FileSyntax) + } + if f.Module == nil { + f.Module = &Module{ + Mod: module.Version{Path: path}, + Syntax: f.Syntax.addLine(nil, "module", AutoQuote(path)), + } + } else { + f.Module.Mod.Path = path + f.Syntax.updateLine(f.Module.Syntax, "module", AutoQuote(path)) + } + return nil +} + +func (f *File) AddComment(text string) { + if f.Syntax == nil { + f.Syntax = new(FileSyntax) + } + f.Syntax.Stmt = append(f.Syntax.Stmt, &CommentBlock{ + Comments: Comments{ + Before: []Comment{ + { + Token: text, + }, + }, + }, + }) +} + +type VersionFixer func(path, version string) (string, error) + +// Parse parses the data, reported in errors as being from file, +// into a File struct. It applies fix, if non-nil, to canonicalize all module versions found. +func Parse(file string, data []byte, fix VersionFixer) (*File, error) { + return parseToFile(file, data, fix, true) +} + +// ParseLax is like Parse but ignores unknown statements. +// It is used when parsing go.mod files other than the main module, +// under the theory that most statement types we add in the future will +// only apply in the main module, like exclude and replace, +// and so we get better gradual deployments if old go commands +// simply ignore those statements when found in go.mod files +// in dependencies. +func ParseLax(file string, data []byte, fix VersionFixer) (*File, error) { + return parseToFile(file, data, fix, false) +} + +func parseToFile(file string, data []byte, fix VersionFixer, strict bool) (*File, error) { + fs, err := parse(file, data) + if err != nil { + return nil, err + } + f := &File{ + Syntax: fs, + } + + var errs bytes.Buffer + for _, x := range fs.Stmt { + switch x := x.(type) { + case *Line: + f.add(&errs, x, x.Token[0], x.Token[1:], fix, strict) + + case *LineBlock: + if len(x.Token) > 1 { + if strict { + fmt.Fprintf(&errs, "%s:%d: unknown block type: %s\n", file, x.Start.Line, strings.Join(x.Token, " ")) + } + continue + } + switch x.Token[0] { + default: + if strict { + fmt.Fprintf(&errs, "%s:%d: unknown block type: %s\n", file, x.Start.Line, strings.Join(x.Token, " ")) + } + continue + case "module", "require", "exclude", "replace": + for _, l := range x.Line { + f.add(&errs, l, x.Token[0], l.Token, fix, strict) + } + } + } + } + + if errs.Len() > 0 { + return nil, errors.New(strings.TrimRight(errs.String(), "\n")) + } + return f, nil +} + +var goVersionRE = regexp.MustCompile(`([1-9][0-9]*)\.(0|[1-9][0-9]*)`) + +func (f *File) add(errs *bytes.Buffer, line *Line, verb string, args []string, fix VersionFixer, strict bool) { + // If strict is false, this module is a dependency. + // We ignore all unknown directives as well as main-module-only + // directives like replace and exclude. It will work better for + // forward compatibility if we can depend on modules that have unknown + // statements (presumed relevant only when acting as the main module) + // and simply ignore those statements. + if !strict { + switch verb { + case "module", "require", "go": + // want these even for dependency go.mods + default: + return + } + } + + switch verb { + default: + fmt.Fprintf(errs, "%s:%d: unknown directive: %s\n", f.Syntax.Name, line.Start.Line, verb) + + case "go": + if f.Go != nil { + fmt.Fprintf(errs, "%s:%d: repeated go statement\n", f.Syntax.Name, line.Start.Line) + return + } + if len(args) != 1 || !goVersionRE.MatchString(args[0]) { + fmt.Fprintf(errs, "%s:%d: usage: go 1.23\n", f.Syntax.Name, line.Start.Line) + return + } + f.Go = &Go{Syntax: line} + f.Go.Version = args[0] + case "module": + if f.Module != nil { + fmt.Fprintf(errs, "%s:%d: repeated module statement\n", f.Syntax.Name, line.Start.Line) + return + } + f.Module = &Module{Syntax: line} + if len(args) != 1 { + + fmt.Fprintf(errs, "%s:%d: usage: module module/path [version]\n", f.Syntax.Name, line.Start.Line) + return + } + s, err := parseString(&args[0]) + if err != nil { + fmt.Fprintf(errs, "%s:%d: invalid quoted string: %v\n", f.Syntax.Name, line.Start.Line, err) + return + } + f.Module.Mod = module.Version{Path: s} + case "require", "exclude": + if len(args) != 2 { + fmt.Fprintf(errs, "%s:%d: usage: %s module/path v1.2.3\n", f.Syntax.Name, line.Start.Line, verb) + return + } + s, err := parseString(&args[0]) + if err != nil { + fmt.Fprintf(errs, "%s:%d: invalid quoted string: %v\n", f.Syntax.Name, line.Start.Line, err) + return + } + old := args[1] + v, err := parseVersion(s, &args[1], fix) + if err != nil { + fmt.Fprintf(errs, "%s:%d: invalid module version %q: %v\n", f.Syntax.Name, line.Start.Line, old, err) + return + } + pathMajor, err := modulePathMajor(s) + if err != nil { + fmt.Fprintf(errs, "%s:%d: %v\n", f.Syntax.Name, line.Start.Line, err) + return + } + if !module.MatchPathMajor(v, pathMajor) { + if pathMajor == "" { + pathMajor = "v0 or v1" + } + fmt.Fprintf(errs, "%s:%d: invalid module: %s should be %s, not %s (%s)\n", f.Syntax.Name, line.Start.Line, s, pathMajor, semver.Major(v), v) + return + } + if verb == "require" { + f.Require = append(f.Require, &Require{ + Mod: module.Version{Path: s, Version: v}, + Syntax: line, + Indirect: isIndirect(line), + }) + } else { + f.Exclude = append(f.Exclude, &Exclude{ + Mod: module.Version{Path: s, Version: v}, + Syntax: line, + }) + } + case "replace": + arrow := 2 + if len(args) >= 2 && args[1] == "=>" { + arrow = 1 + } + if len(args) < arrow+2 || len(args) > arrow+3 || args[arrow] != "=>" { + fmt.Fprintf(errs, "%s:%d: usage: %s module/path [v1.2.3] => other/module v1.4\n\t or %s module/path [v1.2.3] => ../local/directory\n", f.Syntax.Name, line.Start.Line, verb, verb) + return + } + s, err := parseString(&args[0]) + if err != nil { + fmt.Fprintf(errs, "%s:%d: invalid quoted string: %v\n", f.Syntax.Name, line.Start.Line, err) + return + } + pathMajor, err := modulePathMajor(s) + if err != nil { + fmt.Fprintf(errs, "%s:%d: %v\n", f.Syntax.Name, line.Start.Line, err) + return + } + var v string + if arrow == 2 { + old := args[1] + v, err = parseVersion(s, &args[1], fix) + if err != nil { + fmt.Fprintf(errs, "%s:%d: invalid module version %v: %v\n", f.Syntax.Name, line.Start.Line, old, err) + return + } + if !module.MatchPathMajor(v, pathMajor) { + if pathMajor == "" { + pathMajor = "v0 or v1" + } + fmt.Fprintf(errs, "%s:%d: invalid module: %s should be %s, not %s (%s)\n", f.Syntax.Name, line.Start.Line, s, pathMajor, semver.Major(v), v) + return + } + } + ns, err := parseString(&args[arrow+1]) + if err != nil { + fmt.Fprintf(errs, "%s:%d: invalid quoted string: %v\n", f.Syntax.Name, line.Start.Line, err) + return + } + nv := "" + if len(args) == arrow+2 { + if !IsDirectoryPath(ns) { + fmt.Fprintf(errs, "%s:%d: replacement module without version must be directory path (rooted or starting with ./ or ../)\n", f.Syntax.Name, line.Start.Line) + return + } + if filepath.Separator == '/' && strings.Contains(ns, `\`) { + fmt.Fprintf(errs, "%s:%d: replacement directory appears to be Windows path (on a non-windows system)\n", f.Syntax.Name, line.Start.Line) + return + } + } + if len(args) == arrow+3 { + old := args[arrow+1] + nv, err = parseVersion(ns, &args[arrow+2], fix) + if err != nil { + fmt.Fprintf(errs, "%s:%d: invalid module version %v: %v\n", f.Syntax.Name, line.Start.Line, old, err) + return + } + if IsDirectoryPath(ns) { + fmt.Fprintf(errs, "%s:%d: replacement module directory path %q cannot have version\n", f.Syntax.Name, line.Start.Line, ns) + return + } + } + f.Replace = append(f.Replace, &Replace{ + Old: module.Version{Path: s, Version: v}, + New: module.Version{Path: ns, Version: nv}, + Syntax: line, + }) + } +} + +// isIndirect reports whether line has a "// indirect" comment, +// meaning it is in go.mod only for its effect on indirect dependencies, +// so that it can be dropped entirely once the effective version of the +// indirect dependency reaches the given minimum version. +func isIndirect(line *Line) bool { + if len(line.Suffix) == 0 { + return false + } + f := strings.Fields(line.Suffix[0].Token) + return (len(f) == 2 && f[1] == "indirect" || len(f) > 2 && f[1] == "indirect;") && f[0] == "//" +} + +// setIndirect sets line to have (or not have) a "// indirect" comment. +func setIndirect(line *Line, indirect bool) { + if isIndirect(line) == indirect { + return + } + if indirect { + // Adding comment. + if len(line.Suffix) == 0 { + // New comment. + line.Suffix = []Comment{{Token: "// indirect", Suffix: true}} + return + } + // Insert at beginning of existing comment. + com := &line.Suffix[0] + space := " " + if len(com.Token) > 2 && com.Token[2] == ' ' || com.Token[2] == '\t' { + space = "" + } + com.Token = "// indirect;" + space + com.Token[2:] + return + } + + // Removing comment. + f := strings.Fields(line.Suffix[0].Token) + if len(f) == 2 { + // Remove whole comment. + line.Suffix = nil + return + } + + // Remove comment prefix. + com := &line.Suffix[0] + i := strings.Index(com.Token, "indirect;") + com.Token = "//" + com.Token[i+len("indirect;"):] +} + +// IsDirectoryPath reports whether the given path should be interpreted +// as a directory path. Just like on the go command line, relative paths +// and rooted paths are directory paths; the rest are module paths. +func IsDirectoryPath(ns string) bool { + // Because go.mod files can move from one system to another, + // we check all known path syntaxes, both Unix and Windows. + return strings.HasPrefix(ns, "./") || strings.HasPrefix(ns, "../") || strings.HasPrefix(ns, "/") || + strings.HasPrefix(ns, `.\`) || strings.HasPrefix(ns, `..\`) || strings.HasPrefix(ns, `\`) || + len(ns) >= 2 && ('A' <= ns[0] && ns[0] <= 'Z' || 'a' <= ns[0] && ns[0] <= 'z') && ns[1] == ':' +} + +// MustQuote reports whether s must be quoted in order to appear as +// a single token in a go.mod line. +func MustQuote(s string) bool { + for _, r := range s { + if !unicode.IsPrint(r) || r == ' ' || r == '"' || r == '\'' || r == '`' { + return true + } + } + return s == "" || strings.Contains(s, "//") || strings.Contains(s, "/*") +} + +// AutoQuote returns s or, if quoting is required for s to appear in a go.mod, +// the quotation of s. +func AutoQuote(s string) string { + if MustQuote(s) { + return strconv.Quote(s) + } + return s +} + +func parseString(s *string) (string, error) { + t := *s + if strings.HasPrefix(t, `"`) { + var err error + if t, err = strconv.Unquote(t); err != nil { + return "", err + } + } else if strings.ContainsAny(t, "\"'`") { + // Other quotes are reserved both for possible future expansion + // and to avoid confusion. For example if someone types 'x' + // we want that to be a syntax error and not a literal x in literal quotation marks. + return "", fmt.Errorf("unquoted string cannot contain quote") + } + *s = AutoQuote(t) + return t, nil +} + +func parseVersion(path string, s *string, fix VersionFixer) (string, error) { + t, err := parseString(s) + if err != nil { + return "", err + } + if fix != nil { + var err error + t, err = fix(path, t) + if err != nil { + return "", err + } + } + if v := module.CanonicalVersion(t); v != "" { + *s = v + return *s, nil + } + return "", fmt.Errorf("version must be of the form v1.2.3") +} + +func modulePathMajor(path string) (string, error) { + _, major, ok := module.SplitPathVersion(path) + if !ok { + return "", fmt.Errorf("invalid module path") + } + return major, nil +} + +func (f *File) Format() ([]byte, error) { + return Format(f.Syntax), nil +} + +// Cleanup cleans up the file f after any edit operations. +// To avoid quadratic behavior, modifications like DropRequire +// clear the entry but do not remove it from the slice. +// Cleanup cleans out all the cleared entries. +func (f *File) Cleanup() { + w := 0 + for _, r := range f.Require { + if r.Mod.Path != "" { + f.Require[w] = r + w++ + } + } + f.Require = f.Require[:w] + + w = 0 + for _, x := range f.Exclude { + if x.Mod.Path != "" { + f.Exclude[w] = x + w++ + } + } + f.Exclude = f.Exclude[:w] + + w = 0 + for _, r := range f.Replace { + if r.Old.Path != "" { + f.Replace[w] = r + w++ + } + } + f.Replace = f.Replace[:w] + + f.Syntax.Cleanup() +} + +func (f *File) AddRequire(path, vers string) error { + need := true + for _, r := range f.Require { + if r.Mod.Path == path { + if need { + r.Mod.Version = vers + f.Syntax.updateLine(r.Syntax, "require", AutoQuote(path), vers) + need = false + } else { + f.Syntax.removeLine(r.Syntax) + *r = Require{} + } + } + } + + if need { + f.AddNewRequire(path, vers, false) + } + return nil +} + +func (f *File) AddNewRequire(path, vers string, indirect bool) { + line := f.Syntax.addLine(nil, "require", AutoQuote(path), vers) + setIndirect(line, indirect) + f.Require = append(f.Require, &Require{module.Version{Path: path, Version: vers}, indirect, line}) +} + +func (f *File) SetRequire(req []*Require) { + need := make(map[string]string) + indirect := make(map[string]bool) + for _, r := range req { + need[r.Mod.Path] = r.Mod.Version + indirect[r.Mod.Path] = r.Indirect + } + + for _, r := range f.Require { + if v, ok := need[r.Mod.Path]; ok { + r.Mod.Version = v + r.Indirect = indirect[r.Mod.Path] + } + } + + var newStmts []Expr + for _, stmt := range f.Syntax.Stmt { + switch stmt := stmt.(type) { + case *LineBlock: + if len(stmt.Token) > 0 && stmt.Token[0] == "require" { + var newLines []*Line + for _, line := range stmt.Line { + if p, err := parseString(&line.Token[0]); err == nil && need[p] != "" { + line.Token[1] = need[p] + delete(need, p) + setIndirect(line, indirect[p]) + newLines = append(newLines, line) + } + } + if len(newLines) == 0 { + continue // drop stmt + } + stmt.Line = newLines + } + + case *Line: + if len(stmt.Token) > 0 && stmt.Token[0] == "require" { + if p, err := parseString(&stmt.Token[1]); err == nil && need[p] != "" { + stmt.Token[2] = need[p] + delete(need, p) + setIndirect(stmt, indirect[p]) + } else { + continue // drop stmt + } + } + } + newStmts = append(newStmts, stmt) + } + f.Syntax.Stmt = newStmts + + for path, vers := range need { + f.AddNewRequire(path, vers, indirect[path]) + } + f.SortBlocks() +} + +func (f *File) DropRequire(path string) error { + for _, r := range f.Require { + if r.Mod.Path == path { + f.Syntax.removeLine(r.Syntax) + *r = Require{} + } + } + return nil +} + +func (f *File) AddExclude(path, vers string) error { + var hint *Line + for _, x := range f.Exclude { + if x.Mod.Path == path && x.Mod.Version == vers { + return nil + } + if x.Mod.Path == path { + hint = x.Syntax + } + } + + f.Exclude = append(f.Exclude, &Exclude{Mod: module.Version{Path: path, Version: vers}, Syntax: f.Syntax.addLine(hint, "exclude", AutoQuote(path), vers)}) + return nil +} + +func (f *File) DropExclude(path, vers string) error { + for _, x := range f.Exclude { + if x.Mod.Path == path && x.Mod.Version == vers { + f.Syntax.removeLine(x.Syntax) + *x = Exclude{} + } + } + return nil +} + +func (f *File) AddReplace(oldPath, oldVers, newPath, newVers string) error { + need := true + old := module.Version{Path: oldPath, Version: oldVers} + new := module.Version{Path: newPath, Version: newVers} + tokens := []string{"replace", AutoQuote(oldPath)} + if oldVers != "" { + tokens = append(tokens, oldVers) + } + tokens = append(tokens, "=>", AutoQuote(newPath)) + if newVers != "" { + tokens = append(tokens, newVers) + } + + var hint *Line + for _, r := range f.Replace { + if r.Old.Path == oldPath && (oldVers == "" || r.Old.Version == oldVers) { + if need { + // Found replacement for old; update to use new. + r.New = new + f.Syntax.updateLine(r.Syntax, tokens...) + need = false + continue + } + // Already added; delete other replacements for same. + f.Syntax.removeLine(r.Syntax) + *r = Replace{} + } + if r.Old.Path == oldPath { + hint = r.Syntax + } + } + if need { + f.Replace = append(f.Replace, &Replace{Old: old, New: new, Syntax: f.Syntax.addLine(hint, tokens...)}) + } + return nil +} + +func (f *File) DropReplace(oldPath, oldVers string) error { + for _, r := range f.Replace { + if r.Old.Path == oldPath && r.Old.Version == oldVers { + f.Syntax.removeLine(r.Syntax) + *r = Replace{} + } + } + return nil +} + +func (f *File) SortBlocks() { + f.removeDups() // otherwise sorting is unsafe + + for _, stmt := range f.Syntax.Stmt { + block, ok := stmt.(*LineBlock) + if !ok { + continue + } + sort.Slice(block.Line, func(i, j int) bool { + li := block.Line[i] + lj := block.Line[j] + for k := 0; k < len(li.Token) && k < len(lj.Token); k++ { + if li.Token[k] != lj.Token[k] { + return li.Token[k] < lj.Token[k] + } + } + return len(li.Token) < len(lj.Token) + }) + } +} + +func (f *File) removeDups() { + have := make(map[module.Version]bool) + kill := make(map[*Line]bool) + for _, x := range f.Exclude { + if have[x.Mod] { + kill[x.Syntax] = true + continue + } + have[x.Mod] = true + } + var excl []*Exclude + for _, x := range f.Exclude { + if !kill[x.Syntax] { + excl = append(excl, x) + } + } + f.Exclude = excl + + have = make(map[module.Version]bool) + // Later replacements take priority over earlier ones. + for i := len(f.Replace) - 1; i >= 0; i-- { + x := f.Replace[i] + if have[x.Old] { + kill[x.Syntax] = true + continue + } + have[x.Old] = true + } + var repl []*Replace + for _, x := range f.Replace { + if !kill[x.Syntax] { + repl = append(repl, x) + } + } + f.Replace = repl + + var stmts []Expr + for _, stmt := range f.Syntax.Stmt { + switch stmt := stmt.(type) { + case *Line: + if kill[stmt] { + continue + } + case *LineBlock: + var lines []*Line + for _, line := range stmt.Line { + if !kill[line] { + lines = append(lines, line) + } + } + stmt.Line = lines + if len(lines) == 0 { + continue + } + } + stmts = append(stmts, stmt) + } + f.Syntax.Stmt = stmts +} diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/rule_test.go b/vendor/github.com/rogpeppe/go-internal/modfile/rule_test.go new file mode 100644 index 000000000..b88ad6291 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/rule_test.go @@ -0,0 +1,90 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package modfile + +import ( + "bytes" + "fmt" + "testing" +) + +var addRequireTests = []struct { + in string + path string + vers string + out string +}{ + { + ` + module m + require x.y/z v1.2.3 + `, + "x.y/z", "v1.5.6", + ` + module m + require x.y/z v1.5.6 + `, + }, + { + ` + module m + require x.y/z v1.2.3 + `, + "x.y/w", "v1.5.6", + ` + module m + require ( + x.y/z v1.2.3 + x.y/w v1.5.6 + ) + `, + }, + { + ` + module m + require x.y/z v1.2.3 + require x.y/q/v2 v2.3.4 + `, + "x.y/w", "v1.5.6", + ` + module m + require x.y/z v1.2.3 + require ( + x.y/q/v2 v2.3.4 + x.y/w v1.5.6 + ) + `, + }, +} + +func TestAddRequire(t *testing.T) { + for i, tt := range addRequireTests { + t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) { + f, err := Parse("in", []byte(tt.in), nil) + if err != nil { + t.Fatal(err) + } + g, err := Parse("out", []byte(tt.out), nil) + if err != nil { + t.Fatal(err) + } + golden, err := g.Format() + if err != nil { + t.Fatal(err) + } + + if err := f.AddRequire(tt.path, tt.vers); err != nil { + t.Fatal(err) + } + out, err := f.Format() + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(out, golden) { + t.Errorf("have:\n%s\nwant:\n%s", out, golden) + } + }) + } +} diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/block.golden b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/block.golden new file mode 100644 index 000000000..4aa2d634f --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/block.golden @@ -0,0 +1,29 @@ +// comment +x "y" z + +// block +block ( // block-eol + // x-before-line + + "x" ( y // x-eol + "x1" + "x2" + // line + "x3" + "x4" + + "x5" + + // y-line + "y" // y-eol + + "z" // z-eol +) // block-eol2 + +block2 ( + x + y + z +) + +// eof diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/block.in b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/block.in new file mode 100644 index 000000000..1dfae65f5 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/block.in @@ -0,0 +1,29 @@ +// comment +x "y" z + +// block +block ( // block-eol + // x-before-line + + "x" ( y // x-eol + "x1" + "x2" + // line + "x3" + "x4" + + "x5" + + // y-line + "y" // y-eol + + "z" // z-eol +) // block-eol2 + + +block2 (x + y + z +) + +// eof diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/comment.golden b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/comment.golden new file mode 100644 index 000000000..75f3b8447 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/comment.golden @@ -0,0 +1,10 @@ +// comment +module "x" // eol + +// mid comment + +// comment 2 +// comment 2 line 2 +module "y" // eoy + +// comment 3 diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/comment.in b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/comment.in new file mode 100644 index 000000000..bfc2492b2 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/comment.in @@ -0,0 +1,8 @@ +// comment +module "x" // eol +// mid comment + +// comment 2 +// comment 2 line 2 +module "y" // eoy +// comment 3 diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/empty.golden b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/empty.golden new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/empty.in b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/empty.in new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/gopkg.in.golden b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/gopkg.in.golden new file mode 100644 index 000000000..41669b3a7 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/gopkg.in.golden @@ -0,0 +1,6 @@ +module x + +require ( + gopkg.in/mgo.v2 v2.0.0-20160818020120-3f83fa500528 + gopkg.in/yaml.v2 v2.2.1 +) diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/module.golden b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/module.golden new file mode 100644 index 000000000..78ba94398 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/module.golden @@ -0,0 +1 @@ +module abc diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/module.in b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/module.in new file mode 100644 index 000000000..08f383623 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/module.in @@ -0,0 +1 @@ +module "abc" diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace.golden b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace.golden new file mode 100644 index 000000000..5d6abcfcd --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace.golden @@ -0,0 +1,5 @@ +module abc + +replace xyz v1.2.3 => /tmp/z + +replace xyz v1.3.4 => my/xyz v1.3.4-me diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace.in b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace.in new file mode 100644 index 000000000..685249946 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace.in @@ -0,0 +1,5 @@ +module "abc" + +replace "xyz" v1.2.3 => "/tmp/z" + +replace "xyz" v1.3.4 => "my/xyz" v1.3.4-me diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace2.golden b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace2.golden new file mode 100644 index 000000000..e1d9c728d --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace2.golden @@ -0,0 +1,10 @@ +module abc + +replace ( + xyz v1.2.3 => /tmp/z + xyz v1.3.4 => my/xyz v1.3.4-me + xyz v1.4.5 => "/tmp/my dir" + xyz v1.5.6 => my/xyz v1.5.6 + + xyz => my/other/xyz v1.5.4 +) diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace2.in b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace2.in new file mode 100644 index 000000000..786469866 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/replace2.in @@ -0,0 +1,10 @@ +module "abc" + +replace ( + "xyz" v1.2.3 => "/tmp/z" + "xyz" v1.3.4 => "my/xyz" "v1.3.4-me" + xyz "v1.4.5" => "/tmp/my dir" + xyz v1.5.6 => my/xyz v1.5.6 + + xyz => my/other/xyz v1.5.4 +) diff --git a/vendor/github.com/rogpeppe/go-internal/modfile/testdata/rule1.golden b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/rule1.golden new file mode 100644 index 000000000..8a5c72589 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/modfile/testdata/rule1.golden @@ -0,0 +1,7 @@ +module "x" + +module "y" + +require "x" + +require x diff --git a/vendor/github.com/rogpeppe/go-internal/module/module.go b/vendor/github.com/rogpeppe/go-internal/module/module.go new file mode 100644 index 000000000..3ff6d9bf5 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/module/module.go @@ -0,0 +1,540 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package module defines the module.Version type +// along with support code. +package module + +// IMPORTANT NOTE +// +// This file essentially defines the set of valid import paths for the go command. +// There are many subtle considerations, including Unicode ambiguity, +// security, network, and file system representations. +// +// This file also defines the set of valid module path and version combinations, +// another topic with many subtle considerations. +// +// Changes to the semantics in this file require approval from rsc. + +import ( + "fmt" + "sort" + "strings" + "unicode" + "unicode/utf8" + + "github.com/rogpeppe/go-internal/semver" +) + +// A Version is defined by a module path and version pair. +type Version struct { + Path string + + // Version is usually a semantic version in canonical form. + // There are two exceptions to this general rule. + // First, the top-level target of a build has no specific version + // and uses Version = "". + // Second, during MVS calculations the version "none" is used + // to represent the decision to take no version of a given module. + Version string `json:",omitempty"` +} + +// Check checks that a given module path, version pair is valid. +// In addition to the path being a valid module path +// and the version being a valid semantic version, +// the two must correspond. +// For example, the path "yaml/v2" only corresponds to +// semantic versions beginning with "v2.". +func Check(path, version string) error { + if err := CheckPath(path); err != nil { + return err + } + if !semver.IsValid(version) { + return fmt.Errorf("malformed semantic version %v", version) + } + _, pathMajor, _ := SplitPathVersion(path) + if !MatchPathMajor(version, pathMajor) { + if pathMajor == "" { + pathMajor = "v0 or v1" + } + if pathMajor[0] == '.' { // .v1 + pathMajor = pathMajor[1:] + } + return fmt.Errorf("mismatched module path %v and version %v (want %v)", path, version, pathMajor) + } + return nil +} + +// firstPathOK reports whether r can appear in the first element of a module path. +// The first element of the path must be an LDH domain name, at least for now. +// To avoid case ambiguity, the domain name must be entirely lower case. +func firstPathOK(r rune) bool { + return r == '-' || r == '.' || + '0' <= r && r <= '9' || + 'a' <= r && r <= 'z' +} + +// pathOK reports whether r can appear in an import path element. +// Paths can be ASCII letters, ASCII digits, and limited ASCII punctuation: + - . _ and ~. +// This matches what "go get" has historically recognized in import paths. +// TODO(rsc): We would like to allow Unicode letters, but that requires additional +// care in the safe encoding (see note below). +func pathOK(r rune) bool { + if r < utf8.RuneSelf { + return r == '+' || r == '-' || r == '.' || r == '_' || r == '~' || + '0' <= r && r <= '9' || + 'A' <= r && r <= 'Z' || + 'a' <= r && r <= 'z' + } + return false +} + +// fileNameOK reports whether r can appear in a file name. +// For now we allow all Unicode letters but otherwise limit to pathOK plus a few more punctuation characters. +// If we expand the set of allowed characters here, we have to +// work harder at detecting potential case-folding and normalization collisions. +// See note about "safe encoding" below. +func fileNameOK(r rune) bool { + if r < utf8.RuneSelf { + // Entire set of ASCII punctuation, from which we remove characters: + // ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ + // We disallow some shell special characters: " ' * < > ? ` | + // (Note that some of those are disallowed by the Windows file system as well.) + // We also disallow path separators / : and \ (fileNameOK is only called on path element characters). + // We allow spaces (U+0020) in file names. + const allowed = "!#$%&()+,-.=@[]^_{}~ " + if '0' <= r && r <= '9' || 'A' <= r && r <= 'Z' || 'a' <= r && r <= 'z' { + return true + } + for i := 0; i < len(allowed); i++ { + if rune(allowed[i]) == r { + return true + } + } + return false + } + // It may be OK to add more ASCII punctuation here, but only carefully. + // For example Windows disallows < > \, and macOS disallows :, so we must not allow those. + return unicode.IsLetter(r) +} + +// CheckPath checks that a module path is valid. +func CheckPath(path string) error { + if err := checkPath(path, false); err != nil { + return fmt.Errorf("malformed module path %q: %v", path, err) + } + i := strings.Index(path, "/") + if i < 0 { + i = len(path) + } + if i == 0 { + return fmt.Errorf("malformed module path %q: leading slash", path) + } + if !strings.Contains(path[:i], ".") { + return fmt.Errorf("malformed module path %q: missing dot in first path element", path) + } + if path[0] == '-' { + return fmt.Errorf("malformed module path %q: leading dash in first path element", path) + } + for _, r := range path[:i] { + if !firstPathOK(r) { + return fmt.Errorf("malformed module path %q: invalid char %q in first path element", path, r) + } + } + if _, _, ok := SplitPathVersion(path); !ok { + return fmt.Errorf("malformed module path %q: invalid version", path) + } + return nil +} + +// CheckImportPath checks that an import path is valid. +func CheckImportPath(path string) error { + if err := checkPath(path, false); err != nil { + return fmt.Errorf("malformed import path %q: %v", path, err) + } + return nil +} + +// checkPath checks that a general path is valid. +// It returns an error describing why but not mentioning path. +// Because these checks apply to both module paths and import paths, +// the caller is expected to add the "malformed ___ path %q: " prefix. +// fileName indicates whether the final element of the path is a file name +// (as opposed to a directory name). +func checkPath(path string, fileName bool) error { + if !utf8.ValidString(path) { + return fmt.Errorf("invalid UTF-8") + } + if path == "" { + return fmt.Errorf("empty string") + } + if strings.Contains(path, "..") { + return fmt.Errorf("double dot") + } + if strings.Contains(path, "//") { + return fmt.Errorf("double slash") + } + if path[len(path)-1] == '/' { + return fmt.Errorf("trailing slash") + } + elemStart := 0 + for i, r := range path { + if r == '/' { + if err := checkElem(path[elemStart:i], fileName); err != nil { + return err + } + elemStart = i + 1 + } + } + if err := checkElem(path[elemStart:], fileName); err != nil { + return err + } + return nil +} + +// checkElem checks whether an individual path element is valid. +// fileName indicates whether the element is a file name (not a directory name). +func checkElem(elem string, fileName bool) error { + if elem == "" { + return fmt.Errorf("empty path element") + } + if strings.Count(elem, ".") == len(elem) { + return fmt.Errorf("invalid path element %q", elem) + } + if elem[0] == '.' && !fileName { + return fmt.Errorf("leading dot in path element") + } + if elem[len(elem)-1] == '.' { + return fmt.Errorf("trailing dot in path element") + } + charOK := pathOK + if fileName { + charOK = fileNameOK + } + for _, r := range elem { + if !charOK(r) { + return fmt.Errorf("invalid char %q", r) + } + } + + // Windows disallows a bunch of path elements, sadly. + // See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file + short := elem + if i := strings.Index(short, "."); i >= 0 { + short = short[:i] + } + for _, bad := range badWindowsNames { + if strings.EqualFold(bad, short) { + return fmt.Errorf("disallowed path element %q", elem) + } + } + return nil +} + +// CheckFilePath checks whether a slash-separated file path is valid. +func CheckFilePath(path string) error { + if err := checkPath(path, true); err != nil { + return fmt.Errorf("malformed file path %q: %v", path, err) + } + return nil +} + +// badWindowsNames are the reserved file path elements on Windows. +// See https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file +var badWindowsNames = []string{ + "CON", + "PRN", + "AUX", + "NUL", + "COM1", + "COM2", + "COM3", + "COM4", + "COM5", + "COM6", + "COM7", + "COM8", + "COM9", + "LPT1", + "LPT2", + "LPT3", + "LPT4", + "LPT5", + "LPT6", + "LPT7", + "LPT8", + "LPT9", +} + +// SplitPathVersion returns prefix and major version such that prefix+pathMajor == path +// and version is either empty or "/vN" for N >= 2. +// As a special case, gopkg.in paths are recognized directly; +// they require ".vN" instead of "/vN", and for all N, not just N >= 2. +func SplitPathVersion(path string) (prefix, pathMajor string, ok bool) { + if strings.HasPrefix(path, "gopkg.in/") { + return splitGopkgIn(path) + } + + i := len(path) + dot := false + for i > 0 && ('0' <= path[i-1] && path[i-1] <= '9' || path[i-1] == '.') { + if path[i-1] == '.' { + dot = true + } + i-- + } + if i <= 1 || path[i-1] != 'v' || path[i-2] != '/' { + return path, "", true + } + prefix, pathMajor = path[:i-2], path[i-2:] + if dot || len(pathMajor) <= 2 || pathMajor[2] == '0' || pathMajor == "/v1" { + return path, "", false + } + return prefix, pathMajor, true +} + +// splitGopkgIn is like SplitPathVersion but only for gopkg.in paths. +func splitGopkgIn(path string) (prefix, pathMajor string, ok bool) { + if !strings.HasPrefix(path, "gopkg.in/") { + return path, "", false + } + i := len(path) + if strings.HasSuffix(path, "-unstable") { + i -= len("-unstable") + } + for i > 0 && ('0' <= path[i-1] && path[i-1] <= '9') { + i-- + } + if i <= 1 || path[i-1] != 'v' || path[i-2] != '.' { + // All gopkg.in paths must end in vN for some N. + return path, "", false + } + prefix, pathMajor = path[:i-2], path[i-2:] + if len(pathMajor) <= 2 || pathMajor[2] == '0' && pathMajor != ".v0" { + return path, "", false + } + return prefix, pathMajor, true +} + +// MatchPathMajor reports whether the semantic version v +// matches the path major version pathMajor. +func MatchPathMajor(v, pathMajor string) bool { + if strings.HasPrefix(pathMajor, ".v") && strings.HasSuffix(pathMajor, "-unstable") { + pathMajor = strings.TrimSuffix(pathMajor, "-unstable") + } + if strings.HasPrefix(v, "v0.0.0-") && pathMajor == ".v1" { + // Allow old bug in pseudo-versions that generated v0.0.0- pseudoversion for gopkg .v1. + // For example, gopkg.in/yaml.v2@v2.2.1's go.mod requires gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405. + return true + } + m := semver.Major(v) + if pathMajor == "" { + return m == "v0" || m == "v1" || semver.Build(v) == "+incompatible" + } + return (pathMajor[0] == '/' || pathMajor[0] == '.') && m == pathMajor[1:] +} + +// CanonicalVersion returns the canonical form of the version string v. +// It is the same as semver.Canonical(v) except that it preserves the special build suffix "+incompatible". +func CanonicalVersion(v string) string { + cv := semver.Canonical(v) + if semver.Build(v) == "+incompatible" { + cv += "+incompatible" + } + return cv +} + +// Sort sorts the list by Path, breaking ties by comparing Versions. +func Sort(list []Version) { + sort.Slice(list, func(i, j int) bool { + mi := list[i] + mj := list[j] + if mi.Path != mj.Path { + return mi.Path < mj.Path + } + // To help go.sum formatting, allow version/file. + // Compare semver prefix by semver rules, + // file by string order. + vi := mi.Version + vj := mj.Version + var fi, fj string + if k := strings.Index(vi, "/"); k >= 0 { + vi, fi = vi[:k], vi[k:] + } + if k := strings.Index(vj, "/"); k >= 0 { + vj, fj = vj[:k], vj[k:] + } + if vi != vj { + return semver.Compare(vi, vj) < 0 + } + return fi < fj + }) +} + +// Safe encodings +// +// Module paths appear as substrings of file system paths +// (in the download cache) and of web server URLs in the proxy protocol. +// In general we cannot rely on file systems to be case-sensitive, +// nor can we rely on web servers, since they read from file systems. +// That is, we cannot rely on the file system to keep rsc.io/QUOTE +// and rsc.io/quote separate. Windows and macOS don't. +// Instead, we must never require two different casings of a file path. +// Because we want the download cache to match the proxy protocol, +// and because we want the proxy protocol to be possible to serve +// from a tree of static files (which might be stored on a case-insensitive +// file system), the proxy protocol must never require two different casings +// of a URL path either. +// +// One possibility would be to make the safe encoding be the lowercase +// hexadecimal encoding of the actual path bytes. This would avoid ever +// needing different casings of a file path, but it would be fairly illegible +// to most programmers when those paths appeared in the file system +// (including in file paths in compiler errors and stack traces) +// in web server logs, and so on. Instead, we want a safe encoding that +// leaves most paths unaltered. +// +// The safe encoding is this: +// replace every uppercase letter with an exclamation mark +// followed by the letter's lowercase equivalent. +// +// For example, +// github.com/Azure/azure-sdk-for-go -> github.com/!azure/azure-sdk-for-go. +// github.com/GoogleCloudPlatform/cloudsql-proxy -> github.com/!google!cloud!platform/cloudsql-proxy +// github.com/Sirupsen/logrus -> github.com/!sirupsen/logrus. +// +// Import paths that avoid upper-case letters are left unchanged. +// Note that because import paths are ASCII-only and avoid various +// problematic punctuation (like : < and >), the safe encoding is also ASCII-only +// and avoids the same problematic punctuation. +// +// Import paths have never allowed exclamation marks, so there is no +// need to define how to encode a literal !. +// +// Although paths are disallowed from using Unicode (see pathOK above), +// the eventual plan is to allow Unicode letters as well, to assume that +// file systems and URLs are Unicode-safe (storing UTF-8), and apply +// the !-for-uppercase convention. Note however that not all runes that +// are different but case-fold equivalent are an upper/lower pair. +// For example, U+004B ('K'), U+006B ('k'), and U+212A ('K' for Kelvin) +// are considered to case-fold to each other. When we do add Unicode +// letters, we must not assume that upper/lower are the only case-equivalent pairs. +// Perhaps the Kelvin symbol would be disallowed entirely, for example. +// Or perhaps it would encode as "!!k", or perhaps as "(212A)". +// +// Also, it would be nice to allow Unicode marks as well as letters, +// but marks include combining marks, and then we must deal not +// only with case folding but also normalization: both U+00E9 ('é') +// and U+0065 U+0301 ('e' followed by combining acute accent) +// look the same on the page and are treated by some file systems +// as the same path. If we do allow Unicode marks in paths, there +// must be some kind of normalization to allow only one canonical +// encoding of any character used in an import path. + +// EncodePath returns the safe encoding of the given module path. +// It fails if the module path is invalid. +func EncodePath(path string) (encoding string, err error) { + if err := CheckPath(path); err != nil { + return "", err + } + + return encodeString(path) +} + +// EncodeVersion returns the safe encoding of the given module version. +// Versions are allowed to be in non-semver form but must be valid file names +// and not contain exclamation marks. +func EncodeVersion(v string) (encoding string, err error) { + if err := checkElem(v, true); err != nil || strings.Contains(v, "!") { + return "", fmt.Errorf("disallowed version string %q", v) + } + return encodeString(v) +} + +func encodeString(s string) (encoding string, err error) { + haveUpper := false + for _, r := range s { + if r == '!' || r >= utf8.RuneSelf { + // This should be disallowed by CheckPath, but diagnose anyway. + // The correctness of the encoding loop below depends on it. + return "", fmt.Errorf("internal error: inconsistency in EncodePath") + } + if 'A' <= r && r <= 'Z' { + haveUpper = true + } + } + + if !haveUpper { + return s, nil + } + + var buf []byte + for _, r := range s { + if 'A' <= r && r <= 'Z' { + buf = append(buf, '!', byte(r+'a'-'A')) + } else { + buf = append(buf, byte(r)) + } + } + return string(buf), nil +} + +// DecodePath returns the module path of the given safe encoding. +// It fails if the encoding is invalid or encodes an invalid path. +func DecodePath(encoding string) (path string, err error) { + path, ok := decodeString(encoding) + if !ok { + return "", fmt.Errorf("invalid module path encoding %q", encoding) + } + if err := CheckPath(path); err != nil { + return "", fmt.Errorf("invalid module path encoding %q: %v", encoding, err) + } + return path, nil +} + +// DecodeVersion returns the version string for the given safe encoding. +// It fails if the encoding is invalid or encodes an invalid version. +// Versions are allowed to be in non-semver form but must be valid file names +// and not contain exclamation marks. +func DecodeVersion(encoding string) (v string, err error) { + v, ok := decodeString(encoding) + if !ok { + return "", fmt.Errorf("invalid version encoding %q", encoding) + } + if err := checkElem(v, true); err != nil { + return "", fmt.Errorf("disallowed version string %q", v) + } + return v, nil +} + +func decodeString(encoding string) (string, bool) { + var buf []byte + + bang := false + for _, r := range encoding { + if r >= utf8.RuneSelf { + return "", false + } + if bang { + bang = false + if r < 'a' || 'z' < r { + return "", false + } + buf = append(buf, byte(r+'A'-'a')) + continue + } + if r == '!' { + bang = true + continue + } + if 'A' <= r && r <= 'Z' { + return "", false + } + buf = append(buf, byte(r)) + } + if bang { + return "", false + } + return string(buf), true +} diff --git a/vendor/github.com/rogpeppe/go-internal/module/module_test.go b/vendor/github.com/rogpeppe/go-internal/module/module_test.go new file mode 100644 index 000000000..f21d620d3 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/module/module_test.go @@ -0,0 +1,318 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package module + +import "testing" + +var checkTests = []struct { + path string + version string + ok bool +}{ + {"rsc.io/quote", "0.1.0", false}, + {"rsc io/quote", "v1.0.0", false}, + + {"github.com/go-yaml/yaml", "v0.8.0", true}, + {"github.com/go-yaml/yaml", "v1.0.0", true}, + {"github.com/go-yaml/yaml", "v2.0.0", false}, + {"github.com/go-yaml/yaml", "v2.1.5", false}, + {"github.com/go-yaml/yaml", "v3.0.0", false}, + + {"github.com/go-yaml/yaml/v2", "v1.0.0", false}, + {"github.com/go-yaml/yaml/v2", "v2.0.0", true}, + {"github.com/go-yaml/yaml/v2", "v2.1.5", true}, + {"github.com/go-yaml/yaml/v2", "v3.0.0", false}, + + {"gopkg.in/yaml.v0", "v0.8.0", true}, + {"gopkg.in/yaml.v0", "v1.0.0", false}, + {"gopkg.in/yaml.v0", "v2.0.0", false}, + {"gopkg.in/yaml.v0", "v2.1.5", false}, + {"gopkg.in/yaml.v0", "v3.0.0", false}, + + {"gopkg.in/yaml.v1", "v0.8.0", false}, + {"gopkg.in/yaml.v1", "v1.0.0", true}, + {"gopkg.in/yaml.v1", "v2.0.0", false}, + {"gopkg.in/yaml.v1", "v2.1.5", false}, + {"gopkg.in/yaml.v1", "v3.0.0", false}, + + // For gopkg.in, .v1 means v1 only (not v0). + // But early versions of vgo still generated v0 pseudo-versions for it. + // Even though now we'd generate those as v1 pseudo-versions, + // we accept the old pseudo-versions to avoid breaking existing go.mod files. + // For example gopkg.in/yaml.v2@v2.2.1's go.mod requires check.v1 at a v0 pseudo-version. + {"gopkg.in/check.v1", "v0.0.0", false}, + {"gopkg.in/check.v1", "v0.0.0-20160102150405-abcdef123456", true}, + + {"gopkg.in/yaml.v2", "v1.0.0", false}, + {"gopkg.in/yaml.v2", "v2.0.0", true}, + {"gopkg.in/yaml.v2", "v2.1.5", true}, + {"gopkg.in/yaml.v2", "v3.0.0", false}, + + {"rsc.io/quote", "v17.0.0", false}, + {"rsc.io/quote", "v17.0.0+incompatible", true}, +} + +func TestCheck(t *testing.T) { + for _, tt := range checkTests { + err := Check(tt.path, tt.version) + if tt.ok && err != nil { + t.Errorf("Check(%q, %q) = %v, wanted nil error", tt.path, tt.version, err) + } else if !tt.ok && err == nil { + t.Errorf("Check(%q, %q) succeeded, wanted error", tt.path, tt.version) + } + } +} + +var checkPathTests = []struct { + path string + ok bool + importOK bool + fileOK bool +}{ + {"x.y/z", true, true, true}, + {"x.y", true, true, true}, + + {"", false, false, false}, + {"x.y/\xFFz", false, false, false}, + {"/x.y/z", false, false, false}, + {"x./z", false, false, false}, + {".x/z", false, false, true}, + {"-x/z", false, true, true}, + {"x..y/z", false, false, false}, + {"x.y/z/../../w", false, false, false}, + {"x.y//z", false, false, false}, + {"x.y/z//w", false, false, false}, + {"x.y/z/", false, false, false}, + + {"x.y/z/v0", false, true, true}, + {"x.y/z/v1", false, true, true}, + {"x.y/z/v2", true, true, true}, + {"x.y/z/v2.0", false, true, true}, + {"X.y/z", false, true, true}, + + {"!x.y/z", false, false, true}, + {"_x.y/z", false, true, true}, + {"x.y!/z", false, false, true}, + {"x.y\"/z", false, false, false}, + {"x.y#/z", false, false, true}, + {"x.y$/z", false, false, true}, + {"x.y%/z", false, false, true}, + {"x.y&/z", false, false, true}, + {"x.y'/z", false, false, false}, + {"x.y(/z", false, false, true}, + {"x.y)/z", false, false, true}, + {"x.y*/z", false, false, false}, + {"x.y+/z", false, true, true}, + {"x.y,/z", false, false, true}, + {"x.y-/z", true, true, true}, + {"x.y./zt", false, false, false}, + {"x.y:/z", false, false, false}, + {"x.y;/z", false, false, false}, + {"x.y/z", false, false, false}, + {"x.y?/z", false, false, false}, + {"x.y@/z", false, false, true}, + {"x.y[/z", false, false, true}, + {"x.y\\/z", false, false, false}, + {"x.y]/z", false, false, true}, + {"x.y^/z", false, false, true}, + {"x.y_/z", false, true, true}, + {"x.y`/z", false, false, false}, + {"x.y{/z", false, false, true}, + {"x.y}/z", false, false, true}, + {"x.y~/z", false, true, true}, + {"x.y/z!", false, false, true}, + {"x.y/z\"", false, false, false}, + {"x.y/z#", false, false, true}, + {"x.y/z$", false, false, true}, + {"x.y/z%", false, false, true}, + {"x.y/z&", false, false, true}, + {"x.y/z'", false, false, false}, + {"x.y/z(", false, false, true}, + {"x.y/z)", false, false, true}, + {"x.y/z*", false, false, false}, + {"x.y/z+", true, true, true}, + {"x.y/z,", false, false, true}, + {"x.y/z-", true, true, true}, + {"x.y/z.t", true, true, true}, + {"x.y/z/t", true, true, true}, + {"x.y/z:", false, false, false}, + {"x.y/z;", false, false, false}, + {"x.y/z<", false, false, false}, + {"x.y/z=", false, false, true}, + {"x.y/z>", false, false, false}, + {"x.y/z?", false, false, false}, + {"x.y/z@", false, false, true}, + {"x.y/z[", false, false, true}, + {"x.y/z\\", false, false, false}, + {"x.y/z]", false, false, true}, + {"x.y/z^", false, false, true}, + {"x.y/z_", true, true, true}, + {"x.y/z`", false, false, false}, + {"x.y/z{", false, false, true}, + {"x.y/z}", false, false, true}, + {"x.y/z~", true, true, true}, + {"x.y/x.foo", true, true, true}, + {"x.y/aux.foo", false, false, false}, + {"x.y/prn", false, false, false}, + {"x.y/prn2", true, true, true}, + {"x.y/com", true, true, true}, + {"x.y/com1", false, false, false}, + {"x.y/com1.txt", false, false, false}, + {"x.y/calm1", true, true, true}, + {"github.com/!123/logrus", false, false, true}, + + // TODO: CL 41822 allowed Unicode letters in old "go get" + // without due consideration of the implications, and only on github.com (!). + // For now, we disallow non-ASCII characters in module mode, + // in both module paths and general import paths, + // until we can get the implications right. + // When we do, we'll enable them everywhere, not just for GitHub. + {"github.com/user/unicode/испытание", false, false, true}, + + {"../x", false, false, false}, + {"./y", false, false, false}, + {"x:y", false, false, false}, + {`\temp\foo`, false, false, false}, + {".gitignore", false, false, true}, + {".github/ISSUE_TEMPLATE", false, false, true}, + {"x☺y", false, false, false}, +} + +func TestCheckPath(t *testing.T) { + for _, tt := range checkPathTests { + err := CheckPath(tt.path) + if tt.ok && err != nil { + t.Errorf("CheckPath(%q) = %v, wanted nil error", tt.path, err) + } else if !tt.ok && err == nil { + t.Errorf("CheckPath(%q) succeeded, wanted error", tt.path) + } + + err = CheckImportPath(tt.path) + if tt.importOK && err != nil { + t.Errorf("CheckImportPath(%q) = %v, wanted nil error", tt.path, err) + } else if !tt.importOK && err == nil { + t.Errorf("CheckImportPath(%q) succeeded, wanted error", tt.path) + } + + err = CheckFilePath(tt.path) + if tt.fileOK && err != nil { + t.Errorf("CheckFilePath(%q) = %v, wanted nil error", tt.path, err) + } else if !tt.fileOK && err == nil { + t.Errorf("CheckFilePath(%q) succeeded, wanted error", tt.path) + } + } +} + +var splitPathVersionTests = []struct { + pathPrefix string + version string +}{ + {"x.y/z", ""}, + {"x.y/z", "/v2"}, + {"x.y/z", "/v3"}, + {"gopkg.in/yaml", ".v0"}, + {"gopkg.in/yaml", ".v1"}, + {"gopkg.in/yaml", ".v2"}, + {"gopkg.in/yaml", ".v3"}, +} + +func TestSplitPathVersion(t *testing.T) { + for _, tt := range splitPathVersionTests { + pathPrefix, version, ok := SplitPathVersion(tt.pathPrefix + tt.version) + if pathPrefix != tt.pathPrefix || version != tt.version || !ok { + t.Errorf("SplitPathVersion(%q) = %q, %q, %v, want %q, %q, true", tt.pathPrefix+tt.version, pathPrefix, version, ok, tt.pathPrefix, tt.version) + } + } + + for _, tt := range checkPathTests { + pathPrefix, version, ok := SplitPathVersion(tt.path) + if pathPrefix+version != tt.path { + t.Errorf("SplitPathVersion(%q) = %q, %q, %v, doesn't add to input", tt.path, pathPrefix, version, ok) + } + } +} + +var encodeTests = []struct { + path string + enc string // empty means same as path +}{ + {path: "ascii.com/abcdefghijklmnopqrstuvwxyz.-+/~_0123456789"}, + {path: "github.com/GoogleCloudPlatform/omega", enc: "github.com/!google!cloud!platform/omega"}, +} + +func TestEncodePath(t *testing.T) { + // Check invalid paths. + for _, tt := range checkPathTests { + if !tt.ok { + _, err := EncodePath(tt.path) + if err == nil { + t.Errorf("EncodePath(%q): succeeded, want error (invalid path)", tt.path) + } + } + } + + // Check encodings. + for _, tt := range encodeTests { + enc, err := EncodePath(tt.path) + if err != nil { + t.Errorf("EncodePath(%q): unexpected error: %v", tt.path, err) + continue + } + want := tt.enc + if want == "" { + want = tt.path + } + if enc != want { + t.Errorf("EncodePath(%q) = %q, want %q", tt.path, enc, want) + } + } +} + +var badDecode = []string{ + "github.com/GoogleCloudPlatform/omega", + "github.com/!google!cloud!platform!/omega", + "github.com/!0google!cloud!platform/omega", + "github.com/!_google!cloud!platform/omega", + "github.com/!!google!cloud!platform/omega", + "", +} + +func TestDecodePath(t *testing.T) { + // Check invalid decodings. + for _, bad := range badDecode { + _, err := DecodePath(bad) + if err == nil { + t.Errorf("DecodePath(%q): succeeded, want error (invalid decoding)", bad) + } + } + + // Check invalid paths (or maybe decodings). + for _, tt := range checkPathTests { + if !tt.ok { + path, err := DecodePath(tt.path) + if err == nil { + t.Errorf("DecodePath(%q) = %q, want error (invalid path)", tt.path, path) + } + } + } + + // Check encodings. + for _, tt := range encodeTests { + enc := tt.enc + if enc == "" { + enc = tt.path + } + path, err := DecodePath(enc) + if err != nil { + t.Errorf("DecodePath(%q): unexpected error: %v", enc, err) + continue + } + if path != tt.path { + t.Errorf("DecodePath(%q) = %q, want %q", enc, path, tt.path) + } + } +} diff --git a/vendor/github.com/rogpeppe/go-internal/par/work.go b/vendor/github.com/rogpeppe/go-internal/par/work.go new file mode 100644 index 000000000..a568c86f6 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/par/work.go @@ -0,0 +1,149 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package par implements parallel execution helpers. +package par + +import ( + "math/rand" + "sync" + "sync/atomic" +) + +// Work manages a set of work items to be executed in parallel, at most once each. +// The items in the set must all be valid map keys. +type Work struct { + f func(interface{}) // function to run for each item + running int // total number of runners + + mu sync.Mutex + added map[interface{}]bool // items added to set + todo []interface{} // items yet to be run + wait sync.Cond // wait when todo is empty + waiting int // number of runners waiting for todo +} + +func (w *Work) init() { + if w.added == nil { + w.added = make(map[interface{}]bool) + } +} + +// Add adds item to the work set, if it hasn't already been added. +func (w *Work) Add(item interface{}) { + w.mu.Lock() + w.init() + if !w.added[item] { + w.added[item] = true + w.todo = append(w.todo, item) + if w.waiting > 0 { + w.wait.Signal() + } + } + w.mu.Unlock() +} + +// Do runs f in parallel on items from the work set, +// with at most n invocations of f running at a time. +// It returns when everything added to the work set has been processed. +// At least one item should have been added to the work set +// before calling Do (or else Do returns immediately), +// but it is allowed for f(item) to add new items to the set. +// Do should only be used once on a given Work. +func (w *Work) Do(n int, f func(item interface{})) { + if n < 1 { + panic("par.Work.Do: n < 1") + } + if w.running >= 1 { + panic("par.Work.Do: already called Do") + } + + w.running = n + w.f = f + w.wait.L = &w.mu + + for i := 0; i < n-1; i++ { + go w.runner() + } + w.runner() +} + +// runner executes work in w until both nothing is left to do +// and all the runners are waiting for work. +// (Then all the runners return.) +func (w *Work) runner() { + for { + // Wait for something to do. + w.mu.Lock() + for len(w.todo) == 0 { + w.waiting++ + if w.waiting == w.running { + // All done. + w.wait.Broadcast() + w.mu.Unlock() + return + } + w.wait.Wait() + w.waiting-- + } + + // Pick something to do at random, + // to eliminate pathological contention + // in case items added at about the same time + // are most likely to contend. + i := rand.Intn(len(w.todo)) + item := w.todo[i] + w.todo[i] = w.todo[len(w.todo)-1] + w.todo = w.todo[:len(w.todo)-1] + w.mu.Unlock() + + w.f(item) + } +} + +// Cache runs an action once per key and caches the result. +type Cache struct { + m sync.Map +} + +type cacheEntry struct { + done uint32 + mu sync.Mutex + result interface{} +} + +// Do calls the function f if and only if Do is being called for the first time with this key. +// No call to Do with a given key returns until the one call to f returns. +// Do returns the value returned by the one call to f. +func (c *Cache) Do(key interface{}, f func() interface{}) interface{} { + entryIface, ok := c.m.Load(key) + if !ok { + entryIface, _ = c.m.LoadOrStore(key, new(cacheEntry)) + } + e := entryIface.(*cacheEntry) + if atomic.LoadUint32(&e.done) == 0 { + e.mu.Lock() + if atomic.LoadUint32(&e.done) == 0 { + e.result = f() + atomic.StoreUint32(&e.done, 1) + } + e.mu.Unlock() + } + return e.result +} + +// Get returns the cached result associated with key. +// It returns nil if there is no such result. +// If the result for key is being computed, Get does not wait for the computation to finish. +func (c *Cache) Get(key interface{}) interface{} { + entryIface, ok := c.m.Load(key) + if !ok { + return nil + } + e := entryIface.(*cacheEntry) + if atomic.LoadUint32(&e.done) == 0 { + return nil + } + return e.result +} diff --git a/vendor/github.com/rogpeppe/go-internal/par/work_test.go b/vendor/github.com/rogpeppe/go-internal/par/work_test.go new file mode 100644 index 000000000..f104bc410 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/par/work_test.go @@ -0,0 +1,77 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package par + +import ( + "sync/atomic" + "testing" + "time" +) + +func TestWork(t *testing.T) { + var w Work + + const N = 10000 + n := int32(0) + w.Add(N) + w.Do(100, func(x interface{}) { + atomic.AddInt32(&n, 1) + i := x.(int) + if i >= 2 { + w.Add(i - 1) + w.Add(i - 2) + } + w.Add(i >> 1) + w.Add((i >> 1) ^ 1) + }) + if n != N+1 { + t.Fatalf("ran %d items, expected %d", n, N+1) + } +} + +func TestWorkParallel(t *testing.T) { + for tries := 0; tries < 10; tries++ { + var w Work + const N = 100 + for i := 0; i < N; i++ { + w.Add(i) + } + start := time.Now() + var n int32 + w.Do(N, func(x interface{}) { + time.Sleep(1 * time.Millisecond) + atomic.AddInt32(&n, +1) + }) + if n != N { + t.Fatalf("par.Work.Do did not do all the work") + } + if time.Since(start) < N/2*time.Millisecond { + return + } + } + t.Fatalf("par.Work.Do does not seem to be parallel") +} + +func TestCache(t *testing.T) { + var cache Cache + + n := 1 + v := cache.Do(1, func() interface{} { n++; return n }) + if v != 2 { + t.Fatalf("cache.Do(1) did not run f") + } + v = cache.Do(1, func() interface{} { n++; return n }) + if v != 2 { + t.Fatalf("cache.Do(1) ran f again!") + } + v = cache.Do(2, func() interface{} { n++; return n }) + if v != 3 { + t.Fatalf("cache.Do(2) did not run f") + } + v = cache.Do(1, func() interface{} { n++; return n }) + if v != 2 { + t.Fatalf("cache.Do(1) did not returned saved value from original cache.Do(1)") + } +} diff --git a/vendor/github.com/rogpeppe/go-internal/semver/semver.go b/vendor/github.com/rogpeppe/go-internal/semver/semver.go new file mode 100644 index 000000000..4af7118e5 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/semver/semver.go @@ -0,0 +1,388 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package semver implements comparison of semantic version strings. +// In this package, semantic version strings must begin with a leading "v", +// as in "v1.0.0". +// +// The general form of a semantic version string accepted by this package is +// +// vMAJOR[.MINOR[.PATCH[-PRERELEASE][+BUILD]]] +// +// where square brackets indicate optional parts of the syntax; +// MAJOR, MINOR, and PATCH are decimal integers without extra leading zeros; +// PRERELEASE and BUILD are each a series of non-empty dot-separated identifiers +// using only alphanumeric characters and hyphens; and +// all-numeric PRERELEASE identifiers must not have leading zeros. +// +// This package follows Semantic Versioning 2.0.0 (see semver.org) +// with two exceptions. First, it requires the "v" prefix. Second, it recognizes +// vMAJOR and vMAJOR.MINOR (with no prerelease or build suffixes) +// as shorthands for vMAJOR.0.0 and vMAJOR.MINOR.0. +package semver + +// parsed returns the parsed form of a semantic version string. +type parsed struct { + major string + minor string + patch string + short string + prerelease string + build string + err string +} + +// IsValid reports whether v is a valid semantic version string. +func IsValid(v string) bool { + _, ok := parse(v) + return ok +} + +// Canonical returns the canonical formatting of the semantic version v. +// It fills in any missing .MINOR or .PATCH and discards build metadata. +// Two semantic versions compare equal only if their canonical formattings +// are identical strings. +// The canonical invalid semantic version is the empty string. +func Canonical(v string) string { + p, ok := parse(v) + if !ok { + return "" + } + if p.build != "" { + return v[:len(v)-len(p.build)] + } + if p.short != "" { + return v + p.short + } + return v +} + +// Major returns the major version prefix of the semantic version v. +// For example, Major("v2.1.0") == "v2". +// If v is an invalid semantic version string, Major returns the empty string. +func Major(v string) string { + pv, ok := parse(v) + if !ok { + return "" + } + return v[:1+len(pv.major)] +} + +// MajorMinor returns the major.minor version prefix of the semantic version v. +// For example, MajorMinor("v2.1.0") == "v2.1". +// If v is an invalid semantic version string, MajorMinor returns the empty string. +func MajorMinor(v string) string { + pv, ok := parse(v) + if !ok { + return "" + } + i := 1 + len(pv.major) + if j := i + 1 + len(pv.minor); j <= len(v) && v[i] == '.' && v[i+1:j] == pv.minor { + return v[:j] + } + return v[:i] + "." + pv.minor +} + +// Prerelease returns the prerelease suffix of the semantic version v. +// For example, Prerelease("v2.1.0-pre+meta") == "-pre". +// If v is an invalid semantic version string, Prerelease returns the empty string. +func Prerelease(v string) string { + pv, ok := parse(v) + if !ok { + return "" + } + return pv.prerelease +} + +// Build returns the build suffix of the semantic version v. +// For example, Build("v2.1.0+meta") == "+meta". +// If v is an invalid semantic version string, Build returns the empty string. +func Build(v string) string { + pv, ok := parse(v) + if !ok { + return "" + } + return pv.build +} + +// Compare returns an integer comparing two versions according to +// according to semantic version precedence. +// The result will be 0 if v == w, -1 if v < w, or +1 if v > w. +// +// An invalid semantic version string is considered less than a valid one. +// All invalid semantic version strings compare equal to each other. +func Compare(v, w string) int { + pv, ok1 := parse(v) + pw, ok2 := parse(w) + if !ok1 && !ok2 { + return 0 + } + if !ok1 { + return -1 + } + if !ok2 { + return +1 + } + if c := compareInt(pv.major, pw.major); c != 0 { + return c + } + if c := compareInt(pv.minor, pw.minor); c != 0 { + return c + } + if c := compareInt(pv.patch, pw.patch); c != 0 { + return c + } + return comparePrerelease(pv.prerelease, pw.prerelease) +} + +// Max canonicalizes its arguments and then returns the version string +// that compares greater. +func Max(v, w string) string { + v = Canonical(v) + w = Canonical(w) + if Compare(v, w) > 0 { + return v + } + return w +} + +func parse(v string) (p parsed, ok bool) { + if v == "" || v[0] != 'v' { + p.err = "missing v prefix" + return + } + p.major, v, ok = parseInt(v[1:]) + if !ok { + p.err = "bad major version" + return + } + if v == "" { + p.minor = "0" + p.patch = "0" + p.short = ".0.0" + return + } + if v[0] != '.' { + p.err = "bad minor prefix" + ok = false + return + } + p.minor, v, ok = parseInt(v[1:]) + if !ok { + p.err = "bad minor version" + return + } + if v == "" { + p.patch = "0" + p.short = ".0" + return + } + if v[0] != '.' { + p.err = "bad patch prefix" + ok = false + return + } + p.patch, v, ok = parseInt(v[1:]) + if !ok { + p.err = "bad patch version" + return + } + if len(v) > 0 && v[0] == '-' { + p.prerelease, v, ok = parsePrerelease(v) + if !ok { + p.err = "bad prerelease" + return + } + } + if len(v) > 0 && v[0] == '+' { + p.build, v, ok = parseBuild(v) + if !ok { + p.err = "bad build" + return + } + } + if v != "" { + p.err = "junk on end" + ok = false + return + } + ok = true + return +} + +func parseInt(v string) (t, rest string, ok bool) { + if v == "" { + return + } + if v[0] < '0' || '9' < v[0] { + return + } + i := 1 + for i < len(v) && '0' <= v[i] && v[i] <= '9' { + i++ + } + if v[0] == '0' && i != 1 { + return + } + return v[:i], v[i:], true +} + +func parsePrerelease(v string) (t, rest string, ok bool) { + // "A pre-release version MAY be denoted by appending a hyphen and + // a series of dot separated identifiers immediately following the patch version. + // Identifiers MUST comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. + // Identifiers MUST NOT be empty. Numeric identifiers MUST NOT include leading zeroes." + if v == "" || v[0] != '-' { + return + } + i := 1 + start := 1 + for i < len(v) && v[i] != '+' { + if !isIdentChar(v[i]) && v[i] != '.' { + return + } + if v[i] == '.' { + if start == i || isBadNum(v[start:i]) { + return + } + start = i + 1 + } + i++ + } + if start == i || isBadNum(v[start:i]) { + return + } + return v[:i], v[i:], true +} + +func parseBuild(v string) (t, rest string, ok bool) { + if v == "" || v[0] != '+' { + return + } + i := 1 + start := 1 + for i < len(v) { + if !isIdentChar(v[i]) { + return + } + if v[i] == '.' { + if start == i { + return + } + start = i + 1 + } + i++ + } + if start == i { + return + } + return v[:i], v[i:], true +} + +func isIdentChar(c byte) bool { + return 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' || c == '-' +} + +func isBadNum(v string) bool { + i := 0 + for i < len(v) && '0' <= v[i] && v[i] <= '9' { + i++ + } + return i == len(v) && i > 1 && v[0] == '0' +} + +func isNum(v string) bool { + i := 0 + for i < len(v) && '0' <= v[i] && v[i] <= '9' { + i++ + } + return i == len(v) +} + +func compareInt(x, y string) int { + if x == y { + return 0 + } + if len(x) < len(y) { + return -1 + } + if len(x) > len(y) { + return +1 + } + if x < y { + return -1 + } else { + return +1 + } +} + +func comparePrerelease(x, y string) int { + // "When major, minor, and patch are equal, a pre-release version has + // lower precedence than a normal version. + // Example: 1.0.0-alpha < 1.0.0. + // Precedence for two pre-release versions with the same major, minor, + // and patch version MUST be determined by comparing each dot separated + // identifier from left to right until a difference is found as follows: + // identifiers consisting of only digits are compared numerically and + // identifiers with letters or hyphens are compared lexically in ASCII + // sort order. Numeric identifiers always have lower precedence than + // non-numeric identifiers. A larger set of pre-release fields has a + // higher precedence than a smaller set, if all of the preceding + // identifiers are equal. + // Example: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < + // 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0." + if x == y { + return 0 + } + if x == "" { + return +1 + } + if y == "" { + return -1 + } + for x != "" && y != "" { + x = x[1:] // skip - or . + y = y[1:] // skip - or . + var dx, dy string + dx, x = nextIdent(x) + dy, y = nextIdent(y) + if dx != dy { + ix := isNum(dx) + iy := isNum(dy) + if ix != iy { + if ix { + return -1 + } else { + return +1 + } + } + if ix { + if len(dx) < len(dy) { + return -1 + } + if len(dx) > len(dy) { + return +1 + } + } + if dx < dy { + return -1 + } else { + return +1 + } + } + } + if x == "" { + return -1 + } else { + return +1 + } +} + +func nextIdent(x string) (dx, rest string) { + i := 0 + for i < len(x) && x[i] != '.' { + i++ + } + return x[:i], x[i:] +} diff --git a/vendor/github.com/rogpeppe/go-internal/semver/semver_test.go b/vendor/github.com/rogpeppe/go-internal/semver/semver_test.go new file mode 100644 index 000000000..96b64a580 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/semver/semver_test.go @@ -0,0 +1,182 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package semver + +import ( + "strings" + "testing" +) + +var tests = []struct { + in string + out string +}{ + {"bad", ""}, + {"v1-alpha.beta.gamma", ""}, + {"v1-pre", ""}, + {"v1+meta", ""}, + {"v1-pre+meta", ""}, + {"v1.2-pre", ""}, + {"v1.2+meta", ""}, + {"v1.2-pre+meta", ""}, + {"v1.0.0-alpha", "v1.0.0-alpha"}, + {"v1.0.0-alpha.1", "v1.0.0-alpha.1"}, + {"v1.0.0-alpha.beta", "v1.0.0-alpha.beta"}, + {"v1.0.0-beta", "v1.0.0-beta"}, + {"v1.0.0-beta.2", "v1.0.0-beta.2"}, + {"v1.0.0-beta.11", "v1.0.0-beta.11"}, + {"v1.0.0-rc.1", "v1.0.0-rc.1"}, + {"v1", "v1.0.0"}, + {"v1.0", "v1.0.0"}, + {"v1.0.0", "v1.0.0"}, + {"v1.2", "v1.2.0"}, + {"v1.2.0", "v1.2.0"}, + {"v1.2.3-456", "v1.2.3-456"}, + {"v1.2.3-456.789", "v1.2.3-456.789"}, + {"v1.2.3-456-789", "v1.2.3-456-789"}, + {"v1.2.3-456a", "v1.2.3-456a"}, + {"v1.2.3-pre", "v1.2.3-pre"}, + {"v1.2.3-pre+meta", "v1.2.3-pre"}, + {"v1.2.3-pre.1", "v1.2.3-pre.1"}, + {"v1.2.3-zzz", "v1.2.3-zzz"}, + {"v1.2.3", "v1.2.3"}, + {"v1.2.3+meta", "v1.2.3"}, + {"v1.2.3+meta-pre", "v1.2.3"}, +} + +func TestIsValid(t *testing.T) { + for _, tt := range tests { + ok := IsValid(tt.in) + if ok != (tt.out != "") { + t.Errorf("IsValid(%q) = %v, want %v", tt.in, ok, !ok) + } + } +} + +func TestCanonical(t *testing.T) { + for _, tt := range tests { + out := Canonical(tt.in) + if out != tt.out { + t.Errorf("Canonical(%q) = %q, want %q", tt.in, out, tt.out) + } + } +} + +func TestMajor(t *testing.T) { + for _, tt := range tests { + out := Major(tt.in) + want := "" + if i := strings.Index(tt.out, "."); i >= 0 { + want = tt.out[:i] + } + if out != want { + t.Errorf("Major(%q) = %q, want %q", tt.in, out, want) + } + } +} + +func TestMajorMinor(t *testing.T) { + for _, tt := range tests { + out := MajorMinor(tt.in) + var want string + if tt.out != "" { + want = tt.in + if i := strings.Index(want, "+"); i >= 0 { + want = want[:i] + } + if i := strings.Index(want, "-"); i >= 0 { + want = want[:i] + } + switch strings.Count(want, ".") { + case 0: + want += ".0" + case 1: + // ok + case 2: + want = want[:strings.LastIndex(want, ".")] + } + } + if out != want { + t.Errorf("MajorMinor(%q) = %q, want %q", tt.in, out, want) + } + } +} + +func TestPrerelease(t *testing.T) { + for _, tt := range tests { + pre := Prerelease(tt.in) + var want string + if tt.out != "" { + if i := strings.Index(tt.out, "-"); i >= 0 { + want = tt.out[i:] + } + } + if pre != want { + t.Errorf("Prerelease(%q) = %q, want %q", tt.in, pre, want) + } + } +} + +func TestBuild(t *testing.T) { + for _, tt := range tests { + build := Build(tt.in) + var want string + if tt.out != "" { + if i := strings.Index(tt.in, "+"); i >= 0 { + want = tt.in[i:] + } + } + if build != want { + t.Errorf("Build(%q) = %q, want %q", tt.in, build, want) + } + } +} + +func TestCompare(t *testing.T) { + for i, ti := range tests { + for j, tj := range tests { + cmp := Compare(ti.in, tj.in) + var want int + if ti.out == tj.out { + want = 0 + } else if i < j { + want = -1 + } else { + want = +1 + } + if cmp != want { + t.Errorf("Compare(%q, %q) = %d, want %d", ti.in, tj.in, cmp, want) + } + } + } +} + +func TestMax(t *testing.T) { + for i, ti := range tests { + for j, tj := range tests { + max := Max(ti.in, tj.in) + want := Canonical(ti.in) + if i < j { + want = Canonical(tj.in) + } + if max != want { + t.Errorf("Max(%q, %q) = %q, want %q", ti.in, tj.in, max, want) + } + } + } +} + +var ( + v1 = "v1.0.0+metadata-dash" + v2 = "v1.0.0+metadata-dash1" +) + +func BenchmarkCompare(b *testing.B) { + for i := 0; i < b.N; i++ { + if Compare(v1, v2) != 0 { + b.Fatalf("bad compare") + } + } +} diff --git a/vendor/github.com/rogpeppe/go-internal/testenv/testenv.go b/vendor/github.com/rogpeppe/go-internal/testenv/testenv.go new file mode 100644 index 000000000..8f69fe0da --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testenv/testenv.go @@ -0,0 +1,248 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package testenv provides information about what functionality +// is available in different testing environments run by the Go team. +// +// It is an internal package because these details are specific +// to the Go team's test setup (on build.golang.org) and not +// fundamental to tests in general. +package testenv + +import ( + "errors" + "flag" + "os" + "os/exec" + "path/filepath" + "runtime" + "strconv" + "strings" + "testing" +) + +// Builder reports the name of the builder running this test +// (for example, "linux-amd64" or "windows-386-gce"). +// If the test is not running on the build infrastructure, +// Builder returns the empty string. +func Builder() string { + return os.Getenv("GO_BUILDER_NAME") +} + +// HasGoBuild reports whether the current system can build programs with ``go build'' +// and then run them with os.StartProcess or exec.Command. +func HasGoBuild() bool { + if os.Getenv("GO_GCFLAGS") != "" { + // It's too much work to require every caller of the go command + // to pass along "-gcflags="+os.Getenv("GO_GCFLAGS"). + // For now, if $GO_GCFLAGS is set, report that we simply can't + // run go build. + return false + } + switch runtime.GOOS { + case "android", "nacl", "js": + return false + case "darwin": + if strings.HasPrefix(runtime.GOARCH, "arm") { + return false + } + } + return true +} + +// MustHaveGoBuild checks that the current system can build programs with ``go build'' +// and then run them with os.StartProcess or exec.Command. +// If not, MustHaveGoBuild calls t.Skip with an explanation. +func MustHaveGoBuild(t testing.TB) { + if os.Getenv("GO_GCFLAGS") != "" { + t.Skipf("skipping test: 'go build' not compatible with setting $GO_GCFLAGS") + } + if !HasGoBuild() { + t.Skipf("skipping test: 'go build' not available on %s/%s", runtime.GOOS, runtime.GOARCH) + } +} + +// HasGoRun reports whether the current system can run programs with ``go run.'' +func HasGoRun() bool { + // For now, having go run and having go build are the same. + return HasGoBuild() +} + +// MustHaveGoRun checks that the current system can run programs with ``go run.'' +// If not, MustHaveGoRun calls t.Skip with an explanation. +func MustHaveGoRun(t testing.TB) { + if !HasGoRun() { + t.Skipf("skipping test: 'go run' not available on %s/%s", runtime.GOOS, runtime.GOARCH) + } +} + +// GoToolPath reports the path to the Go tool. +// It is a convenience wrapper around GoTool. +// If the tool is unavailable GoToolPath calls t.Skip. +// If the tool should be available and isn't, GoToolPath calls t.Fatal. +func GoToolPath(t testing.TB) string { + MustHaveGoBuild(t) + path, err := GoTool() + if err != nil { + t.Fatal(err) + } + return path +} + +// GoTool reports the path to the Go tool. +func GoTool() (string, error) { + if !HasGoBuild() { + return "", errors.New("platform cannot run go tool") + } + var exeSuffix string + if runtime.GOOS == "windows" { + exeSuffix = ".exe" + } + path := filepath.Join(runtime.GOROOT(), "bin", "go"+exeSuffix) + if _, err := os.Stat(path); err == nil { + return path, nil + } + goBin, err := exec.LookPath("go" + exeSuffix) + if err != nil { + return "", errors.New("cannot find go tool: " + err.Error()) + } + return goBin, nil +} + +// HasExec reports whether the current system can start new processes +// using os.StartProcess or (more commonly) exec.Command. +func HasExec() bool { + switch runtime.GOOS { + case "nacl", "js": + return false + case "darwin": + if strings.HasPrefix(runtime.GOARCH, "arm") { + return false + } + } + return true +} + +// HasSrc reports whether the entire source tree is available under GOROOT. +func HasSrc() bool { + switch runtime.GOOS { + case "nacl": + return false + case "darwin": + if strings.HasPrefix(runtime.GOARCH, "arm") { + return false + } + } + return true +} + +// MustHaveExec checks that the current system can start new processes +// using os.StartProcess or (more commonly) exec.Command. +// If not, MustHaveExec calls t.Skip with an explanation. +func MustHaveExec(t testing.TB) { + if !HasExec() { + t.Skipf("skipping test: cannot exec subprocess on %s/%s", runtime.GOOS, runtime.GOARCH) + } +} + +// HasExternalNetwork reports whether the current system can use +// external (non-localhost) networks. +func HasExternalNetwork() bool { + return !testing.Short() && runtime.GOOS != "nacl" && runtime.GOOS != "js" +} + +// MustHaveExternalNetwork checks that the current system can use +// external (non-localhost) networks. +// If not, MustHaveExternalNetwork calls t.Skip with an explanation. +func MustHaveExternalNetwork(t testing.TB) { + if runtime.GOOS == "nacl" || runtime.GOOS == "js" { + t.Skipf("skipping test: no external network on %s", runtime.GOOS) + } + if testing.Short() { + t.Skipf("skipping test: no external network in -short mode") + } +} + +var haveCGO bool + +// HasCGO reports whether the current system can use cgo. +func HasCGO() bool { + return haveCGO +} + +// MustHaveCGO calls t.Skip if cgo is not available. +func MustHaveCGO(t testing.TB) { + if !haveCGO { + t.Skipf("skipping test: no cgo") + } +} + +// HasSymlink reports whether the current system can use os.Symlink. +func HasSymlink() bool { + ok, _ := hasSymlink() + return ok +} + +// MustHaveSymlink reports whether the current system can use os.Symlink. +// If not, MustHaveSymlink calls t.Skip with an explanation. +func MustHaveSymlink(t testing.TB) { + ok, reason := hasSymlink() + if !ok { + t.Skipf("skipping test: cannot make symlinks on %s/%s%s", runtime.GOOS, runtime.GOARCH, reason) + } +} + +// HasLink reports whether the current system can use os.Link. +func HasLink() bool { + // From Android release M (Marshmallow), hard linking files is blocked + // and an attempt to call link() on a file will return EACCES. + // - https://code.google.com/p/android-developer-preview/issues/detail?id=3150 + return runtime.GOOS != "plan9" && runtime.GOOS != "android" +} + +// MustHaveLink reports whether the current system can use os.Link. +// If not, MustHaveLink calls t.Skip with an explanation. +func MustHaveLink(t testing.TB) { + if !HasLink() { + t.Skipf("skipping test: hardlinks are not supported on %s/%s", runtime.GOOS, runtime.GOARCH) + } +} + +var flaky = flag.Bool("flaky", false, "run known-flaky tests too") + +func SkipFlaky(t testing.TB, issue int) { + t.Helper() + if !*flaky { + t.Skipf("skipping known flaky test without the -flaky flag; see golang.org/issue/%d", issue) + } +} + +func SkipFlakyNet(t testing.TB) { + t.Helper() + if v, _ := strconv.ParseBool(os.Getenv("GO_BUILDER_FLAKY_NET")); v { + t.Skip("skipping test on builder known to have frequent network failures") + } +} + +// CleanCmdEnv will fill cmd.Env with the environment, excluding certain +// variables that could modify the behavior of the Go tools such as +// GODEBUG and GOTRACEBACK. +func CleanCmdEnv(cmd *exec.Cmd) *exec.Cmd { + if cmd.Env != nil { + panic("environment already set") + } + for _, env := range os.Environ() { + // Exclude GODEBUG from the environment to prevent its output + // from breaking tests that are trying to parse other command output. + if strings.HasPrefix(env, "GODEBUG=") { + continue + } + // Exclude GOTRACEBACK for the same reason. + if strings.HasPrefix(env, "GOTRACEBACK=") { + continue + } + cmd.Env = append(cmd.Env, env) + } + return cmd +} diff --git a/vendor/github.com/rogpeppe/go-internal/testenv/testenv_cgo.go b/vendor/github.com/rogpeppe/go-internal/testenv/testenv_cgo.go new file mode 100644 index 000000000..e3d4d16b3 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testenv/testenv_cgo.go @@ -0,0 +1,11 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build cgo + +package testenv + +func init() { + haveCGO = true +} diff --git a/vendor/github.com/rogpeppe/go-internal/testenv/testenv_notwin.go b/vendor/github.com/rogpeppe/go-internal/testenv/testenv_notwin.go new file mode 100644 index 000000000..d8ce6cd38 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testenv/testenv_notwin.go @@ -0,0 +1,20 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !windows + +package testenv + +import ( + "runtime" +) + +func hasSymlink() (ok bool, reason string) { + switch runtime.GOOS { + case "android", "nacl", "plan9": + return false, "" + } + + return true, "" +} diff --git a/vendor/github.com/rogpeppe/go-internal/testenv/testenv_windows.go b/vendor/github.com/rogpeppe/go-internal/testenv/testenv_windows.go new file mode 100644 index 000000000..eb8d6ac16 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testenv/testenv_windows.go @@ -0,0 +1,48 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package testenv + +import ( + "io/ioutil" + "os" + "path/filepath" + "sync" + "syscall" +) + +var symlinkOnce sync.Once +var winSymlinkErr error + +func initWinHasSymlink() { + tmpdir, err := ioutil.TempDir("", "symtest") + if err != nil { + panic("failed to create temp directory: " + err.Error()) + } + defer os.RemoveAll(tmpdir) + + err = os.Symlink("target", filepath.Join(tmpdir, "symlink")) + if err != nil { + err = err.(*os.LinkError).Err + switch err { + case syscall.EWINDOWS, syscall.ERROR_PRIVILEGE_NOT_HELD: + winSymlinkErr = err + } + } +} + +func hasSymlink() (ok bool, reason string) { + symlinkOnce.Do(initWinHasSymlink) + + switch winSymlinkErr { + case nil: + return true, "" + case syscall.EWINDOWS: + return false, ": symlinks are not supported on your version of Windows" + case syscall.ERROR_PRIVILEGE_NOT_HELD: + return false, ": you don't have enough privileges to create symlinks" + } + + return false, "" +} diff --git a/vendor/github.com/rogpeppe/go-internal/testscript/cmd.go b/vendor/github.com/rogpeppe/go-internal/testscript/cmd.go new file mode 100644 index 000000000..e66ed9916 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testscript/cmd.go @@ -0,0 +1,377 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package testscript + +import ( + "io/ioutil" + "os" + "path/filepath" + "regexp" + "strconv" + "strings" +) + +// scriptCmds are the script command implementations. +// Keep list and the implementations below sorted by name. +// +// NOTE: If you make changes here, update doc.go. +// +var scriptCmds = map[string]func(*TestScript, bool, []string){ + "cd": (*TestScript).cmdCd, + "chmod": (*TestScript).cmdChmod, + "cmp": (*TestScript).cmdCmp, + "cp": (*TestScript).cmdCp, + "env": (*TestScript).cmdEnv, + "exec": (*TestScript).cmdExec, + "exists": (*TestScript).cmdExists, + "grep": (*TestScript).cmdGrep, + "mkdir": (*TestScript).cmdMkdir, + "rm": (*TestScript).cmdRm, + "skip": (*TestScript).cmdSkip, + "stderr": (*TestScript).cmdStderr, + "stdout": (*TestScript).cmdStdout, + "stop": (*TestScript).cmdStop, + "symlink": (*TestScript).cmdSymlink, +} + +// cd changes to a different directory. +func (ts *TestScript) cmdCd(neg bool, args []string) { + if neg { + ts.Fatalf("unsupported: ! cd") + } + if len(args) != 1 { + ts.Fatalf("usage: cd dir") + } + + dir := args[0] + if !filepath.IsAbs(dir) { + dir = filepath.Join(ts.cd, dir) + } + info, err := os.Stat(dir) + if os.IsNotExist(err) { + ts.Fatalf("directory %s does not exist", dir) + } + ts.Check(err) + if !info.IsDir() { + ts.Fatalf("%s is not a directory", dir) + } + ts.cd = dir + ts.Logf("%s\n", ts.cd) +} + +func (ts *TestScript) cmdChmod(neg bool, args []string) { + if len(args) != 2 { + ts.Fatalf("usage: chmod mode file") + } + mode, err := strconv.ParseInt(args[0], 8, 32) + if err != nil { + ts.Fatalf("bad file mode %q: %v", args[0], err) + } + if mode > 0777 { + ts.Fatalf("unsupported file mode %.3o", mode) + } + err = os.Chmod(ts.MkAbs(args[1]), os.FileMode(mode)) + if neg { + if err == nil { + ts.Fatalf("unexpected chmod success") + } + return + } + if err != nil { + ts.Fatalf("unexpected chmod failure: %v", err) + } +} + +// cmp compares two files. +func (ts *TestScript) cmdCmp(neg bool, args []string) { + if neg { + // It would be strange to say "this file can have any content except this precise byte sequence". + ts.Fatalf("unsupported: ! cmp") + } + if len(args) != 2 { + ts.Fatalf("usage: cmp file1 file2") + } + + name1, name2 := args[0], args[1] + var text1, text2 string + if name1 == "stdout" { + text1 = ts.stdout + } else if name1 == "stderr" { + text1 = ts.stderr + } else { + data, err := ioutil.ReadFile(ts.MkAbs(name1)) + ts.Check(err) + text1 = string(data) + } + + data, err := ioutil.ReadFile(ts.MkAbs(name2)) + ts.Check(err) + text2 = string(data) + + if text1 == text2 { + return + } + + ts.Logf("[diff -%s +%s]\n%s\n", name1, name2, diff(text1, text2)) + ts.Fatalf("%s and %s differ", name1, name2) +} + +// cp copies files, maybe eventually directories. +func (ts *TestScript) cmdCp(neg bool, args []string) { + if neg { + ts.Fatalf("unsupported: ! cp") + } + if len(args) < 2 { + ts.Fatalf("usage: cp src... dst") + } + + dst := ts.MkAbs(args[len(args)-1]) + info, err := os.Stat(dst) + dstDir := err == nil && info.IsDir() + if len(args) > 2 && !dstDir { + ts.Fatalf("cp: destination %s is not a directory", dst) + } + + for _, arg := range args[:len(args)-1] { + src := ts.MkAbs(arg) + info, err := os.Stat(src) + ts.Check(err) + data, err := ioutil.ReadFile(src) + ts.Check(err) + targ := dst + if dstDir { + targ = filepath.Join(dst, filepath.Base(src)) + } + ts.Check(ioutil.WriteFile(targ, data, info.Mode()&0777)) + } +} + +// env displays or adds to the environment. +func (ts *TestScript) cmdEnv(neg bool, args []string) { + if neg { + ts.Fatalf("unsupported: ! env") + } + if len(args) == 0 { + printed := make(map[string]bool) // env list can have duplicates; only print effective value (from envMap) once + for _, kv := range ts.env { + k := kv[:strings.Index(kv, "=")] + if !printed[k] { + ts.Logf("%s=%s\n", k, ts.envMap[k]) + } + } + return + } + for _, env := range args { + i := strings.Index(env, "=") + if i < 0 { + // Display value instead of setting it. + ts.Logf("%s=%s\n", env, ts.envMap[env]) + continue + } + ts.env = append(ts.env, env) + ts.envMap[env[:i]] = env[i+1:] + } +} + +// exec runs the given command. +func (ts *TestScript) cmdExec(neg bool, args []string) { + if len(args) < 1 { + ts.Fatalf("usage: exec program [args...]") + } + err := ts.Exec(args[0], args[1:]...) + if err != nil { + ts.Logf("[%v]\n", err) + if !neg { + ts.Fatalf("unexpected command failure") + } + } else { + if neg { + ts.Fatalf("unexpected command success") + } + } +} + +// exists checks that the list of files exists. +func (ts *TestScript) cmdExists(neg bool, args []string) { + var readonly bool + if len(args) > 0 && args[0] == "-readonly" { + readonly = true + args = args[1:] + } + if len(args) == 0 { + ts.Fatalf("usage: exists [-readonly] file...") + } + + for _, file := range args { + file = ts.MkAbs(file) + info, err := os.Stat(file) + if err == nil && neg { + what := "file" + if info.IsDir() { + what = "directory" + } + ts.Fatalf("%s %s unexpectedly exists", what, file) + } + if err != nil && !neg { + ts.Fatalf("%s does not exist", file) + } + if err == nil && !neg && readonly && info.Mode()&0222 != 0 { + ts.Fatalf("%s exists but is writable", file) + } + } +} + +// mkdir creates directories. +func (ts *TestScript) cmdMkdir(neg bool, args []string) { + if neg { + ts.Fatalf("unsupported: ! mkdir") + } + if len(args) < 1 { + ts.Fatalf("usage: mkdir dir...") + } + for _, arg := range args { + ts.Check(os.MkdirAll(ts.MkAbs(arg), 0777)) + } +} + +// rm removes files or directories. +func (ts *TestScript) cmdRm(neg bool, args []string) { + if neg { + ts.Fatalf("unsupported: ! rm") + } + if len(args) < 1 { + ts.Fatalf("usage: rm file...") + } + for _, arg := range args { + file := ts.MkAbs(arg) + removeAll(file) // does chmod and then attempts rm + ts.Check(os.RemoveAll(file)) // report error + } +} + +// skip marks the test skipped. +func (ts *TestScript) cmdSkip(neg bool, args []string) { + if len(args) > 1 { + ts.Fatalf("usage: skip [msg]") + } + if neg { + ts.Fatalf("unsupported: ! skip") + } + if len(args) == 1 { + ts.t.Skip(args[0]) + } + ts.t.Skip() +} + +// stdout checks that the last go command standard output matches a regexp. +func (ts *TestScript) cmdStdout(neg bool, args []string) { + scriptMatch(ts, neg, args, ts.stdout, "stdout") +} + +// stderr checks that the last go command standard output matches a regexp. +func (ts *TestScript) cmdStderr(neg bool, args []string) { + scriptMatch(ts, neg, args, ts.stderr, "stderr") +} + +// grep checks that file content matches a regexp. +// Like stdout/stderr and unlike Unix grep, it accepts Go regexp syntax. +func (ts *TestScript) cmdGrep(neg bool, args []string) { + scriptMatch(ts, neg, args, "", "grep") +} + +// stop stops execution of the test (marking it passed). +func (ts *TestScript) cmdStop(neg bool, args []string) { + if neg { + ts.Fatalf("unsupported: ! stop") + } + if len(args) > 1 { + ts.Fatalf("usage: stop [msg]") + } + if len(args) == 1 { + ts.Logf("stop: %s\n", args[0]) + } else { + ts.Logf("stop\n") + } + ts.stopped = true +} + +// symlink creates a symbolic link. +func (ts *TestScript) cmdSymlink(neg bool, args []string) { + if neg { + ts.Fatalf("unsupported: ! symlink") + } + if len(args) != 3 || args[1] != "->" { + ts.Fatalf("usage: symlink file -> target") + } + // Note that the link target args[2] is not interpreted with MkAbs: + // it will be interpreted relative to the directory file is in. + ts.Check(os.Symlink(args[2], ts.MkAbs(args[0]))) +} + +// scriptMatch implements both stdout and stderr. +func scriptMatch(ts *TestScript, neg bool, args []string, text, name string) { + n := 0 + if len(args) >= 1 && strings.HasPrefix(args[0], "-count=") { + if neg { + ts.Fatalf("cannot use -count= with negated match") + } + var err error + n, err = strconv.Atoi(args[0][len("-count="):]) + if err != nil { + ts.Fatalf("bad -count=: %v", err) + } + if n < 1 { + ts.Fatalf("bad -count=: must be at least 1") + } + args = args[1:] + } + + extraUsage := "" + want := 1 + if name == "grep" { + extraUsage = " file" + want = 2 + } + if len(args) != want { + ts.Fatalf("usage: %s [-count=N] 'pattern'%s", name, extraUsage) + } + + pattern := args[0] + re, err := regexp.Compile(`(?m)` + pattern) + ts.Check(err) + + isGrep := name == "grep" + if isGrep { + name = args[1] // for error messages + data, err := ioutil.ReadFile(ts.MkAbs(args[1])) + ts.Check(err) + text = string(data) + } + + if neg { + if re.MatchString(text) { + if isGrep { + ts.Logf("[%s]\n%s\n", name, text) + } + ts.Fatalf("unexpected match for %#q found in %s: %s", pattern, name, re.FindString(text)) + } + } else { + if !re.MatchString(text) { + if isGrep { + ts.Logf("[%s]\n%s\n", name, text) + } + ts.Fatalf("no match for %#q found in %s", pattern, name) + } + if n > 0 { + count := len(re.FindAllString(text, -1)) + if count != n { + if isGrep { + ts.Logf("[%s]\n%s\n", name, text) + } + ts.Fatalf("have %d matches for %#q, want %d", count, pattern, n) + } + } + } +} diff --git a/vendor/github.com/rogpeppe/go-internal/testscript/cover.go b/vendor/github.com/rogpeppe/go-internal/testscript/cover.go new file mode 100644 index 000000000..0a01f7db6 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testscript/cover.go @@ -0,0 +1,272 @@ +package testscript + +import ( + "bufio" + "fmt" + "io" + "log" + "os" + "regexp" + "strconv" + "strings" + "sync/atomic" + "testing" + + "gopkg.in/errgo.v2/fmt/errors" +) + +// mergeCoverProfile merges the coverage information in f into +// cover. It assumes that the coverage information in f is +// always produced from the same binary for every call. +func mergeCoverProfile(cover *testing.Cover, r io.Reader) error { + scanner, err := newProfileScanner(r) + if err != nil { + return errors.Wrap(err) + } + if scanner.Mode() != testing.CoverMode() { + return errors.Newf("unexpected coverage mode in subcommand") + } + if cover.Mode == "" { + cover.Mode = scanner.Mode() + } + isCount := cover.Mode == "count" + if cover.Counters == nil { + cover.Counters = make(map[string][]uint32) + cover.Blocks = make(map[string][]testing.CoverBlock) + } + + // Note that we rely on the fact that the coverage is written + // out file-by-file, with all blocks for a file in sequence. + var ( + filename string + blockId uint32 + counters []uint32 + blocks []testing.CoverBlock + ) + flush := func() { + if len(counters) > 0 { + cover.Counters[filename] = counters + cover.Blocks[filename] = blocks + } + } + for scanner.Scan() { + block := scanner.Block() + if scanner.Filename() != filename { + flush() + filename = scanner.Filename() + counters = cover.Counters[filename] + blocks = cover.Blocks[filename] + blockId = 0 + } else { + blockId++ + } + if int(blockId) >= len(counters) { + counters = append(counters, block.Count) + blocks = append(blocks, block.CoverBlock) + continue + } + // TODO check that block.CoverBlock == blocks[blockId] ? + if isCount { + counters[blockId] += block.Count + } else { + counters[blockId] |= block.Count + } + } + flush() + if scanner.Err() != nil { + return errors.Notef(err, nil, "error scanning profile") + } + return nil +} + +var ( + coverChan chan *os.File + coverDone chan testing.Cover +) + +func goCoverProfileMerge() { + if coverChan != nil { + panic("RunMain called twice!") + } + coverChan = make(chan *os.File) + coverDone = make(chan testing.Cover) + go mergeCoverProfiles() +} + +func mergeCoverProfiles() { + var cover testing.Cover + for f := range coverChan { + if err := mergeCoverProfile(&cover, f); err != nil { + log.Printf("cannot merge coverage profile from %v: %v", f.Name(), err) + } + f.Close() + os.Remove(f.Name()) + } + coverDone <- cover +} + +func finalizeCoverProfile() error { + cprof := coverProfile() + if cprof == "" { + return nil + } + f, err := os.Open(cprof) + if err != nil { + return errors.Notef(err, nil, "cannot open existing cover profile") + } + coverChan <- f + close(coverChan) + cover := <-coverDone + f, err = os.Create(cprof) + if err != nil { + return errors.Notef(err, nil, "cannot create cover profile") + } + defer f.Close() + w := bufio.NewWriter(f) + if err := writeCoverProfile1(w, cover); err != nil { + return errors.Wrap(err) + } + if err := w.Flush(); err != nil { + return errors.Wrap(err) + } + if err := f.Close(); err != nil { + return errors.Wrap(err) + } + return nil +} + +func writeCoverProfile1(w io.Writer, cover testing.Cover) error { + fmt.Fprintf(w, "mode: %s\n", cover.Mode) + var active, total int64 + var count uint32 + for name, counts := range cover.Counters { + blocks := cover.Blocks[name] + for i := range counts { + stmts := int64(blocks[i].Stmts) + total += stmts + count = atomic.LoadUint32(&counts[i]) // For -mode=atomic. + if count > 0 { + active += stmts + } + _, err := fmt.Fprintf(w, "%s:%d.%d,%d.%d %d %d\n", name, + blocks[i].Line0, blocks[i].Col0, + blocks[i].Line1, blocks[i].Col1, + stmts, + count, + ) + if err != nil { + return errors.Wrap(err) + } + } + } + if total == 0 { + total = 1 + } + fmt.Printf("total coverage: %.1f%% of statements%s\n", 100*float64(active)/float64(total), cover.CoveredPackages) + return nil +} + +type profileScanner struct { + mode string + err error + scanner *bufio.Scanner + filename string + block coverBlock +} + +type coverBlock struct { + testing.CoverBlock + Count uint32 +} + +var profileLineRe = regexp.MustCompile(`^(.+):([0-9]+)\.([0-9]+),([0-9]+)\.([0-9]+) ([0-9]+) ([0-9]+)$`) + +func toInt(s string) int { + i, err := strconv.Atoi(s) + if err != nil { + panic(err) + } + return i +} + +func newProfileScanner(r io.Reader) (*profileScanner, error) { + s := &profileScanner{ + scanner: bufio.NewScanner(r), + } + // First line is "mode: foo", where foo is "set", "count", or "atomic". + // Rest of file is in the format + // encoding/base64/base64.go:34.44,37.40 3 1 + // where the fields are: name.go:line.column,line.column numberOfStatements count + if !s.scanner.Scan() { + return nil, errors.Newf("no lines found in profile: %v", s.Err()) + } + line := s.scanner.Text() + mode := strings.TrimPrefix(line, "mode: ") + if len(mode) == len(line) { + return nil, fmt.Errorf("bad mode line %q", line) + } + s.mode = mode + return s, nil +} + +// Mode returns the profile's coverage mode (one of "atomic", "count: +// or "set"). +func (s *profileScanner) Mode() string { + return s.mode +} + +// Err returns any error encountered when scanning a profile. +func (s *profileScanner) Err() error { + if s.err == io.EOF { + return nil + } + return s.err +} + +// Block returns the most recently scanned profile block, or the zero +// block if Scan has not been called or has returned false. +func (s *profileScanner) Block() coverBlock { + if s.err == nil { + return s.block + } + return coverBlock{} +} + +// Filename returns the filename of the most recently scanned profile +// block, or the empty string if Scan has not been called or has +// returned false. +func (s *profileScanner) Filename() string { + if s.err == nil { + return s.filename + } + return "" +} + +// Scan scans the next line in a coverage profile and reports whether +// a line was found. +func (s *profileScanner) Scan() bool { + if s.err != nil { + return false + } + if !s.scanner.Scan() { + s.err = io.EOF + return false + } + m := profileLineRe.FindStringSubmatch(s.scanner.Text()) + if m == nil { + s.err = errors.Newf("line %q doesn't match expected format %v", m, profileLineRe) + return false + } + s.filename = m[1] + s.block = coverBlock{ + CoverBlock: testing.CoverBlock{ + Line0: uint32(toInt(m[2])), + Col0: uint16(toInt(m[3])), + Line1: uint32(toInt(m[4])), + Col1: uint16(toInt(m[5])), + Stmts: uint16(toInt(m[6])), + }, + Count: uint32(toInt(m[7])), + } + return true +} diff --git a/vendor/github.com/rogpeppe/go-internal/testscript/doc.go b/vendor/github.com/rogpeppe/go-internal/testscript/doc.go new file mode 100644 index 000000000..c1a35f8f9 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testscript/doc.go @@ -0,0 +1,282 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +/* +Package testscript provides support for defining filesystem-based tests by +creating scripts in a directory. + +To invoke the tests, call testscript.Run. For example: + + func TestFoo(t *testing.T) { + testscript.Run(t, testscript.Params{ + Dir: "scripts", + }) + } + +A testscript directory holds test scripts *.txt run during 'go test'. +Each script defines a subtest; the exact set of allowable commands in a +script are defined by the parameters passed to the Run function. +To run a specific script foo.txt + + go test cmd/go -run=TestName/^foo$ + +where TestName is the name of the test that Run is called from. + +To define an executable command (or several) that can be run as part of the script, +call RunMain with the functions that implement the command's functionality. +The command functions will be called in a separate process, so are +free to mutate global variables without polluting the top level test binary. + + func TestMain(m *testing.M) { + os.Exit(testscript.RunMain(m, map[string] func() int{ + "testscript": testscriptMain, + })) + } + +In general script files should have short names: a few words, not whole sentences. +The first word should be the general category of behavior being tested, +often the name of a subcommand to be tested or a concept (vendor, pattern). + +Each script is a text archive (go doc github.com/rogpeppe/go-internal/txtar). +The script begins with an actual command script to run +followed by the content of zero or more supporting files to +create in the script's temporary file system before it starts executing. + +As an example: + + # hello world + exec cat hello + stdout "hello world\n" + ! stderr . + + -- hello.txt-- + hello world + +Each script runs in a fresh temporary work directory tree, available to scripts as $WORK. +Scripts also have access to these other environment variables: + + HOME=/no-home + PATH= + TMPDIR=$WORK/tmp + devnull= + +The environment variable $exe (lowercase) is an empty string on most +systems, ".exe" on Windows. + +The script's supporting files are unpacked relative to $WORK +and then the script begins execution in that +directory as well. Thus the example above runs in $WORK +with $WORK/hello.txt containing the listed contents. + +The lines at the top of the script are a sequence of commands to be +executed by a small script engine in the testscript package (not the system +shell). The script stops and the overall test fails if any particular +command fails. + +Each line is parsed into a sequence of space-separated command words, +with environment variable expansion and # marking an end-of-line comment. +Adding single quotes around text keeps spaces in that text from being +treated as word separators and also disables environment variable +expansion. Inside a single-quoted block of text, a repeated single +quote indicates a literal single quote, as in: + + 'Don''t communicate by sharing memory.' + +A line beginning with # is a comment and conventionally explains what is +being done or tested at the start of a new phase in the script. + +The command prefix ! indicates that the command on the rest of the line +(typically go or a matching predicate) must fail, not succeed. Only certain +commands support this prefix. They are indicated below by [!] in the synopsis. + +The command prefix [cond] indicates that the command on the rest of the line +should only run when the condition is satisfied. The predefined conditions are: + + - [short] for testing.Short() + - [net] for whether the external network can be used + - [link] for whether the OS has hard link support + - [symlink] for whether the OS has symbolic link support + - [exec:prog] for whether prog is available for execution (found by exec.LookPath) + +A condition can be negated: [!short] means to run the rest of the line +when testing.Short() is false. + +Additional conditions can be added by passing a function to Params.Condition. + +The predefined commands are: + +- cd dir + Change to the given directory for future commands. + +- chmod mode file + + Change the permissions of file or directory to the given octal mode (000 to 777). + +- cmp file1 file2 + Check that the named files have the same content. + By convention, file1 is the actual data and file2 the expected data. + File1 can be "stdout" or "stderr" to use the standard output or standard error + from the most recent exec or go command. + (If the files have differing content, the failure prints a diff.) + +- cp src... dst + Copy the listed files to the target file or existing directory. + +- env [key=value...] + With no arguments, print the environment (useful for debugging). + Otherwise add the listed key=value pairs to the environment. + +- [!] exec program [args...] + Run the given executable program with the arguments. + It must (or must not) succeed. + Note that 'exec' does not terminate the script (unlike in Unix shells). + +- [!] exists [-readonly] file... + Each of the listed files or directories must (or must not) exist. + If -readonly is given, the files or directories must be unwritable. + +- [!] grep [-count=N] pattern file + The file's content must (or must not) match the regular expression pattern. + For positive matches, -count=N specifies an exact number of matches to require. + +- mkdir path... + Create the listed directories, if they do not already exists. + +- rm file... + Remove the listed files or directories. + +- skip [message] + Mark the test skipped, including the message if given. + +- [!] stderr [-count=N] pattern + Apply the grep command (see above) to the standard error + from the most recent exec or go command. + +- [!] stdout [-count=N] pattern + Apply the grep command (see above) to the standard output + from the most recent exec or go command. + +- stop [message] + Stop the test early (marking it as passing), including the message if given. + +- symlink file -> target + Create file as a symlink to target. The -> (like in ls -l output) is required. + +When TestScript runs a script and the script fails, by default TestScript shows +the execution of the most recent phase of the script (since the last # comment) +and only shows the # comments for earlier phases. For example, here is a +multi-phase script with a bug in it (TODO: make this example less go-command +specific): + + # GOPATH with p1 in d2, p2 in d2 + env GOPATH=$WORK/d1${:}$WORK/d2 + + # build & install p1 + env + go install -i p1 + ! stale p1 + ! stale p2 + + # modify p2 - p1 should appear stale + cp $WORK/p2x.go $WORK/d2/src/p2/p2.go + stale p1 p2 + + # build & install p1 again + go install -i p11 + ! stale p1 + ! stale p2 + + -- $WORK/d1/src/p1/p1.go -- + package p1 + import "p2" + func F() { p2.F() } + -- $WORK/d2/src/p2/p2.go -- + package p2 + func F() {} + -- $WORK/p2x.go -- + package p2 + func F() {} + func G() {} + +The bug is that the final phase installs p11 instead of p1. The test failure looks like: + + $ go test -run=Script + --- FAIL: TestScript (3.75s) + --- FAIL: TestScript/install_rebuild_gopath (0.16s) + script_test.go:223: + # GOPATH with p1 in d2, p2 in d2 (0.000s) + # build & install p1 (0.087s) + # modify p2 - p1 should appear stale (0.029s) + # build & install p1 again (0.022s) + > go install -i p11 + [stderr] + can't load package: package p11: cannot find package "p11" in any of: + /Users/rsc/go/src/p11 (from $GOROOT) + $WORK/d1/src/p11 (from $GOPATH) + $WORK/d2/src/p11 + [exit status 1] + FAIL: unexpected go command failure + + script_test.go:73: failed at testdata/script/install_rebuild_gopath.txt:15 in $WORK/gopath/src + + FAIL + exit status 1 + FAIL cmd/go 4.875s + $ + +Note that the commands in earlier phases have been hidden, so that the relevant +commands are more easily found, and the elapsed time for a completed phase +is shown next to the phase heading. To see the entire execution, use "go test -v", +which also adds an initial environment dump to the beginning of the log. + +Note also that in reported output, the actual name of the per-script temporary directory +has been consistently replaced with the literal string $WORK. + +If Params.TestWork is true, it causes each test to log the name of its $WORK directory and other +environment variable settings and also to leave that directory behind when it exits, +for manual debugging of failing tests: + + $ go test -run=Script -work + --- FAIL: TestScript (3.75s) + --- FAIL: TestScript/install_rebuild_gopath (0.16s) + script_test.go:223: + WORK=/tmp/cmd-go-test-745953508/script-install_rebuild_gopath + GOARCH= + GOCACHE=/Users/rsc/Library/Caches/go-build + GOOS= + GOPATH=$WORK/gopath + GOROOT=/Users/rsc/go + HOME=/no-home + TMPDIR=$WORK/tmp + exe= + + # GOPATH with p1 in d2, p2 in d2 (0.000s) + # build & install p1 (0.085s) + # modify p2 - p1 should appear stale (0.030s) + # build & install p1 again (0.019s) + > go install -i p11 + [stderr] + can't load package: package p11: cannot find package "p11" in any of: + /Users/rsc/go/src/p11 (from $GOROOT) + $WORK/d1/src/p11 (from $GOPATH) + $WORK/d2/src/p11 + [exit status 1] + FAIL: unexpected go command failure + + script_test.go:73: failed at testdata/script/install_rebuild_gopath.txt:15 in $WORK/gopath/src + + FAIL + exit status 1 + FAIL cmd/go 4.875s + $ + + $ WORK=/tmp/cmd-go-test-745953508/script-install_rebuild_gopath + $ cd $WORK/d1/src/p1 + $ cat p1.go + package p1 + import "p2" + func F() { p2.F() } + $ +*/ +package testscript diff --git a/vendor/github.com/rogpeppe/go-internal/testscript/exe.go b/vendor/github.com/rogpeppe/go-internal/testscript/exe.go new file mode 100644 index 000000000..554a48534 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testscript/exe.go @@ -0,0 +1,203 @@ +package testscript + +import ( + "flag" + "fmt" + "io" + "log" + "os" + "sync/atomic" + "testing" +) + +var profileId int32 = 0 + +// TestingM is implemented by *testing.M. It's defined as an interface +// to allow testscript to co-exist with other testing frameworks +// that might also wish to call M.Run. +type TestingM interface { + Run() int +} + +var ignoreMissedCoverage = false + +// IgnoreMissedCoverage causes any missed coverage information +// (for example when a function passed to RunMain +// calls os.Exit, for example) to be ignored. +// This function should be called before calling RunMain. +func IgnoreMissedCoverage() { + ignoreMissedCoverage = true +} + +// RunMain should be called within a TestMain function to allow +// subcommands to be run in the testscript context. +// +// The commands map holds the set of command names, each +// with an associated run function which should return the +// code to pass to os.Exit. It's OK for a command function to +// exit itself, but this may result in loss of coverage information. +// +// This function returns an exit code to pass to os.Exit, after calling m.Run. +func RunMain(m TestingM, commands map[string]func() int) (exitCode int) { + goCoverProfileMerge() + cmdName := os.Getenv("TESTSCRIPT_COMMAND") + if cmdName == "" { + defer func() { + if err := finalizeCoverProfile(); err != nil { + log.Printf("cannot merge cover profiles: %v", err) + exitCode = 2 + } + }() + // We're not in a subcommand. + for name := range commands { + name := name + scriptCmds[name] = func(ts *TestScript, neg bool, args []string) { + path, err := os.Executable() + if err != nil { + ts.Fatalf("cannot determine path to test binary: %v", err) + } + id := atomic.AddInt32(&profileId, 1) - 1 + oldEnvLen := len(ts.env) + cprof := coverFilename(id) + ts.env = append(ts.env, + "TESTSCRIPT_COMMAND="+name, + "TESTSCRIPT_COVERPROFILE="+cprof, + ) + ts.cmdExec(neg, append([]string{path}, args...)) + ts.env = ts.env[0:oldEnvLen] + if cprof == "" { + return + } + f, err := os.Open(cprof) + if err != nil { + if ignoreMissedCoverage { + return + } + ts.Fatalf("command %s (args %q) failed to generate coverage information", name, args) + return + } + coverChan <- f + } + } + return m.Run() + } + mainf := commands[cmdName] + if mainf == nil { + log.Printf("unknown command name %q", cmdName) + return 2 + } + // The command being registered is being invoked, so run it, then exit. + os.Args[0] = cmdName + cprof := os.Getenv("TESTSCRIPT_COVERPROFILE") + if cprof == "" { + // No coverage, act as normal. + return mainf() + } + return runCoverSubcommand(cprof, mainf) +} + +// runCoverSubcommand runs the given function, then writes any generated +// coverage information to the cprof file. +// This is called inside a separately run executable. +func runCoverSubcommand(cprof string, mainf func() int) (exitCode int) { + // Change the error handling mode to PanicOnError + // so that in the common case of calling flag.Parse in main we'll + // be able to catch the panic instead of just exiting. + flag.CommandLine.Init(flag.CommandLine.Name(), flag.PanicOnError) + defer func() { + panicErr := recover() + if _, ok := panicErr.(error); ok { + // The flag package will already have printed this error, assuming, + // that is, that the error was created in the flag package. + // TODO check the stack to be sure it was actually raised by the flag package. + exitCode = 2 + panicErr = nil + } + // Set os.Args so that flag.Parse will tell testing the correct + // coverprofile setting. Unfortunately this isn't sufficient because + // the testing oackage explicitly avoids calling flag.Parse again + // if flag.Parsed returns true, so we the coverprofile value directly + // too. + os.Args = []string{os.Args[0], "-test.coverprofile=" + cprof} + setCoverProfile(cprof) + + // Suppress the chatty coverage and test report. + devNull, err := os.Open(os.DevNull) + if err != nil { + panic(err) + } + os.Stdout = devNull + os.Stderr = devNull + + // Run MainStart (recursively, but it we should be ok) with no tests + // so that it writes the coverage profile. + m := testing.MainStart(nopTestDeps{}, nil, nil, nil) + if code := m.Run(); code != 0 && exitCode == 0 { + exitCode = code + } + if _, err := os.Stat(cprof); err != nil { + log.Printf("failed to write coverage profile %q", cprof) + } + if panicErr != nil { + // The error didn't originate from the flag package (we know that + // flag.PanicOnError causes an error value that implements error), + // so carry on panicking. + panic(panicErr) + } + }() + return mainf() +} + +func coverFilename(id int32) string { + if cprof := coverProfile(); cprof != "" { + return fmt.Sprintf("%s_%d", cprof, id) + } + return "" +} + +func coverProfileFlag() flag.Getter { + f := flag.CommandLine.Lookup("test.coverprofile") + if f == nil { + // We've imported testing so it definitely should be there. + panic("cannot find test.coverprofile flag") + } + return f.Value.(flag.Getter) +} + +func coverProfile() string { + return coverProfileFlag().Get().(string) +} + +func setCoverProfile(cprof string) { + coverProfileFlag().Set(cprof) +} + +type nopTestDeps struct{} + +func (nopTestDeps) MatchString(pat, str string) (result bool, err error) { + return false, nil +} + +func (nopTestDeps) StartCPUProfile(w io.Writer) error { + return nil +} + +func (nopTestDeps) StopCPUProfile() {} + +func (nopTestDeps) WriteProfileTo(name string, w io.Writer, debug int) error { + return nil +} +func (nopTestDeps) ImportPath() string { + return "" +} +func (nopTestDeps) StartTestLog(w io.Writer) {} + +func (nopTestDeps) StopTestLog() error { + return nil +} + +// Note: WriteHeapProfile is needed for Go 1.10 but not Go 1.11. +func (nopTestDeps) WriteHeapProfile(io.Writer) error { + // Not needed for Go 1.10. + return nil +} diff --git a/vendor/github.com/rogpeppe/go-internal/testscript/scripts/command.txt b/vendor/github.com/rogpeppe/go-internal/testscript/scripts/command.txt new file mode 100644 index 000000000..b4070fd19 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testscript/scripts/command.txt @@ -0,0 +1,2 @@ +printargs a b 'c d' +stdout '\["printargs" "a" "b" "c d"\]\n' diff --git a/vendor/github.com/rogpeppe/go-internal/testscript/scripts/commandstatus.txt b/vendor/github.com/rogpeppe/go-internal/testscript/scripts/commandstatus.txt new file mode 100644 index 000000000..c1d420873 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testscript/scripts/commandstatus.txt @@ -0,0 +1,3 @@ +! status 1 +! status 2 +status 0 diff --git a/vendor/github.com/rogpeppe/go-internal/testscript/scripts/execguard.txt b/vendor/github.com/rogpeppe/go-internal/testscript/scripts/execguard.txt new file mode 100644 index 000000000..3ee4b6c91 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testscript/scripts/execguard.txt @@ -0,0 +1,6 @@ +[exec:nosuchcommand] exec nosuchcommand +[exec:cat] exec cat foo +stdout 'foo\n' + +-- foo -- +foo diff --git a/vendor/github.com/rogpeppe/go-internal/testscript/scripts/exists.txt b/vendor/github.com/rogpeppe/go-internal/testscript/scripts/exists.txt new file mode 100644 index 000000000..99e57ea83 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testscript/scripts/exists.txt @@ -0,0 +1,12 @@ +chmod 444 foo_r +exists foo +! exists unfoo +# TODO The following line fails but probably should not. +# ! exists -readonly foo +exists foo_r +exists -readonly foo_r + +-- foo -- +foo + +-- foo_r -- diff --git a/vendor/github.com/rogpeppe/go-internal/testscript/scripts/hello.txt b/vendor/github.com/rogpeppe/go-internal/testscript/scripts/hello.txt new file mode 100644 index 000000000..5289db175 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testscript/scripts/hello.txt @@ -0,0 +1,7 @@ +# hello world +exec cat hello.text +stdout 'hello world\n' +! stderr . + +-- hello.text -- +hello world diff --git a/vendor/github.com/rogpeppe/go-internal/testscript/testscript.go b/vendor/github.com/rogpeppe/go-internal/testscript/testscript.go new file mode 100644 index 000000000..21c069e72 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testscript/testscript.go @@ -0,0 +1,577 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Script-driven tests. +// See testdata/script/README for an overview. + +package testscript + +import ( + "bytes" + "flag" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + "sync/atomic" + "testing" + "time" + + "github.com/rogpeppe/go-internal/par" + "github.com/rogpeppe/go-internal/testenv" + "github.com/rogpeppe/go-internal/txtar" +) + +var execCache par.Cache + +// If -testwork is specified, the test prints the name of the temp directory +// and does not remove it when done, so that a programmer can +// poke at the test file tree afterward. +var testWork = flag.Bool("testwork", false, "") + +// Env holds the environment to use at the start of a test script invocation. +type Env struct { + WorkDir string + Vars []string + Cd string +} + +// Params holds parameters for a call to Run. +type Params struct { + // Dir holds the name of the directory holding the scripts. + // All files in the directory with a .txt suffix will be considered + // as test scripts. By default the current directory is used. + // Dir is interpreted relative to the current test directory. + Dir string + + // Setup is called, if not nil, to complete any setup required + // for a test. The WorkDir and Vars fields will have already + // been initialized, and Cd will be the same as WorkDir. + // The Setup function may modify Vars and Cd as it wishes. + Setup func(*Env) error + + // Condition is called, if not nil, to determine whether a particular + // condition is true. It's called only for conditions not in the + // standard set, and may be nil. + Condition func(cond string) (bool, error) + + // Cmds holds a map of commands available to the script. + // It will only be consulted for commands not part of the standard set. + Cmds map[string]func(ts *TestScript, neg bool, args []string) + + // TestWork specifies that working directories should be + // left intact for later inspection. + TestWork bool + + // IgnoreMissedCoverage specifies that if coverage information + // is being generated (with the -test.coverprofile flag) and a subcommand + // function passed to RunMain fails to generate coverage information + // (for example because the function invoked os.Exit), then the + // error will be ignored. + IgnoreMissedCoverage bool +} + +// RunDir runs the tests in the given directory. All files in dir with a ".txt" +// are considered to be test files. +func Run(t *testing.T, p Params) { + files, err := filepath.Glob(filepath.Join(p.Dir, "*.txt")) + if err != nil { + t.Fatal(err) + } + testTempDir, err := ioutil.TempDir(os.Getenv("GOTMPDIR"), "go-test-script") + if err != nil { + t.Fatal(err) + } + refCount := int32(len(files)) + for _, file := range files { + file := file + name := strings.TrimSuffix(filepath.Base(file), ".txt") + t.Run(name, func(t *testing.T) { + t.Parallel() + ts := &TestScript{ + t: t, + testTempDir: testTempDir, + name: name, + file: file, + params: p, + } + ts.setup() + if !p.TestWork { + defer func() { + removeAll(ts.workdir) + if atomic.AddInt32(&refCount, -1) == 0 { + // This is the last subtest to finish. Remove the + // parent directory too. + os.Remove(testTempDir) + } + }() + } + ts.run() + }) + } +} + +// A TestScript holds execution state for a single test script. +type TestScript struct { + params Params + t *testing.T + testTempDir string + workdir string // temporary work dir ($WORK) + log bytes.Buffer // test execution log (printed at end of test) + mark int // offset of next log truncation + cd string // current directory during test execution; initially $WORK/gopath/src + name string // short name of test ("foo") + file string // full file name ("testdata/script/foo.txt") + lineno int // line number currently executing + line string // line currently executing + env []string // environment list (for os/exec) + envMap map[string]string // environment mapping (matches env) + stdout string // standard output from last 'go' command; for 'stdout' command + stderr string // standard error from last 'go' command; for 'stderr' command + stopped bool // test wants to stop early + start time.Time // time phase started +} + +// setup sets up the test execution temporary directory and environment. +func (ts *TestScript) setup() { + ts.workdir = filepath.Join(ts.testTempDir, "script-"+ts.name) + ts.Check(os.MkdirAll(filepath.Join(ts.workdir, "tmp"), 0777)) + env := &Env{ + Vars: []string{ + "WORK=" + ts.workdir, // must be first for ts.abbrev + "PATH=" + os.Getenv("PATH"), + homeEnvName() + "=/no-home", + tempEnvName() + "=" + filepath.Join(ts.workdir, "tmp"), + "devnull=" + os.DevNull, + ":=" + string(os.PathListSeparator), + }, + WorkDir: ts.workdir, + Cd: ts.workdir, + } + if ts.params.Setup != nil { + ts.Check(ts.params.Setup(env)) + } + ts.cd = env.Cd + ts.env = env.Vars + + ts.envMap = make(map[string]string) + for _, kv := range ts.env { + if i := strings.Index(kv, "="); i >= 0 { + ts.envMap[kv[:i]] = kv[i+1:] + } + } +} + +// run runs the test script. +func (ts *TestScript) run() { + // Truncate log at end of last phase marker, + // discarding details of successful phase. + rewind := func() { + if !testing.Verbose() { + ts.log.Truncate(ts.mark) + } + } + + // Insert elapsed time for phase at end of phase marker + markTime := func() { + if ts.mark > 0 && !ts.start.IsZero() { + afterMark := append([]byte{}, ts.log.Bytes()[ts.mark:]...) + ts.log.Truncate(ts.mark - 1) // cut \n and afterMark + fmt.Fprintf(&ts.log, " (%.3fs)\n", time.Since(ts.start).Seconds()) + ts.log.Write(afterMark) + } + ts.start = time.Time{} + } + + defer func() { + markTime() + // Flush testScript log to testing.T log. + ts.t.Log("\n" + ts.abbrev(ts.log.String())) + }() + + // Unpack archive. + a, err := txtar.ParseFile(ts.file) + ts.Check(err) + for _, f := range a.Files { + name := ts.MkAbs(ts.expand(f.Name)) + ts.Check(os.MkdirAll(filepath.Dir(name), 0777)) + ts.Check(ioutil.WriteFile(name, f.Data, 0666)) + } + + // With -v or -testwork, start log with full environment. + if *testWork || testing.Verbose() { + // Display environment. + ts.cmdEnv(false, nil) + fmt.Fprintf(&ts.log, "\n") + ts.mark = ts.log.Len() + } + + // Run script. + // See testdata/script/README for documentation of script form. + script := string(a.Comment) +Script: + for script != "" { + // Extract next line. + ts.lineno++ + var line string + if i := strings.Index(script, "\n"); i >= 0 { + line, script = script[:i], script[i+1:] + } else { + line, script = script, "" + } + + // # is a comment indicating the start of new phase. + if strings.HasPrefix(line, "#") { + // If there was a previous phase, it succeeded, + // so rewind the log to delete its details (unless -v is in use). + // If nothing has happened at all since the mark, + // rewinding is a no-op and adding elapsed time + // for doing nothing is meaningless, so don't. + if ts.log.Len() > ts.mark { + rewind() + markTime() + } + // Print phase heading and mark start of phase output. + fmt.Fprintf(&ts.log, "%s\n", line) + ts.mark = ts.log.Len() + ts.start = time.Now() + continue + } + + // Parse input line. Ignore blanks entirely. + args := ts.parse(line) + if len(args) == 0 { + continue + } + + // Echo command to log. + fmt.Fprintf(&ts.log, "> %s\n", line) + + // Command prefix [cond] means only run this command if cond is satisfied. + for strings.HasPrefix(args[0], "[") && strings.HasSuffix(args[0], "]") { + cond := args[0] + cond = cond[1 : len(cond)-1] + cond = strings.TrimSpace(cond) + args = args[1:] + if len(args) == 0 { + ts.Fatalf("missing command after condition") + } + want := true + if strings.HasPrefix(cond, "!") { + want = false + cond = strings.TrimSpace(cond[1:]) + } + ok, err := ts.condition(cond) + if err != nil { + ts.Fatalf("bad condition %q: %v", cond, err) + } + if ok != want { + // Don't run rest of line. + continue Script + } + } + + // Command prefix ! means negate the expectations about this command: + // go command should fail, match should not be found, etc. + neg := false + if args[0] == "!" { + neg = true + args = args[1:] + if len(args) == 0 { + ts.Fatalf("! on line by itself") + } + } + + // Run command. + cmd := scriptCmds[args[0]] + if cmd == nil { + cmd = ts.params.Cmds[args[0]] + } + if cmd == nil { + ts.Fatalf("unknown command %q", args[0]) + } + cmd(ts, neg, args[1:]) + + // Command can ask script to stop early. + if ts.stopped { + return + } + } + + // Final phase ended. + rewind() + markTime() + fmt.Fprintf(&ts.log, "PASS\n") +} + +// condition reports whether the given condition is satisfied. +func (ts *TestScript) condition(cond string) (bool, error) { + switch cond { + case "short": + return testing.Short(), nil + case "net": + return testenv.HasExternalNetwork(), nil + case "link": + return testenv.HasLink(), nil + case "symlink": + return testenv.HasSymlink(), nil + default: + if strings.HasPrefix(cond, "exec:") { + prog := cond[len("exec:"):] + ok := execCache.Do(prog, func() interface{} { + _, err := exec.LookPath(prog) + return err == nil + }).(bool) + return ok, nil + } + if ts.params.Condition != nil { + return ts.params.Condition(cond) + } + ts.Fatalf("unknown condition %q", cond) + panic("unreachable") + } +} + +// Helpers for command implementations. + +// abbrev abbreviates the actual work directory in the string s to the literal string "$WORK". +func (ts *TestScript) abbrev(s string) string { + s = strings.Replace(s, ts.workdir, "$WORK", -1) + if *testWork { + // Expose actual $WORK value in environment dump on first line of work script, + // so that the user can find out what directory -testwork left behind. + s = "WORK=" + ts.workdir + "\n" + strings.TrimPrefix(s, "WORK=$WORK\n") + } + return s +} + +// Check calls ts.Fatalf if err != nil. +func (ts *TestScript) Check(err error) { + if err != nil { + ts.Fatalf("%v", err) + } +} + +// Logf appends the given formatted message to the test log transcript. +func (ts *TestScript) Logf(format string, args ...interface{}) { + format = strings.TrimSuffix(format, "\n") + fmt.Fprintf(&ts.log, format, args...) + ts.log.WriteByte('\n') +} + +// exec runs the given command line (an actual subprocess, not simulated) +// in ts.cd with environment ts.env and then returns collected standard output and standard error. +func (ts *TestScript) exec(command string, args ...string) (stdout, stderr string, err error) { + cmd := exec.Command(command, args...) + cmd.Dir = ts.cd + cmd.Env = append(ts.env, "PWD="+ts.cd) + var stdoutBuf, stderrBuf strings.Builder + cmd.Stdout = &stdoutBuf + cmd.Stderr = &stderrBuf + err = cmd.Run() + return stdoutBuf.String(), stderrBuf.String(), err +} + +// Exec runs the given command and saves its stdout and stderr so +// they can be inspected by subsequent script commands. +func (ts *TestScript) Exec(command string, args ...string) error { + var err error + ts.stdout, ts.stderr, err = ts.exec(command, args...) + if ts.stdout != "" { + ts.Logf("[stdout]\n%s", ts.stdout) + } + if ts.stderr != "" { + ts.Logf("[stderr]\n%s", ts.stderr) + } + return err +} + +// expand applies environment variable expansion to the string s. +func (ts *TestScript) expand(s string) string { + return os.Expand(s, func(key string) string { return ts.envMap[key] }) +} + +// fatalf aborts the test with the given failure message. +func (ts *TestScript) Fatalf(format string, args ...interface{}) { + fmt.Fprintf(&ts.log, "FAIL: %s:%d: %s\n", ts.file, ts.lineno, fmt.Sprintf(format, args...)) + ts.t.FailNow() +} + +// MkAbs interprets file relative to the test script's current directory +// and returns the corresponding absolute path. +func (ts *TestScript) MkAbs(file string) string { + if filepath.IsAbs(file) { + return file + } + return filepath.Join(ts.cd, file) +} + +// parse parses a single line as a list of space-separated arguments +// subject to environment variable expansion (but not resplitting). +// Single quotes around text disable splitting and expansion. +// To embed a single quote, double it: 'Don''t communicate by sharing memory.' +func (ts *TestScript) parse(line string) []string { + ts.line = line + + var ( + args []string + arg string // text of current arg so far (need to add line[start:i]) + start = -1 // if >= 0, position where current arg text chunk starts + quoted = false // currently processing quoted text + ) + for i := 0; ; i++ { + if !quoted && (i >= len(line) || line[i] == ' ' || line[i] == '\t' || line[i] == '\r' || line[i] == '#') { + // Found arg-separating space. + if start >= 0 { + arg += ts.expand(line[start:i]) + args = append(args, arg) + start = -1 + arg = "" + } + if i >= len(line) || line[i] == '#' { + break + } + continue + } + if i >= len(line) { + ts.Fatalf("unterminated quoted argument") + } + if line[i] == '\'' { + if !quoted { + // starting a quoted chunk + if start >= 0 { + arg += ts.expand(line[start:i]) + } + start = i + 1 + quoted = true + continue + } + // 'foo''bar' means foo'bar, like in rc shell and Pascal. + if i+1 < len(line) && line[i+1] == '\'' { + arg += line[start:i] + start = i + 1 + i++ // skip over second ' before next iteration + continue + } + // ending a quoted chunk + arg += line[start:i] + start = i + 1 + quoted = false + continue + } + // found character worth saving; make sure we're saving + if start < 0 { + start = i + } + } + return args +} + +// diff returns a formatted diff of the two texts, +// showing the entire text and the minimum line-level +// additions and removals to turn text1 into text2. +// (That is, lines only in text1 appear with a leading -, +// and lines only in text2 appear with a leading +.) +func diff(text1, text2 string) string { + if text1 != "" && !strings.HasSuffix(text1, "\n") { + text1 += "(missing final newline)" + } + lines1 := strings.Split(text1, "\n") + lines1 = lines1[:len(lines1)-1] // remove empty string after final line + if text2 != "" && !strings.HasSuffix(text2, "\n") { + text2 += "(missing final newline)" + } + lines2 := strings.Split(text2, "\n") + lines2 = lines2[:len(lines2)-1] // remove empty string after final line + + // Naive dynamic programming algorithm for edit distance. + // https://en.wikipedia.org/wiki/Wagner–Fischer_algorithm + // dist[i][j] = edit distance between lines1[:len(lines1)-i] and lines2[:len(lines2)-j] + // (The reversed indices make following the minimum cost path + // visit lines in the same order as in the text.) + dist := make([][]int, len(lines1)+1) + for i := range dist { + dist[i] = make([]int, len(lines2)+1) + if i == 0 { + for j := range dist[0] { + dist[0][j] = j + } + continue + } + for j := range dist[i] { + if j == 0 { + dist[i][0] = i + continue + } + cost := dist[i][j-1] + 1 + if cost > dist[i-1][j]+1 { + cost = dist[i-1][j] + 1 + } + if lines1[len(lines1)-i] == lines2[len(lines2)-j] { + if cost > dist[i-1][j-1] { + cost = dist[i-1][j-1] + } + } + dist[i][j] = cost + } + } + + var buf strings.Builder + i, j := len(lines1), len(lines2) + for i > 0 || j > 0 { + cost := dist[i][j] + if i > 0 && j > 0 && cost == dist[i-1][j-1] && lines1[len(lines1)-i] == lines2[len(lines2)-j] { + fmt.Fprintf(&buf, " %s\n", lines1[len(lines1)-i]) + i-- + j-- + } else if i > 0 && cost == dist[i-1][j]+1 { + fmt.Fprintf(&buf, "-%s\n", lines1[len(lines1)-i]) + i-- + } else { + fmt.Fprintf(&buf, "+%s\n", lines2[len(lines2)-j]) + j-- + } + } + return buf.String() +} + +func removeAll(dir string) error { + // module cache has 0444 directories; + // make them writable in order to remove content. + filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { + if err != nil { + return nil // ignore errors walking in file system + } + if info.IsDir() { + os.Chmod(path, 0777) + } + return nil + }) + return os.RemoveAll(dir) +} + +func homeEnvName() string { + switch runtime.GOOS { + case "windows": + return "USERPROFILE" + case "plan9": + return "home" + default: + return "HOME" + } +} + +func tempEnvName() string { + switch runtime.GOOS { + case "windows": + return "TMP" + case "plan9": + return "TMPDIR" // actually plan 9 doesn't have one at all but this is fine + default: + return "TMPDIR" + } +} diff --git a/vendor/github.com/rogpeppe/go-internal/testscript/testscript_test.go b/vendor/github.com/rogpeppe/go-internal/testscript/testscript_test.go new file mode 100644 index 000000000..89e87f99c --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/testscript/testscript_test.go @@ -0,0 +1,71 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package testscript + +import ( + "fmt" + "os" + "strconv" + "strings" + "testing" +) + +func printArgs() int { + fmt.Printf("%q\n", os.Args) + return 0 +} + +func exitWithStatus() int { + n, _ := strconv.Atoi(os.Args[1]) + return n +} + +func TestMain(m *testing.M) { + os.Exit(RunMain(m, map[string]func() int{ + "printargs": printArgs, + "status": exitWithStatus, + })) +} + +func TestSimple(t *testing.T) { + // TODO set temp directory. + Run(t, Params{ + Dir: "scripts", + }) + // TODO check that the temp directory has been removed. +} + +var diffTests = []struct { + text1 string + text2 string + diff string +}{ + {"a b c", "a b d e f", "a b -c +d +e +f"}, + {"", "a b c", "+a +b +c"}, + {"a b c", "", "-a -b -c"}, + {"a b c", "d e f", "-a -b -c +d +e +f"}, + {"a b c d e f", "a b d e f", "a b -c d e f"}, + {"a b c e f", "a b c d e f", "a b c +d e f"}, +} + +func TestDiff(t *testing.T) { + for _, tt := range diffTests { + // Turn spaces into \n. + text1 := strings.Replace(tt.text1, " ", "\n", -1) + if text1 != "" { + text1 += "\n" + } + text2 := strings.Replace(tt.text2, " ", "\n", -1) + if text2 != "" { + text2 += "\n" + } + out := diff(text1, text2) + // Cut final \n, cut spaces, turn remaining \n into spaces. + out = strings.Replace(strings.Replace(strings.TrimSuffix(out, "\n"), " ", "", -1), "\n", " ", -1) + if out != tt.diff { + t.Errorf("diff(%q, %q) = %q, want %q", text1, text2, out, tt.diff) + } + } +} diff --git a/vendor/github.com/rogpeppe/go-internal/txtar/archive.go b/vendor/github.com/rogpeppe/go-internal/txtar/archive.go new file mode 100644 index 000000000..c384f33bd --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/txtar/archive.go @@ -0,0 +1,140 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package txtar implements a trivial text-based file archive format. +// +// The goals for the format are: +// +// - be trivial enough to create and edit by hand. +// - be able to store trees of text files describing go command test cases. +// - diff nicely in git history and code reviews. +// +// Non-goals include being a completely general archive format, +// storing binary data, storing file modes, storing special files like +// symbolic links, and so on. +// +// Txtar format +// +// A txtar archive is zero or more comment lines and then a sequence of file entries. +// Each file entry begins with a file marker line of the form "-- FILENAME --" +// and is followed by zero or more file content lines making up the file data. +// The comment or file content ends at the next file marker line. +// The file marker line must begin with the three-byte sequence "-- " +// and end with the three-byte sequence " --", but the enclosed +// file name can be surrounding by additional white space, +// all of which is stripped. +// +// If the txtar file is missing a trailing newline on the final line, +// parsers should consider a final newline to be present anyway. +// +// There are no possible syntax errors in a txtar archive. +package txtar + +import ( + "bytes" + "fmt" + "io/ioutil" + "strings" +) + +// An Archive is a collection of files. +type Archive struct { + Comment []byte + Files []File +} + +// A File is a single file in an archive. +type File struct { + Name string // name of file ("foo/bar.txt") + Data []byte // text content of file +} + +// Format returns the serialized form of an Archive. +// It is assumed that the Archive data structure is well-formed: +// a.Comment and all a.File[i].Data contain no file marker lines, +// and all a.File[i].Name is non-empty. +func Format(a *Archive) []byte { + var buf bytes.Buffer + buf.Write(fixNL(a.Comment)) + for _, f := range a.Files { + fmt.Fprintf(&buf, "-- %s --\n", f.Name) + buf.Write(fixNL(f.Data)) + } + return buf.Bytes() +} + +// ParseFile parses the named file as an archive. +func ParseFile(file string) (*Archive, error) { + data, err := ioutil.ReadFile(file) + if err != nil { + return nil, err + } + return Parse(data), nil +} + +// Parse parses the serialized form of an Archive. +// The returned Archive holds slices of data. +func Parse(data []byte) *Archive { + a := new(Archive) + var name string + a.Comment, name, data = findFileMarker(data) + for name != "" { + f := File{name, nil} + f.Data, name, data = findFileMarker(data) + a.Files = append(a.Files, f) + } + return a +} + +var ( + newlineMarker = []byte("\n-- ") + marker = []byte("-- ") + markerEnd = []byte(" --") +) + +// findFileMarker finds the next file marker in data, +// extracts the file name, and returns the data before the marker, +// the file name, and the data after the marker. +// If there is no next marker, findFileMarker returns before = fixNL(data), name = "", after = nil. +func findFileMarker(data []byte) (before []byte, name string, after []byte) { + var i int + for { + if name, after = isMarker(data[i:]); name != "" { + return data[:i], name, after + } + j := bytes.Index(data[i:], newlineMarker) + if j < 0 { + return fixNL(data), "", nil + } + i += j + 1 // positioned at start of new possible marker + } +} + +// isMarker checks whether data begins with a file marker line. +// If so, it returns the name from the line and the data after the line. +// Otherwise it returns name == "" with an unspecified after. +func isMarker(data []byte) (name string, after []byte) { + if !bytes.HasPrefix(data, marker) { + return "", nil + } + if i := bytes.IndexByte(data, '\n'); i >= 0 { + data, after = data[:i], data[i+1:] + } + if !bytes.HasSuffix(data, markerEnd) { + return "", nil + } + return strings.TrimSpace(string(data[len(marker) : len(data)-len(markerEnd)])), after +} + +// If data is empty or ends in \n, fixNL returns data. +// Otherwise fixNL returns a new slice consisting of data with a final \n added. +func fixNL(data []byte) []byte { + if len(data) == 0 || data[len(data)-1] == '\n' { + return data + } + d := make([]byte, len(data)+1) + copy(d, data) + d[len(data)] = '\n' + return d +} diff --git a/vendor/github.com/rogpeppe/go-internal/txtar/archive_test.go b/vendor/github.com/rogpeppe/go-internal/txtar/archive_test.go new file mode 100644 index 000000000..3f734f676 --- /dev/null +++ b/vendor/github.com/rogpeppe/go-internal/txtar/archive_test.go @@ -0,0 +1,67 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package txtar + +import ( + "bytes" + "fmt" + "reflect" + "testing" +) + +var tests = []struct { + name string + text string + parsed *Archive +}{ + { + name: "basic", + text: `comment1 +comment2 +-- file1 -- +File 1 text. +-- foo --- +More file 1 text. +-- file 2 -- +File 2 text. +-- empty -- +-- noNL -- +hello world`, + parsed: &Archive{ + Comment: []byte("comment1\ncomment2\n"), + Files: []File{ + {"file1", []byte("File 1 text.\n-- foo ---\nMore file 1 text.\n")}, + {"file 2", []byte("File 2 text.\n")}, + {"empty", []byte{}}, + {"noNL", []byte("hello world\n")}, + }, + }, + }, +} + +func Test(t *testing.T) { + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + a := Parse([]byte(tt.text)) + if !reflect.DeepEqual(a, tt.parsed) { + t.Fatalf("Parse: wrong output:\nhave:\n%s\nwant:\n%s", shortArchive(a), shortArchive(tt.parsed)) + } + text := Format(a) + a = Parse(text) + if !reflect.DeepEqual(a, tt.parsed) { + t.Fatalf("Parse after Format: wrong output:\nhave:\n%s\nwant:\n%s", shortArchive(a), shortArchive(tt.parsed)) + } + }) + } +} + +func shortArchive(a *Archive) string { + var buf bytes.Buffer + fmt.Fprintf(&buf, "comment: %q\n", a.Comment) + for _, f := range a.Files { + fmt.Fprintf(&buf, "file %q: %q\n", f.Name, f.Data) + } + return buf.String() +} -- GitLab