diff --git a/Makefile b/Makefile index 7190e25..90b42c6 100644 --- a/Makefile +++ b/Makefile @@ -13,15 +13,7 @@ all: build build: $(GOBUILD) ./cli/gocomply_xsd2go -.PHONY: pkger vendor -pkger: -ifeq ("$(wildcard $(GOBIN)/pkger)","") - go install github.com/markbates/pkger/cmd/pkger@latest -endif - -ci-update-bundled-deps: pkger - $(GOBIN)/pkger -o pkg/template - go fmt ./pkg/template +.PHONY: vendor vendor: $(GO) mod tidy diff --git a/go.mod b/go.mod index 9cea4d6..3bb5ed4 100644 --- a/go.mod +++ b/go.mod @@ -4,18 +4,18 @@ go 1.18 require ( github.com/iancoleman/strcase v0.3.0 - github.com/markbates/pkger v0.17.1 github.com/stretchr/testify v1.9.0 github.com/urfave/cli v1.22.15 - golang.org/x/net v0.24.0 + golang.org/x/net v0.28.0 ) require ( github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/gobuffalo/here v0.6.0 // indirect + github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/text v0.17.0 // indirect + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 5541312..b10d21b 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,6 @@ github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t 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/gobuffalo/here v0.6.0 h1:hYrd0a6gDmWxBM4TnrGw8mQg24iSVoIkHEk7FodQcBI= -github.com/gobuffalo/here v0.6.0/go.mod h1:wAG085dHOYqUpf+Ap+WOdrPTp5IYcDAs/x7PLa8Y5fM= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= @@ -13,8 +11,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/markbates/pkger v0.17.1 h1:/MKEtWqtc0mZvu9OinB9UzVN9iYCwLWuyUv4Bw+PCno= -github.com/markbates/pkger v0.17.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI= 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/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= @@ -23,7 +19,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -31,15 +26,13 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/urfave/cli v1.22.15 h1:nuqt+pdC/KqswQKhETJjo7pvn/k4xMUxgW6liI7XpnM= github.com/urfave/cli v1.22.15/go.mod h1:wSan1hmo5zeyLGBjRJbzRTNk8gwoYa2B9n4q9dmRIc0= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/pkg/template/pkged.go b/pkg/template/pkged.go deleted file mode 100644 index 4ddae51..0000000 --- a/pkg/template/pkged.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by pkger; DO NOT EDIT. - -//go:build !skippkger -// +build !skippkger - -package template - -import ( - "github.com/markbates/pkger" - "github.com/markbates/pkger/pkging/mem" -) - -var _ = pkger.Apply(mem.UnmarshalEmbed([]byte(`1f8b08000000000000ffec195d4fe33af6af5cf9757349d2124a2aed032dd09601eed20e4d9bd168e4c44ee2a9636763a7b48cf8ef2b3b1f4da10574efc39576f7a1c4e7c3c7e7db27e117202ce202f47f01f5bb2439e80333e12936052d565090d5ef51f7d444504233c72881d28c8934932230631ef234a35b73235027e6c0009334e3b9fc179409e80360807b9862d0070dfd928725e12bcc632ccbf594f36a75076598803e2b2835c04c428a413f8254e00a9a6228382b7947fc9a502c6aeef2e406bcc459b3fe8a857cc5ad50af76dc7154a8f37e814afd98c8a4084e429e1e30f40e1206fa322fb0f1577d36e2771cfd690166cc4f528eb49c39ce05d1feb14fec73f0f2f26280a834fbd73be6f4cd6c159b12a71985129b729b617122d38caa6d2a3bd413610909d5925819d4169f010479c6a06f3ba73d03a41c61d03fed587af94312cddeb13adddf6dfbf78ef5d5b6fbb6d5b7ba27d6e979cf75ec9efb0fcbee5b163000113f9072671575b1d5275ee235e89f9df67ab601268c83be7de6f61cf7ecdc00f794b015e8db3a8018f4bb5dfbfcdc008f0481be6d59960146bbe5e2c78f0c220bf42d034c91126a1960d6527d4057a525a7967ba6401eae04e89f1be0429254a932c321e8db3dcb3aed3996d535c0bd509833bbe73a9675f66280bbf7396b935f0c30fc34e7e2c78f82150223d0ff661996617dd7c14d70fe578b762ff6af2bf878cebcde56157a0bf35ea9ffe95aa91ac4377002be371da2acc2fd06111484a2df2697bfa544a47a53ab637c6bf43c89b912d4b4826f20d84a2c8001a25402e323076c04da674a61be0aa0c4429171ae88dc8c789e42258d7093f0421255305c1d92419998aa42d5021840e28ddc79f57bddc6be81a08888b2bfd64ea9926321cca8f27683889f49a66126216138372911b242e08d5ee5db4cf26661c252620984244bb4de158cda4424e00ec0214af6a03d22ea388eedb61094924c9270874952d88208933867909a9012280ee00312976dee0d81e784c5470966109077a8e22011a3279823f1ca8683643322981ed28b1121f1210b4b821911280f5073c8509522152945ce0e50e416149eb68076004402ed3da8e39cedc18edd69c1452029dec192b642b0712c771f32b315d90003e034c04a1bcc428eca20d44b130a66b7e1000a7c76ba87210ce6db3626c19b36f85395720bce70da0637a97212ce739e1f29d8a0882248b999e01cff89622690859ce2143253c83c84027f58ec4789077478cdd1a4400a33f13e6bb68a4b777fc8630a8974ab89b909752388b9a99ba3197226640e09abb0888766c8d314d788a66fc5adfc54b77e067398564233988bbad165b9662b011142c66a40f215667a49218b4f781e9b1b936169265247f120de8492a7478961a24e96afe9ba85b612f238514b4861f63e933a8b30a433f31db6da3f9fe33209c24c928854fe39bae127cc20c365e21de75af11cc337eedde71124cda83a118509f958a4cc2122927006e9a7f80b4642357f1d626aac568402c69fe452c998c1f0708477f9080f47b961286474fe6e74ded52a2f1816072932874ca812010648a048aa8719e66157b5d6dd8d169036a8ae7048e3362ae46b9c2b8b7319f2f51e252bda60944ac173d946c51ce67aba6961100e8a781f853719ce4955db2dbcee0dbbb4d48b3d8ce4b00d332c650e43dcc671a19b701b95714adbf0eb2d398e280e2525720f2d60845be3d00e4f584c7144499cece92fb62284949a788343ccd6874805d357d52e5fb09094ef79a760eadc0443a4cb510f5a849b917835b295dbd25237f530cbd1a25a4a51afab4b3a552f3ee5c34c0b2a490675ec34e2df059718e98e09037df732ddcccafe26b3d652ffa9bdde205b39fd066742111252511896a416a73237cbb91eff145ce4cd2cca85766335951e184eab98e9558c3759b330c59649a8bc9c174c9646572b33d4637b0dedf4933cd5c3e01b4ae5de3778f5267818adc2acde40cbc2503735d7a920a49af0d42eb16561f5d89dbcdb5996330c9e7252de5efb63f82bb8bcf114b6b474d7f9aa95ea38f6d93e7cae419566c0006bcc10cfcdbd96528fdf090c13d8b13ec79571bab5bb96f301b77ea8b6f359be7a787b873959a1e87d8e3713fd67783fb048a52c6242fd522c44d9b48f3136a51317f2d8f97b7c59ce37db0f183b6692c170f50e17410c1e218bada83afa21aace3281c322c7664010c90b7accbc3717d051a63a0795c0cff03125effbfff237b3aaff299b56f14726559f3d8e7e407b3180d207f4c1edf63c7ee8b82b7f3660bee7d030bdb67cef215eb2550cc7532b1cdf9ddd6e5d0617538ebc49b1ecb8f2b683d6ea198e36ce6d3779f62f6f58f02ce2e9d579fc75e53e4eaee657b3f9433124e7ebc995bdf64773116e0769d09dc4b82be25b3a4dc2145174e52481377f0e47d73ffdd9c08d1eb2a7a5779f2f3d442763d99b0c9d71600f926547267e67fec7d2b3e9646cbbc338cb82c5601db287f8cb058f27c30b25574ec637499022aaf759548623778bc6f77ff8de7ce57b53377a2879cbdf4d0f6f2f0a256f12b7648ce6853f54baf06c18673ddc6d645ee3b13a739a2cd30d9d7a1b1a78f3028defe268617d990c2fd6b7dbc175309a4bdf73ac21b988d1983ef9b3813e67da711bfd27e37b2b64f39f6838e829bec970b0fcfab8a9e8890c864eb91e0d4e03efe96cc264ef76a57de546b39bb8dad3c3dbc176e939cc9f5d140f8ba915a694a0c59486dbc1beadb52f2d25e351e9ab6c553a8d82ee0d851e2abe7aee0a791b1a2dec1ede2abf4f9d70a4ce1bc478648b3f88f297b30cbc52cf6861092543ed839e9ff98b9be768619165130f4983f441fbe690be07fc57c720be5da1f534a534184debb36a7def7dcfbe5b2ee81a2da66eb4507e51bceed6f7280b56f6da1fcf85bfb0dd5ace5cc5e07167f752f9f7921325cf1bd9e26b7a2d15ff24bdf8d2f86a97030dee7636c87c72513c74dc028daeb380dd3ffa8bc4d2f9482a3f5f4f291e3fc46177ba859ec39af891cd4f38badefaa36b6bb9173f2bf63d6755da3f7075be75e685af739c7f51b5e95ddf5f4daeeed7c16220fc45f28817033a194de9b2b34954ad42cf2dc2a7e379fa50d629c5d73a9ecfb5be9fcdcdb226683a19396b34bc2866a3ebe7c66f8fd7161adf644b36b7cafa2d63ef5dd9779a3ed3f6177aad68a51f699056b5a87cbdabd9011a2bbfddd8a8a5e7df92bf63d95371297bcd1b3d9b1a6fd7d9df9bb78376de7c325f07157caffa46e16f6b3f4dc4b29324613a4dd0e8aaf1c7ebb81d907f13a40e0da9ea5f3bbfcc3ca7f01737cbc07b3a541799dec3d49eb22e9a1e5ce9193decd584eab1cb47eb217eec509dd7f3328f57be772f968b9b048de83a60775f7057ee7acd22790aba37d6d2bb11fefc3ed3b534ff6c3dd4f790e66fdd41555e0ca7cfd0b39f82d1bcaccd4bee4e86a7554f7bddf31c3b58d4fd6ef033e838cf48f35cacc23d7b76b97ebb2875b89d1dd26bff6c953755ddb9d1ecc2adefb8265f347eb2cb97aac795bd5ac7f69ffa052b57efe3cda4b19b2740fddf1dfcffffc9feb7cd972fff010000ffff010000ffff46ff9a54721f0000`))) diff --git a/pkg/template/template.go b/pkg/template/template.go index 881c3b0..a30c3f8 100644 --- a/pkg/template/template.go +++ b/pkg/template/template.go @@ -2,17 +2,20 @@ package template import ( "bytes" + _ "embed" "fmt" "go/format" - "io/ioutil" + "io" "os" "path/filepath" "text/template" "github.com/gocomply/xsd2go/pkg/xsd" - "github.com/markbates/pkger" ) +//go:embed types.tmpl +var templateData []byte + func GenerateTypes(schema *xsd.Schema, outputDir string) error { t, err := newTemplate(outputDir) if err != nil { @@ -51,13 +54,7 @@ func GenerateTypes(schema *xsd.Schema, outputDir string) error { } func newTemplate(outputDir string) (*template.Template, error) { - in, err := pkger.Open("/pkg/template/types.tmpl") - if err != nil { - return nil, err - } - defer in.Close() - - tempText, err := ioutil.ReadAll(in) + tempText, err := io.ReadAll(bytes.NewReader(templateData)) if err != nil { return nil, err } diff --git a/vendor/github.com/gobuffalo/here/.gitignore b/vendor/github.com/gobuffalo/here/.gitignore deleted file mode 100644 index d188dc0..0000000 --- a/vendor/github.com/gobuffalo/here/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -*.log -.DS_Store -doc -tmp -pkg -*.pid -coverage -coverage.data -build/* -*.pbxuser -*.mode1v3 -.svn -profile -.console_history -.sass-cache/* -solr/ -.jhw-cache/ -jhw.* -*.sublime* -node_modules/ -dist/ -generated/ -.vendor/ -bin/* -gin-bin -.idea/ -.vscode -cover.out diff --git a/vendor/github.com/gobuffalo/here/.goreleaser.yml b/vendor/github.com/gobuffalo/here/.goreleaser.yml deleted file mode 100644 index 0ea9d65..0000000 --- a/vendor/github.com/gobuffalo/here/.goreleaser.yml +++ /dev/null @@ -1,45 +0,0 @@ -builds: - - - main: ./cmd/here/main.go - env: - - CGO_ENABLED=0 - ldflags: - - -s -w -X "github.com/gobuffalo/here.Version={{.Tag}}" - goos: - - darwin - - linux - - windows - goarch: - - amd64 - - 386 - - arm - - arm64 - goarm: - - 6 - - 7 -archives: - - - replacements: - '386': i386 - darwin: Darwin - linux: Linux - windows: Windows - amd64: x86_64 -checksum: - name_template: checksums.txt -snapshot: - name_template: '{{ .Tag }}-next' -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' -brews: - - - name: 'here' - github: - owner: 'gobuffalo' - name: 'homebrew-tap' - install: | - bin.install "here" diff --git a/vendor/github.com/gobuffalo/here/LICENSE b/vendor/github.com/gobuffalo/here/LICENSE deleted file mode 100644 index 649efd4..0000000 --- a/vendor/github.com/gobuffalo/here/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 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/here/Makefile b/vendor/github.com/gobuffalo/here/Makefile deleted file mode 100644 index 3be6fb1..0000000 --- a/vendor/github.com/gobuffalo/here/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -TAGS ?= "" -GO_BIN ?= "go" - - -install: tidy - cd ./cmd/here && $(GO_BIN) install -tags ${TAGS} -v . - make tidy - -tidy: - $(GO_BIN) mod tidy -v - -build: tidy - $(GO_BIN) build -v . - make tidy - -test: tidy - $(GO_BIN) test -count 1 -cover -tags ${TAGS} -timeout 10s ./... - make tidy - -cov: - $(GO_BIN) test -coverprofile cover.out -count 1 -tags ${TAGS} ./... - go tool cover -html cover.out - make tidy - -ci-test: - $(GO_BIN) test -tags ${TAGS} -race ./... - -lint: - go get github.com/golangci/golangci-lint/cmd/golangci-lint - golangci-lint run --enable-all - make tidy - -update: - rm go.* - $(GO_BIN) mod init - $(GO_BIN) mod 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 --skip-packr - make tidy - - diff --git a/vendor/github.com/gobuffalo/here/README.md b/vendor/github.com/gobuffalo/here/README.md deleted file mode 100644 index 79bc3d8..0000000 --- a/vendor/github.com/gobuffalo/here/README.md +++ /dev/null @@ -1,277 +0,0 @@ -# Here - -[![](https://github.com/gobuffalo/here/workflows/Tests/badge.svg)](https://github.com/gobuffalo/here/actions) -[![GoDoc](https://godoc.org/github.com/gobuffalo/here?status.svg)](https://godoc.org/github.com/gobuffalo/here) - -Here will get you **accurate** Go information about the directory of package requested. - -### Requirements - -* Go 1.13+ -* Go Modules - -## CLI - -While you can use the tool via its API, you can also use the CLI to get a JSON version of the data. - -### Installation - -```bash -$ go get github.com/gobuffalo/here/cmd/here -``` - -### Usage - -#### Default - -```bash -$ here - -{ - "Dir": "$GOPATH/src/github.com/gobuffalo/here", - "ImportPath": "github.com/gobuffalo/here", - "Name": "here", - "Doc": "", - "Target": "$GOPATH/pkg/darwin_amd64/github.com/gobuffalo/here.a", - "Root": "$GOPATH", - "Match": [ - "." - ], - "Stale": true, - "StaleReason": "not installed but available in build cache", - "GoFiles": [ - "current.go", - "dir.go", - "here.go", - "info.go", - "info_map.go", - "module.go", - "pkg.go", - "version.go" - ], - "Imports": [ - "bytes", - "encoding/json", - "fmt", - "os", - "os/exec", - "path/filepath", - "regexp", - "sync" - ], - "Deps": [ - "bytes", - "context", - "encoding", - "encoding/base64", - "encoding/binary", - "encoding/json", - "errors", - "fmt", - "internal/bytealg", - "internal/cpu", - "internal/fmtsort", - "internal/oserror", - "internal/poll", - "internal/race", - "internal/reflectlite", - "internal/syscall/unix", - "internal/testlog", - "io", - "math", - "math/bits", - "os", - "os/exec", - "path/filepath", - "reflect", - "regexp", - "regexp/syntax", - "runtime", - "runtime/internal/atomic", - "runtime/internal/math", - "runtime/internal/sys", - "sort", - "strconv", - "strings", - "sync", - "sync/atomic", - "syscall", - "time", - "unicode", - "unicode/utf16", - "unicode/utf8", - "unsafe" - ], - "TestGoFiles": [ - "current_test.go", - "dir_test.go", - "here_test.go", - "info_test.go", - "module_test.go", - "pkg_test.go" - ], - "TestImports": [ - "github.com/stretchr/testify/require", - "os", - "path/filepath", - "testing" - ], - "Module": { - "Path": "github.com/gobuffalo/here", - "Main": true, - "Dir": "$GOPATH/src/github.com/gobuffalo/here", - "GoMod": "$GOPATH/src/github.com/gobuffalo/here/go.mod", - "GoVersion": "1.13" - } -} -``` - -#### By Directory - -```bash -$ here cmd/here - -{ - "Dir": "$GOPATH/src/github.com/gobuffalo/here/cmd/here", - "ImportPath": "github.com/gobuffalo/here/cmd/here", - "Name": "main", - "Doc": "", - "Target": "$GOPATH/bin/here", - "Root": "$GOPATH", - "Match": [ - "." - ], - "Stale": false, - "StaleReason": "", - "GoFiles": [ - "main.go" - ], - "Imports": [ - "fmt", - "github.com/gobuffalo/here", - "log", - "os", - "os/exec" - ], - "Deps": [ - "bytes", - "context", - "encoding", - "encoding/base64", - "encoding/binary", - "encoding/json", - "errors", - "fmt", - "github.com/gobuffalo/here", - "internal/bytealg", - "internal/cpu", - "internal/fmtsort", - "internal/oserror", - "internal/poll", - "internal/race", - "internal/reflectlite", - "internal/syscall/unix", - "internal/testlog", - "io", - "log", - "math", - "math/bits", - "os", - "os/exec", - "path/filepath", - "reflect", - "regexp", - "regexp/syntax", - "runtime", - "runtime/internal/atomic", - "runtime/internal/math", - "runtime/internal/sys", - "sort", - "strconv", - "strings", - "sync", - "sync/atomic", - "syscall", - "time", - "unicode", - "unicode/utf16", - "unicode/utf8", - "unsafe" - ], - "TestGoFiles": null, - "TestImports": null, - "Module": { - "Path": "github.com/gobuffalo/here", - "Main": true, - "Dir": "$GOPATH/src/github.com/gobuffalo/here", - "GoMod": "$GOPATH/src/github.com/gobuffalo/here/go.mod", - "GoVersion": "1.13" - } -} -``` - -#### By Package - -```bash -$ here pkg github.com/gobuffalo/genny - -{ - "Dir": "$GOPATH/pkg/mod/github.com/gobuffalo/genny@v0.4.1", - "ImportPath": "github.com/gobuffalo/genny", - "Name": "genny", - "Doc": "Package genny is a _framework_ for writing modular generators, it however, doesn't actually generate anything.", - "Target": "", - "Root": "$GOPATH/pkg/mod/github.com/gobuffalo/genny@v0.4.1", - "Match": [ - "github.com/gobuffalo/genny" - ], - "Stale": true, - "StaleReason": "build ID mismatch", - "GoFiles": [ - "confirm.go", - "dir.go", - "disk.go", - "dry_runner.go", - "events.go", - "file.go", - "force.go", - "generator.go", - "genny.go", - "group.go", - "helpers.go", - "logger.go", - "replacer.go", - "results.go", - "runner.go", - "step.go", - "transformer.go", - "version.go", - "wet_runner.go" - ], - "Imports": null, - "Deps": null, - "TestGoFiles": [ - "dry_runner_test.go", - "file_test.go", - "force_test.go", - "generator_test.go", - "genny_test.go", - "group_test.go", - "helpers_test.go", - "replacer_test.go", - "results_test.go", - "runner_test.go", - "step_test.go", - "transformer_test.go", - "wet_runner_test.go" - ], - "TestImports": null, - "Module": { - "Path": "github.com/gobuffalo/genny", - "Main": false, - "Dir": "$GOPATH/pkg/mod/github.com/gobuffalo/genny@v0.4.1", - "GoMod": "$GOPATH/pkg/mod/cache/download/github.com/gobuffalo/genny/@v/v0.4.1.mod", - "GoVersion": "1.13" - } -} -``` diff --git a/vendor/github.com/gobuffalo/here/SHOULDERS.md b/vendor/github.com/gobuffalo/here/SHOULDERS.md deleted file mode 100644 index ae560b7..0000000 --- a/vendor/github.com/gobuffalo/here/SHOULDERS.md +++ /dev/null @@ -1,24 +0,0 @@ -# github.com/gobuffalo/here Stands on the Shoulders of Giants - -github.com/gobuffalo/here 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/davecgh/go-spew](https://godoc.org/github.com/davecgh/go-spew) - -* [github.com/kr/pretty](https://godoc.org/github.com/kr/pretty) - -* [github.com/kr/pty](https://godoc.org/github.com/kr/pty) - -* [github.com/kr/text](https://godoc.org/github.com/kr/text) - -* [github.com/pmezard/go-difflib](https://godoc.org/github.com/pmezard/go-difflib) - -* [github.com/stretchr/objx](https://godoc.org/github.com/stretchr/objx) - -* [github.com/stretchr/testify](https://godoc.org/github.com/stretchr/testify) - -* [gopkg.in/check.v1](https://godoc.org/gopkg.in/check.v1) - -* [gopkg.in/yaml.v2](https://godoc.org/gopkg.in/yaml.v2) diff --git a/vendor/github.com/gobuffalo/here/current.go b/vendor/github.com/gobuffalo/here/current.go deleted file mode 100644 index fb5b3e8..0000000 --- a/vendor/github.com/gobuffalo/here/current.go +++ /dev/null @@ -1,31 +0,0 @@ -package here - -import ( - "path/filepath" -) - -// Current returns the Info representing the current Go module -func (h Here) Current() (Info, error) { - hp := &h - (&hp.curOnce).Do(func() { - b, err := run("go", "env", "GOMOD") - if err != nil { - hp.curErr = err - return - } - root := filepath.Dir(string(b)) - i, err := h.Dir(root) - if err != nil { - hp.curErr = err - return - } - hp.current = i - }) - - return h.current, h.curErr -} - -// Current returns the Info representing the current Go module -func Current() (Info, error) { - return New().Current() -} diff --git a/vendor/github.com/gobuffalo/here/dir.go b/vendor/github.com/gobuffalo/here/dir.go deleted file mode 100644 index ecd75dd..0000000 --- a/vendor/github.com/gobuffalo/here/dir.go +++ /dev/null @@ -1,83 +0,0 @@ -package here - -import ( - "encoding/json" - "os" - "path/filepath" -) - -// Dir attempts to gather info for the requested directory. -func (h Here) Dir(p string) (Info, error) { - i, err := h.cache(p, func(p string) (Info, error) { - var i Info - - fi, err := os.Stat(p) - if err != nil { - return i, err - } - - if !fi.IsDir() { - p = filepath.Dir(p) - } - - pwd, err := os.Getwd() - if err != nil { - return i, err - } - - defer os.Chdir(pwd) - - os.Chdir(p) - - b, err := run("go", "list", "-json") - // go: cannot find main module; see 'go help modules' - // build .: cannot find module for path . - // no Go files in - if err != nil { - if nonGoDirRx.MatchString(err.Error()) { - return fromNonGoDir(p) - } - return i, err - } - - if err := json.Unmarshal(b, &i); err != nil { - return i, err - } - - return i, nil - }) - - if err != nil { - return i, err - } - - return h.cache(i.ImportPath, func(p string) (Info, error) { - return i, nil - }) -} - -// Dir attempts to gather info for the requested directory. -func Dir(p string) (Info, error) { - return New().Dir(p) -} - -func fromNonGoDir(dir string) (Info, error) { - i := Info{ - Dir: dir, - Name: filepath.Base(dir), - } - - b, err := run("go", "list", "-json", "-m") - if err != nil { - if nonGoDirRx.MatchString(err.Error()) { - return i, nil - } - return i, err - } - - if err := json.Unmarshal(b, &i.Module); err != nil { - return i, err - } - - return i, err -} diff --git a/vendor/github.com/gobuffalo/here/here.go b/vendor/github.com/gobuffalo/here/here.go deleted file mode 100644 index e1d5765..0000000 --- a/vendor/github.com/gobuffalo/here/here.go +++ /dev/null @@ -1,57 +0,0 @@ -package here - -import ( - "bytes" - "fmt" - "os/exec" - "regexp" - "sync" -) - -type Here struct { - infos *infoMap - curOnce sync.Once - curErr error - current Info -} - -// New returns a Here type that will cache -// all results. This speeds up repeated calls, -// and can be useful for testing. -func New() Here { - return Here{ - infos: &infoMap{ - data: &sync.Map{}, - }, - } -} - -func run(n string, args ...string) ([]byte, error) { - c := exec.Command(n, args...) - - bb := &bytes.Buffer{} - ebb := &bytes.Buffer{} - c.Stdout = bb - c.Stderr = ebb - err := c.Run() - if err != nil { - return nil, fmt.Errorf("%s: %s", err, ebb) - } - - return bb.Bytes(), nil -} - -func (h Here) cache(p string, fn func(string) (Info, error)) (Info, error) { - i, ok := h.infos.Load(p) - if ok { - return i, nil - } - i, err := fn(p) - if err != nil { - return i, err - } - h.infos.Store(p, i) - return i, nil -} - -var nonGoDirRx = regexp.MustCompile(`cannot find main|go help modules|go: |build .:|no Go files|can't load package|not using modules`) diff --git a/vendor/github.com/gobuffalo/here/info.go b/vendor/github.com/gobuffalo/here/info.go deleted file mode 100644 index a6101cf..0000000 --- a/vendor/github.com/gobuffalo/here/info.go +++ /dev/null @@ -1,39 +0,0 @@ -package here - -import ( - "encoding/json" -) - -// Info represents details about the directory/package -type Info struct { - Dir string - ImportPath string - Name string - Doc string - Target string - Root string - Match []string - Stale bool - StaleReason string - GoFiles []string - Imports []string - Deps []string - TestGoFiles []string - TestImports []string - Module Module -} - -// IsZero checks if the type has been filled -// with rich chocolately data goodness -func (i Info) IsZero() bool { - return i.String() == Info{}.String() -} - -func (i Info) String() string { - b, err := json.MarshalIndent(i, "", " ") - if err != nil { - return err.Error() - } - s := string(b) - return s -} diff --git a/vendor/github.com/gobuffalo/here/info_map.go b/vendor/github.com/gobuffalo/here/info_map.go deleted file mode 100644 index b3212a5..0000000 --- a/vendor/github.com/gobuffalo/here/info_map.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. - -package here - -import ( - "sync" -) - -// infoMap wraps sync.Map and uses the following types: -// key: string -// value: Info -type infoMap struct { - data *sync.Map -} - -// Load the key from the map. -// Returns Info or bool. -// A false return indicates either the key was not found -// or the value is not of type Info -func (m *infoMap) Load(key string) (Info, bool) { - i, ok := m.data.Load(key) - if !ok { - return Info{}, false - } - s, ok := i.(Info) - return s, ok -} - -// Store a Info in the map -func (m *infoMap) Store(key string, value Info) { - m.data.Store(key, value) -} diff --git a/vendor/github.com/gobuffalo/here/module.go b/vendor/github.com/gobuffalo/here/module.go deleted file mode 100644 index c9cd60d..0000000 --- a/vendor/github.com/gobuffalo/here/module.go +++ /dev/null @@ -1,29 +0,0 @@ -package here - -import ( - "encoding/json" -) - -type Module struct { - Path string - Main bool - Dir string - GoMod string - GoVersion string -} - -func (i Module) String() string { - b, err := json.MarshalIndent(i, "", " ") - if err != nil { - return err.Error() - } - return string(b) -} - -func (i Module) IsZero() bool { - const cla = "command-line-arguments" - if i.Path == cla { - i.Path = "" - } - return i.String() == Module{}.String() -} diff --git a/vendor/github.com/gobuffalo/here/parse.go b/vendor/github.com/gobuffalo/here/parse.go deleted file mode 100644 index 9227b93..0000000 --- a/vendor/github.com/gobuffalo/here/parse.go +++ /dev/null @@ -1,63 +0,0 @@ -package here - -import ( - "fmt" - "path/filepath" - "regexp" - "strings" -) - -func (i Info) Parse(p string) (Path, error) { - p = strings.TrimSpace(p) - p = filepath.Clean(p) - p = strings.TrimPrefix(p, i.Dir) - - p = strings.Replace(p, "\\", "/", -1) - p = strings.TrimSpace(p) - - if len(p) == 0 || p == ":" || p == "." { - return i.build("", "", "") - } - - res := pathrx.FindAllStringSubmatch(p, -1) - if len(res) == 0 { - return Path{}, fmt.Errorf("could not parse %q", p) - } - - matches := res[0] - - if len(matches) != 4 { - return Path{}, fmt.Errorf("could not parse %q", p) - } - - return i.build(p, matches[1], matches[3]) -} - -func (i Info) build(p, pkg, name string) (Path, error) { - pt := Path{ - Pkg: pkg, - Name: name, - } - - if strings.HasPrefix(pt.Pkg, "/") || len(pt.Pkg) == 0 { - pt.Name = pt.Pkg - pt.Pkg = i.Module.Path - } - - if len(pt.Name) == 0 { - pt.Name = "/" - } - - if pt.Pkg == pt.Name { - pt.Pkg = i.Module.Path - pt.Name = "/" - } - - if !strings.HasPrefix(pt.Name, "/") { - pt.Name = "/" + pt.Name - } - pt.Name = strings.TrimPrefix(pt.Name, i.Dir) - return pt, nil -} - -var pathrx = regexp.MustCompile("([^:]+)(:(/.+))?") diff --git a/vendor/github.com/gobuffalo/here/path.go b/vendor/github.com/gobuffalo/here/path.go deleted file mode 100644 index b3b3ad0..0000000 --- a/vendor/github.com/gobuffalo/here/path.go +++ /dev/null @@ -1,20 +0,0 @@ -package here - -import ( - "fmt" -) - -type Path struct { - Pkg string - Name string -} - -func (p Path) String() string { - if p.Name == "" { - p.Name = "/" - } - if p.Pkg == "" { - return p.Name - } - return fmt.Sprintf("%s:%s", p.Pkg, p.Name) -} diff --git a/vendor/github.com/gobuffalo/here/pkg.go b/vendor/github.com/gobuffalo/here/pkg.go deleted file mode 100644 index 31ce170..0000000 --- a/vendor/github.com/gobuffalo/here/pkg.go +++ /dev/null @@ -1,57 +0,0 @@ -package here - -import ( - "encoding/json" - "fmt" -) - -// Package attempts to gather info for the requested package. -// -// From the `go help list` docs: -// The -find flag causes list to identify the named packages but not -// resolve their dependencies: the Imports and Deps lists will be empty. -// -// A workaround for this issue is to use the `Dir` field in the -// returned `Info` value and pass it to the `Dir(string) (Info, error)` -// function to return the complete data. -func (h Here) Package(p string) (Info, error) { - i, err := h.cache(p, func(p string) (Info, error) { - var i Info - if len(p) == 0 || p == "." { - return i, fmt.Errorf("missing package name") - } - b, err := run("go", "list", "-json", "-find", p) - if err != nil { - return i, err - } - if err := json.Unmarshal(b, &i); err != nil { - return i, err - } - - return i, nil - }) - - if err != nil { - return i, err - } - - h.cache(i.Dir, func(p string) (Info, error) { - return i, nil - }) - - return i, nil - -} - -// Package attempts to gather info for the requested package. -// -// From the `go help list` docs: -// The -find flag causes list to identify the named packages but not -// resolve their dependencies: the Imports and Deps lists will be empty. -// -// A workaround for this issue is to use the `Dir` field in the -// returned `Info` value and pass it to the `Dir(string) (Info, error)` -// function to return the complete data. -func Package(p string) (Info, error) { - return New().Package(p) -} diff --git a/vendor/github.com/gobuffalo/here/version.go b/vendor/github.com/gobuffalo/here/version.go deleted file mode 100644 index 97fdbe8..0000000 --- a/vendor/github.com/gobuffalo/here/version.go +++ /dev/null @@ -1,4 +0,0 @@ -package here - -// Version of here -var Version = "development" diff --git a/vendor/github.com/markbates/pkger/.gitignore b/vendor/github.com/markbates/pkger/.gitignore deleted file mode 100644 index 5d3a9cc..0000000 --- a/vendor/github.com/markbates/pkger/.gitignore +++ /dev/null @@ -1,35 +0,0 @@ -.fstest -*.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/ -pkged.go -cover.out -.pkgtest -example -app diff --git a/vendor/github.com/markbates/pkger/.goreleaser.yml b/vendor/github.com/markbates/pkger/.goreleaser.yml deleted file mode 100644 index 567628b..0000000 --- a/vendor/github.com/markbates/pkger/.goreleaser.yml +++ /dev/null @@ -1,45 +0,0 @@ -builds: - - - main: ./cmd/pkger/main.go - env: - - CGO_ENABLED=0 - ldflags: - - -s -w -X "github.com/markbates/pkger.Version={{.Tag}}" - goos: - - darwin - - linux - - windows - goarch: - - amd64 - - 386 - - arm - - arm64 - goarm: - - 6 - - 7 -archives: - - - replacements: - '386': i386 - darwin: Darwin - linux: Linux - windows: Windows - amd64: x86_64 -checksum: - name_template: checksums.txt -snapshot: - name_template: '{{ .Tag }}-next' -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' -brews: - - - name: 'pkger' - github: - owner: 'markbates' - name: 'homebrew-tap' - install: | - bin.install "pkger" diff --git a/vendor/github.com/markbates/pkger/LICENSE b/vendor/github.com/markbates/pkger/LICENSE deleted file mode 100644 index 649efd4..0000000 --- a/vendor/github.com/markbates/pkger/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 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/pkger/Makefile b/vendor/github.com/markbates/pkger/Makefile deleted file mode 100644 index 380c6d7..0000000 --- a/vendor/github.com/markbates/pkger/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -TAGS ?= "" -GO_BIN ?= "go" - - -install: tidy - cd ./cmd/pkger && $(GO_BIN) install -tags ${TAGS} -v . - make tidy - -run: install - cd ./examples/app; pkger - -tidy: - $(GO_BIN) mod tidy -v - -build: tidy - $(GO_BIN) build -v . - make tidy - -test: tidy - $(GO_BIN) test -count 1 -cover -tags ${TAGS} -timeout 1m ./... - make tidy - -cov: - $(GO_BIN) test -coverprofile cover.out -tags ${TAGS} ./... - go tool cover -html cover.out - make tidy - -ci-test: - $(GO_BIN) test -tags ${TAGS} -race ./... - -lint: - go get github.com/golangci/golangci-lint/cmd/golangci-lint - golangci-lint run --enable-all - make tidy - -update: - rm go.* - $(GO_BIN) mod init - $(GO_BIN) mod tidy - make test - make install - make tidy - -release-test: - $(GO_BIN) test -tags ${TAGS} -race ./... - make tidy - -release: - $(GO_BIN) get github.com/gobuffalo/release - make tidy - release -y -f version.go --skip-packr - make tidy - - diff --git a/vendor/github.com/markbates/pkger/README.md b/vendor/github.com/markbates/pkger/README.md deleted file mode 100644 index 32215ea..0000000 --- a/vendor/github.com/markbates/pkger/README.md +++ /dev/null @@ -1,432 +0,0 @@ -# Pkger - -[`github.com/markbates/pkger`](https://godoc.org/github.com/markbates/pkger) is a tool for embedding static files into Go binaries. It will, hopefully, be a replacement for [`github.com/gobuffalo/packr/v2`](https://godoc.org/github.com/gobuffalo/packr/v2). - -### Requirements - -* Go 1.13+ -* Go Modules - -## How it Works (Module Aware Pathing) - -Pkger is powered by the dark magic of Go Modules, so they're like, totally required. - -With Go Modules pkger can resolve packages with accuracy. No more guessing and trying to -figure out build paths, GOPATHS, etc... for this tired old lad. - -With the module's path correctly resolved, it can serve as the "root" directory for that -module, and all files in that module's directory are available. - -Paths: -* Paths should use UNIX style paths: - `/cmd/pkger/main.go` -* If unspecified the path's package is assumed to be the current module. -* Packages can specified in at the beginning of a path with a `:` seperator. -github.com/markbates/pkger:/cmd/pkger/main.go -* There are no relative paths. All paths are absolute to the modules root. -* Fully-qualified paths are embedded into the metadata of your static assets. If this behavior is undesirable, a preference is to build in a containerized environ, like docker, where the path strings are not ex-filtrating data about your development environment. - -``` -"github.com/gobuffalo/buffalo:/go.mod" => /go/pkg/mod/github.com/gobuffalo/buffalo@v0.14.7/go.mod -``` - -## CLI - -### Installation - -```bash -$ go get github.com/markbates/pkger/cmd/pkger -$ pkger -h -``` - -### Usage - -```bash -$ pkger -``` - -The result will be a `pkged.go` file in the **root** of the module with the embedded information and the package name of the module. - -```go -// ./pkged.go -package <.> - -// Pkger stuff here -``` - -The `-o` flag can be used to specify the directory of the `pkged.go` file. - -```bash -$ pkger -o cmd/reader -``` - -The result will be a `pkged.go` file in the **cmd/reader** folder with the embedded information and the package name of that folder. - -```go -// cmd/reader/pkged.go -package - -// Pkger stuff here -``` - -### Including Files at Package Time - -There may be reasons where you don't reference a particular file, or folder, that you want embedded in your application, such as a build artifact. - -To do this you may use either the [`github.com/markbates/pkger#Include`](https://godoc.org/github.com/markbates/pkger#Include) function to set a no-op parser directive to include the specified path. - -Alternatively, you may use the `-include` flag with the `pkger` and `pkger list` commands. - -```bash -$ pkger list -include /actions -include github.com/gobuffalo/buffalo:/app.go - -app - > app:/actions - > app:/actions/actions.go - > app:/assets - > app:/assets/css - > app:/assets/css/_buffalo.scss - > app:/assets/css/application.scss - > app:/assets/images - > app:/assets/images/favicon.ico - > app:/assets/images/logo.svg - > app:/assets/js - > app:/assets/js/application.js - > app:/go.mod - > app:/locales/all.en-us.yaml - > app:/public - > app:/public/assets - > app:/public/assets/.keep - > app:/public/assets/app.css - > app:/public/images - > app:/public/images/img1.png - > app:/public/index.html - > app:/public/robots.txt - > app:/templates - > app:/templates/_flash.plush.html - > app:/templates/application.plush.html - > app:/templates/index.plush.html - > app:/web - > app:/web/web.go - > github.com/gobuffalo/buffalo:/app.go - > github.com/gobuffalo/buffalo:/logo.svg -``` - -## Reference Application - -The reference application for the `README` examples, as well as all testing, can be found at [https://github.com/markbates/pkger/tree/master/pkging/pkgtest/testdata/ref](https://github.com/markbates/pkger/tree/master/pkging/pkgtest/testdata/ref). - -``` -├── actions -│   └── actions.go -├── assets -│   ├── css -│   │   ├── _buffalo.scss -│   │   └── application.scss -│   ├── images -│   │   ├── favicon.ico -│   │   └── logo.svg -│   └── js -│   └── application.js -├── go.mod -├── go.sum -├── locales -│   └── all.en-us.yaml -├── main.go -├── mod -│   └── mod.go -├── models -│   └── models.go -├── public -│   ├── assets -│   │   └── app.css -│   ├── images -│   │   └── img1.png -│   ├── index.html -│   └── robots.txt -├── templates -│   ├── _flash.plush.html -│   ├── application.plush.html -│   └── index.plush.html -└── web - └── web.go - -13 directories, 20 files -``` - - -## API Usage - -Pkger's API is modeled on that of the [`os`](https://godoc.org/os) package in Go's standard library. This makes Pkger usage familiar to Go developers. - -The two most important interfaces are [`github.com/markbates/pkger/pkging#Pkger`](https://godoc.org/github.com/markbates/pkger/pkging#Pkger) and [`github.com/markbates/pkger/pkging#File`](https://godoc.org/github.com/markbates/pkger/pkging#File). - -```go -type Pkger interface { - Parse(p string) (Path, error) - Current() (here.Info, error) - Info(p string) (here.Info, error) - Create(name string) (File, error) - MkdirAll(p string, perm os.FileMode) error - Open(name string) (File, error) - Stat(name string) (os.FileInfo, error) - Walk(p string, wf filepath.WalkFunc) error - Remove(name string) error - RemoveAll(path string) error -} - -type File interface { - Close() error - Info() here.Info - Name() string - Open(name string) (http.File, error) - Path() Path - Read(p []byte) (int, error) - Readdir(count int) ([]os.FileInfo, error) - Seek(offset int64, whence int) (int64, error) - Stat() (os.FileInfo, error) - Write(b []byte) (int, error) -} -``` - -These two interfaces, along with the [`os#FileInfo`](https://godoc.org/os#FileInfo), provide the bulk of the API surface area. - -### Open - -```go -func run() error { - f, err := pkger.Open("/public/index.html") - if err != nil { - return err - } - defer f.Close() - - info, err := f.Stat() - if err != nil { - return err - } - - fmt.Println("Name: ", info.Name()) - fmt.Println("Size: ", info.Size()) - fmt.Println("Mode: ", info.Mode()) - fmt.Println("ModTime: ", info.ModTime()) - - if _, err := io.Copy(os.Stdout, f); err != nil { - return err - } - return nil -} -``` - -### Stat - -```go -func run() error { - info, err := pkger.Stat("/public/index.html") - if err != nil { - return err - } - - fmt.Println("Name: ", info.Name()) - fmt.Println("Size: ", info.Size()) - fmt.Println("Mode: ", info.Mode()) - fmt.Println("ModTime: ", info.ModTime()) - - return nil -} -``` - -### Walk - -```go -func run() error { - w := tabwriter.NewWriter(os.Stdout, 0, 0, 0, ' ', tabwriter.Debug) - defer w.Flush() - - return pkger.Walk("/public", func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - fmt.Fprintf(w, - "%s \t %d \t %s \t %s \t\n", - info.Name(), - info.Size(), - info.Mode(), - info.ModTime().Format(time.RFC3339), - ) - - return nil - }) - -} -``` - -## Understanding the Parser - -The [`github.com/markbates/pkger/parser#Parser`](https://godoc.org/github.com/markbates/pkger/parser#Parser) works by statically analyzing the source code of your module using the [`go/parser`](https://godoc.org/go/parser) to find a selection of declarations. - -The following declarations in your source code will tell the parser to embed files or folders. - -* `pkger.Dir("")` - Embeds all files under the specified path. -* `pkger.Open("")` - Embeds the file, or folder, of the specified path. -* `pkger.Stat("")` - Embeds the file, or folder, of the specified path. -* `pkger.Walk("", filepath.WalkFunc)` - Embeds all files under the specified path. -* `pkger.Include("")` - `Include` is a no-op that directs the pkger tool to include the desired file or folder. - -### CLI Usage - -To see what declarations the parser has found, you can use the `pkger parse` command to get a `JSON` list of the declarations. - -```bash -$ pkger parse - -{ - ".": [ - { - "file": { - "Abs": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref/foo/bar/baz", - "Path": { - "Pkg": "app", - "Name": "/foo/bar/baz" - }, - "Here": { - "Dir": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref", - "ImportPath": "app", - "Module": { - "Path": "app", - "Main": true, - "Dir": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref", - "GoMod": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref/go.mod", - "GoVersion": "1.13" - }, - "Name": "main" - } - }, - "pos": { - "Filename": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref/main.go", - "Offset": 629, - "Line": 47, - "Column": 27 - }, - "type": "pkger.MkdirAll", - "value": "/foo/bar/baz" - }, - { - "file": { - "Abs": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref/foo/bar/baz/biz.txt", - "Path": { - "Pkg": "app", - "Name": "/foo/bar/baz/biz.txt" - }, - "Here": { - "Dir": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref", - "ImportPath": "app", - "Module": { - "Path": "app", - "Main": true, - "Dir": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref", - "GoMod": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref/go.mod", - "GoVersion": "1.13" - }, - "Name": "main" - } - }, - "pos": { - "Filename": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref/main.go", - "Offset": 706, - "Line": 51, - "Column": 25 - }, - "type": "pkger.Create", - "value": "/foo/bar/baz/biz.txt" - }, - ... - ] -} -``` - -For a module aware list use the `pkger list` command. - -```bash -$ pkger list - -app - > app:/assets - > app:/assets/css - > app:/assets/css/_buffalo.scss - > app:/assets/css/application.scss - > app:/assets/images - > app:/assets/images/favicon.ico - > app:/assets/images/logo.svg - > app:/assets/js - > app:/assets/js/application.js - > app:/go.mod - > app:/locales/all.en-us.yaml - > app:/public - > app:/public/assets - > app:/public/assets/.keep - > app:/public/assets/app.css - > app:/public/images - > app:/public/images/img1.png - > app:/public/index.html - > app:/public/robots.txt - > app:/templates - > app:/templates/_flash.plush.html - > app:/templates/application.plush.html - > app:/templates/index.plush.html - > app:/web - > app:/web/web.go - > github.com/gobuffalo/buffalo:/logo.svg -``` - -The `-json` flag can be used to get a more detailed list in JSON. - -```bash -$ pkger list -json - -{ - "ImportPath": "app", - "Files": [ - { - "Abs": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref/assets", - "Path": { - "Pkg": "app", - "Name": "/assets" - }, - "Here": { - "Dir": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref/assets", - "ImportPath": "", - "Module": { - "Path": "app", - "Main": true, - "Dir": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref", - "GoMod": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref/go.mod", - "GoVersion": "1.13" - }, - "Name": "assets" - } - }, - { - "Abs": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref/assets/css", - "Path": { - "Pkg": "app", - "Name": "/assets/css" - }, - "Here": { - "Dir": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref/assets", - "ImportPath": "", - "Module": { - "Path": "app", - "Main": true, - "Dir": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref", - "GoMod": "/go/src/github.com/markbates/pkger/pkging/pkgtest/testdata/ref/go.mod", - "GoVersion": "1.13" - }, - "Name": "assets" - } - }, - ... -} -``` - diff --git a/vendor/github.com/markbates/pkger/SHOULDERS.md b/vendor/github.com/markbates/pkger/SHOULDERS.md deleted file mode 100644 index 241d69c..0000000 --- a/vendor/github.com/markbates/pkger/SHOULDERS.md +++ /dev/null @@ -1,24 +0,0 @@ -# github.com/markbates/pkger Stands on the Shoulders of Giants - -github.com/markbates/pkger 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/davecgh/go-spew](https://godoc.org/github.com/davecgh/go-spew) - -* [github.com/kr/pretty](https://godoc.org/github.com/kr/pretty) - -* [github.com/kr/pty](https://godoc.org/github.com/kr/pty) - -* [github.com/kr/text](https://godoc.org/github.com/kr/text) - -* [github.com/pmezard/go-difflib](https://godoc.org/github.com/pmezard/go-difflib) - -* [github.com/stretchr/objx](https://godoc.org/github.com/stretchr/objx) - -* [github.com/stretchr/testify](https://godoc.org/github.com/stretchr/testify) - -* [gopkg.in/check.v1](https://godoc.org/gopkg.in/check.v1) - -* [gopkg.in/yaml.v2](https://godoc.org/gopkg.in/yaml.v2) diff --git a/vendor/github.com/markbates/pkger/apply.go b/vendor/github.com/markbates/pkger/apply.go deleted file mode 100644 index e59b19c..0000000 --- a/vendor/github.com/markbates/pkger/apply.go +++ /dev/null @@ -1,19 +0,0 @@ -package pkger - -import ( - "github.com/markbates/pkger/pkging" -) - -// Apply will wrap the current implementation -// of pkger.Pkger with the new pkg. This allows -// for layering of pkging.Pkger implementations. -func Apply(pkg pkging.Pkger, err error) error { - if err != nil { - panic(err) - return err - } - gil.Lock() - defer gil.Unlock() - current = pkging.Wrap(current, pkg) - return nil -} diff --git a/vendor/github.com/markbates/pkger/here/here.go b/vendor/github.com/markbates/pkger/here/here.go deleted file mode 100644 index f87a061..0000000 --- a/vendor/github.com/markbates/pkger/here/here.go +++ /dev/null @@ -1,14 +0,0 @@ -package here - -import ( - "github.com/gobuffalo/here" -) - -type Info = here.Info -type Module = here.Module -type Path = here.Path - -var Here = here.New() -var Dir = Here.Dir -var Package = Here.Package -var Current = Here.Current diff --git a/vendor/github.com/markbates/pkger/internal/maps/files.go b/vendor/github.com/markbates/pkger/internal/maps/files.go deleted file mode 100644 index 3b3b6ac..0000000 --- a/vendor/github.com/markbates/pkger/internal/maps/files.go +++ /dev/null @@ -1,124 +0,0 @@ -// Code generated by github.com/gobuffalo/mapgen. DO NOT EDIT. - -package maps - -import ( - "encoding/json" - "fmt" - "sort" - "sync" - - "github.com/markbates/pkger/here" - "github.com/markbates/pkger/pkging" -) - -// Files wraps sync.Map and uses the following types: -// key: here.Path -// value: pkging.File -type Files struct { - data *sync.Map - once *sync.Once -} - -func (m *Files) Data() *sync.Map { - if m.once == nil { - m.once = &sync.Once{} - } - m.once.Do(func() { - if m.data == nil { - m.data = &sync.Map{} - } - }) - return m.data -} - -func (m *Files) MarshalJSON() ([]byte, error) { - var err error - mm := map[string]interface{}{} - m.Data().Range(func(key, value interface{}) bool { - var b []byte - b, err = json.Marshal(key) - if err != nil { - return false - } - mm[string(b)] = value - return true - }) - - if err != nil { - return nil, err - } - - return json.Marshal(mm) -} - -func (m *Files) UnmarshalJSON(b []byte) error { - mm := map[string]pkging.File{} - - if err := json.Unmarshal(b, &mm); err != nil { - return err - } - for k, v := range mm { - var pt here.Path - if err := json.Unmarshal([]byte(k), &pt); err != nil { - return err - } - m.Store(pt, v) - } - return nil -} - -// Delete the key from the map -func (m *Files) Delete(key here.Path) { - m.Data().Delete(key) -} - -// Load the key from the map. -// Returns pkging.File or bool. -// A false return indicates either the key was not found -// or the value is not of type pkging.File -func (m *Files) Load(key here.Path) (pkging.File, bool) { - i, ok := m.Data().Load(key) - if !ok { - return nil, false - } - s, ok := i.(pkging.File) - return s, ok -} - -// Range over the pkging.File values in the map -func (m *Files) Range(f func(key here.Path, value pkging.File) bool) { - m.Data().Range(func(k, v interface{}) bool { - key, ok := k.(here.Path) - if !ok { - return false - } - value, ok := v.(pkging.File) - if !ok { - return false - } - return f(key, value) - }) -} - -// Store a pkging.File in the map -func (m *Files) Store(key here.Path, value pkging.File) { - m.Data().Store(key, value) -} - -// Keys returns a list of keys in the map -func (m *Files) Keys() []here.Path { - var keys []here.Path - m.Range(func(key here.Path, value pkging.File) bool { - keys = append(keys, key) - return true - }) - sort.Slice(keys, func(a, b int) bool { - return keys[a].String() <= keys[b].String() - }) - return keys -} - -func (m *Files) String() string { - return fmt.Sprintf("%v", m.Keys()) -} diff --git a/vendor/github.com/markbates/pkger/internal/maps/infos.go b/vendor/github.com/markbates/pkger/internal/maps/infos.go deleted file mode 100644 index 0eed02f..0000000 --- a/vendor/github.com/markbates/pkger/internal/maps/infos.go +++ /dev/null @@ -1,103 +0,0 @@ -// Code generated by github.com/markbates/pkger/mapgen. DO NOT EDIT. - -package maps - -import ( - "encoding/json" - "fmt" - "sort" - "sync" - - "github.com/markbates/pkger/here" -) - -// Infos wraps sync.Map and uses the following types: -// key: string -// value: here.Info -type Infos struct { - data *sync.Map - once *sync.Once -} - -func (m *Infos) Data() *sync.Map { - if m.once == nil { - m.once = &sync.Once{} - } - m.once.Do(func() { - if m.data == nil { - m.data = &sync.Map{} - } - }) - return m.data -} - -func (m *Infos) MarshalJSON() ([]byte, error) { - mm := map[string]interface{}{} - m.data.Range(func(key, value interface{}) bool { - mm[fmt.Sprintf("%s", key)] = value - return true - }) - return json.Marshal(mm) -} - -func (m *Infos) UnmarshalJSON(b []byte) error { - mm := map[string]here.Info{} - - if err := json.Unmarshal(b, &mm); err != nil { - return err - } - for k, v := range mm { - m.Store(k, v) - } - return nil -} - -// Delete the key from the map -func (m *Infos) Delete(key string) { - m.Data().Delete(key) -} - -// Load the key from the map. -// Returns here.Info or bool. -// A false return indicates either the key was not found -// or the value is not of type here.Info -func (m *Infos) Load(key string) (here.Info, bool) { - m.Data() - i, ok := m.data.Load(key) - if !ok { - return here.Info{}, false - } - s, ok := i.(here.Info) - return s, ok -} - -// Range over the here.Info values in the map -func (m *Infos) Range(f func(key string, value here.Info) bool) { - m.Data().Range(func(k, v interface{}) bool { - key, ok := k.(string) - if !ok { - return false - } - value, ok := v.(here.Info) - if !ok { - return false - } - return f(key, value) - }) -} - -// Store a here.Info in the map -func (m *Infos) Store(key string, value here.Info) { - m.Data().Store(key, value) -} - -// Keys returns a list of keys in the map -func (m *Infos) Keys() []string { - var keys []string - m.Range(func(key string, value here.Info) bool { - keys = append(keys, key) - return true - }) - sort.Strings(keys) - return keys -} diff --git a/vendor/github.com/markbates/pkger/pkger.go b/vendor/github.com/markbates/pkger/pkger.go deleted file mode 100644 index 5f56a51..0000000 --- a/vendor/github.com/markbates/pkger/pkger.go +++ /dev/null @@ -1,95 +0,0 @@ -package pkger - -import ( - "net/http" - "os" - "path/filepath" - "sync" - - "github.com/markbates/pkger/here" - "github.com/markbates/pkger/pkging" - "github.com/markbates/pkger/pkging/stdos" -) - -var current pkging.Pkger -var gil = &sync.RWMutex{} - -var disk = func() pkging.Pkger { - her, _ := here.Current() - n, _ := stdos.New(her) - return n -}() - -func impl() pkging.Pkger { - gil.RLock() - defer gil.RUnlock() - if current == nil { - return disk - } - return current -} - -type Dir string - -func (d Dir) Open(name string) (http.File, error) { - f, err := impl().Open(string(d)) - if err != nil { - return nil, err - } - return f.Open(name) -} - -// Parse the string in here.Path format. -func Parse(p string) (here.Path, error) { - return impl().Parse(p) -} - -// Current returns the here.Info representing the current Pkger implementation. -func Current() (here.Info, error) { - return impl().Current() -} - -// Info returns the here.Info of the here.Path -func Info(p string) (here.Info, error) { - return impl().Info(p) -} - -// Create creates the named file with mode 0666 (before umask) - It's actually 0644, truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR. -func Create(p string) (pkging.File, error) { - return impl().Create(p) -} - -// MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error. The permission bits perm (before umask) are used for all directories that MkdirAll creates. If path is already a directory, MkdirAll does nothing and returns nil. -func MkdirAll(p string, perm os.FileMode) error { - return impl().MkdirAll(p, perm) -} - -// Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. -func Open(p string) (pkging.File, error) { - return impl().Open(p) -} - -// Stat returns a FileInfo describing the named file. -func Stat(name string) (os.FileInfo, error) { - return impl().Stat(name) -} - -// Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links. - That is from the standard library. I know. Their grammar teachers can not be happy with them right now. -func Walk(p string, wf filepath.WalkFunc) error { - return impl().Walk(p, wf) -} - -// Remove removes the named file or (empty) directory. -func Remove(name string) error { - return impl().Remove(name) -} - -// RemoveAll removes path and any children it contains. It removes everything it can but returns the first error it encounters. If the path does not exist, RemoveAll returns nil (no error). -func RemoveAll(name string) error { - return impl().RemoveAll(name) -} - -// Include is a no-op that directs the pkger tool to include the desired file or folder. -func Include(name string) string { - return name -} diff --git a/vendor/github.com/markbates/pkger/pkging/embed/embed.go b/vendor/github.com/markbates/pkger/pkging/embed/embed.go deleted file mode 100644 index 3ed7e7e..0000000 --- a/vendor/github.com/markbates/pkger/pkging/embed/embed.go +++ /dev/null @@ -1,55 +0,0 @@ -package embed - -import ( - "bytes" - "compress/gzip" - "encoding/hex" - "io" - - "github.com/markbates/pkger/here" -) - -func Decode(src []byte) ([]byte, error) { - dst := make([]byte, hex.DecodedLen(len(src))) - _, err := hex.Decode(dst, src) - if err != nil { - return nil, err - } - - r, err := gzip.NewReader(bytes.NewReader(dst)) - if err != nil { - return nil, err - } - - bb := &bytes.Buffer{} - if _, err := io.Copy(bb, r); err != nil { - return nil, err - } - return bb.Bytes(), nil -} - -func Encode(b []byte) ([]byte, error) { - bb := &bytes.Buffer{} - gz := gzip.NewWriter(bb) - - if _, err := gz.Write(b); err != nil { - return nil, err - } - - if err := gz.Flush(); err != nil { - return nil, err - } - - if err := gz.Close(); err != nil { - return nil, err - } - - s := hex.EncodeToString(bb.Bytes()) - return []byte(s), nil -} - -type Data struct { - Infos map[string]here.Info `json:"infos"` - Files map[string]File `json:"files"` - Here here.Info `json:"here"` -} diff --git a/vendor/github.com/markbates/pkger/pkging/embed/file.go b/vendor/github.com/markbates/pkger/pkging/embed/file.go deleted file mode 100644 index af239f8..0000000 --- a/vendor/github.com/markbates/pkger/pkging/embed/file.go +++ /dev/null @@ -1,14 +0,0 @@ -package embed - -import ( - "github.com/markbates/pkger/here" - "github.com/markbates/pkger/pkging" -) - -type File struct { - Info *pkging.FileInfo `json:"info"` - Here here.Info `json:"her"` - Path here.Path `json:"path"` - Data []byte `json:"data"` - Parent here.Path `json:"parent"` -} diff --git a/vendor/github.com/markbates/pkger/pkging/faces.go b/vendor/github.com/markbates/pkger/pkging/faces.go deleted file mode 100644 index 5a8efcd..0000000 --- a/vendor/github.com/markbates/pkger/pkging/faces.go +++ /dev/null @@ -1,7 +0,0 @@ -package pkging - -import "os" - -type Adder interface { - Add(files ...*os.File) error -} diff --git a/vendor/github.com/markbates/pkger/pkging/file.go b/vendor/github.com/markbates/pkger/pkging/file.go deleted file mode 100644 index c7d12a1..0000000 --- a/vendor/github.com/markbates/pkger/pkging/file.go +++ /dev/null @@ -1,44 +0,0 @@ -package pkging - -import ( - "net/http" - "os" - - "github.com/markbates/pkger/here" -) - -type File interface { - // Close closes the File, rendering it unusable for I/O. - Close() error - - // Info returns the here.Info of the file - Info() here.Info - - // Name retuns the name of the file - Name() string - - // Open implements the http.FileSystem interface. A FileSystem implements access to a collection of named files. The elements in a file path are separated by slash ('/', U+002F) characters, regardless of host operating system convention. - Open(name string) (http.File, error) - - // Path returns the here.Path of the file - Path() here.Path - - // Read reads up to len(b) bytes from the File. It returns the number of bytes read and any error encountered. At end of file, Read returns 0, io.EOF. - Read(p []byte) (int, error) - - // Readdir reads the contents of the directory associated with file and returns a slice of up to n FileInfo values, as would be returned by Lstat, in directory order. Subsequent calls on the same file will yield further FileInfos. - // - // If n > 0, Readdir returns at most n FileInfo structures. In this case, if Readdir returns an empty slice, it will return a non-nil error explaining why. At the end of a directory, the error is io.EOF. - // - // If n <= 0, Readdir returns all the FileInfo from the directory in a single slice. In this case, if Readdir succeeds (reads all the way to the end of the directory), it returns the slice and a nil error. If it encounters an error before the end of the directory, Readdir returns the FileInfo read until that point and a non-nil error. - Readdir(count int) ([]os.FileInfo, error) - - // Seek sets the offset for the next Read or Write on file to offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end. It returns the new offset and an error, if any. - Seek(offset int64, whence int) (int64, error) - - // Stat returns the FileInfo structure describing file. If there is an error, it will be of type *PathError. - Stat() (os.FileInfo, error) - - // Write writes len(b) bytes to the File. It returns the number of bytes written and an error, if any. Write returns a non-nil error when n != len(b). - Write(b []byte) (int, error) -} diff --git a/vendor/github.com/markbates/pkger/pkging/file_info.go b/vendor/github.com/markbates/pkger/pkging/file_info.go deleted file mode 100644 index dd194c8..0000000 --- a/vendor/github.com/markbates/pkger/pkging/file_info.go +++ /dev/null @@ -1,65 +0,0 @@ -package pkging - -import ( - "encoding/json" - "os" - "time" -) - -type Details struct { - Name string `json:"name"` - Size int64 `json:"size"` - Mode os.FileMode `json:"mode"` - ModTime ModTime `json:"mod_time"` - IsDir bool `json:"is_dir"` - Sys interface{} `json:"sys"` -} - -type FileInfo struct { - Details `json:"details"` -} - -func (f *FileInfo) String() string { - b, _ := json.MarshalIndent(f, "", " ") - return string(b) -} - -func (f *FileInfo) Name() string { - return f.Details.Name -} - -func (f *FileInfo) Size() int64 { - return f.Details.Size -} - -func (f *FileInfo) Mode() os.FileMode { - return f.Details.Mode -} - -func (f *FileInfo) ModTime() time.Time { - return time.Time(f.Details.ModTime) -} - -func (f *FileInfo) IsDir() bool { - return f.Details.IsDir -} - -func (f *FileInfo) Sys() interface{} { - return f.Details.Sys -} - -var _ os.FileInfo = &FileInfo{} - -func NewFileInfo(info os.FileInfo) *FileInfo { - fi := &FileInfo{ - Details: Details{ - Name: info.Name(), - Size: info.Size(), - Mode: info.Mode(), - ModTime: ModTime(info.ModTime()), - IsDir: info.IsDir(), - Sys: info.Sys(), - }, - } - return fi -} diff --git a/vendor/github.com/markbates/pkger/pkging/mem/add.go b/vendor/github.com/markbates/pkger/pkging/mem/add.go deleted file mode 100644 index a77379a..0000000 --- a/vendor/github.com/markbates/pkger/pkging/mem/add.go +++ /dev/null @@ -1,104 +0,0 @@ -package mem - -import ( - "bytes" - "io" - "os" - "path/filepath" - - "github.com/markbates/pkger/here" - "github.com/markbates/pkger/pkging" -) - -var _ pkging.Adder = &Pkger{} - -// Add copies the pkging.File into the *Pkger -func (fx *Pkger) Add(files ...*os.File) error { - for _, f := range files { - info, err := f.Stat() - if err != nil { - return err - } - pt, err := fx.Parse(f.Name()) - if err != nil { - return err - } - - dir := f.Name() - if !info.IsDir() { - dir = filepath.Dir(dir) - } - - her, err := here.Dir(dir) - if err != nil { - return err - } - if info.IsDir() { - err = filepath.Walk(f.Name(), func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - f, err := os.Open(path) - if err != nil { - return err - } - defer f.Close() - - pt, err := fx.Parse(path) - if err != nil { - return err - } - - her, err := here.Package(pt.Pkg) - if err != nil { - return err - } - - mf := &File{ - Here: her, - info: pkging.NewFileInfo(info), - path: pt, - pkging: fx, - } - - if !info.IsDir() { - bb := &bytes.Buffer{} - _, err = io.Copy(bb, f) - if err != nil { - return err - } - mf.data = bb.Bytes() - } - - fx.files.Store(mf.Path(), mf) - - return nil - }) - if err != nil { - return err - } - continue - } - - mf := &File{ - Here: her, - info: pkging.NewFileInfo(info), - path: pt, - pkging: fx, - } - - if !info.IsDir() { - bb := &bytes.Buffer{} - _, err = io.Copy(bb, f) - if err != nil { - return err - } - mf.data = bb.Bytes() - } - - fx.files.Store(mf.Path(), mf) - } - - return nil -} diff --git a/vendor/github.com/markbates/pkger/pkging/mem/embed.go b/vendor/github.com/markbates/pkger/pkging/mem/embed.go deleted file mode 100644 index a7086ed..0000000 --- a/vendor/github.com/markbates/pkger/pkging/mem/embed.go +++ /dev/null @@ -1,92 +0,0 @@ -package mem - -import ( - "encoding/json" - - "github.com/markbates/pkger/here" - "github.com/markbates/pkger/internal/maps" - "github.com/markbates/pkger/pkging" - "github.com/markbates/pkger/pkging/embed" -) - -// MarshalJSON creates a fully re-hydratable JSON representation of *Pkger -func (p *Pkger) MarshalJSON() ([]byte, error) { - files := map[string]embed.File{} - - p.files.Range(func(key here.Path, file pkging.File) bool { - f, ok := file.(*File) - if !ok { - return true - } - ef := embed.File{ - Info: f.info, - Here: f.Here, - Path: f.path, - Parent: f.parent, - Data: f.data, - } - files[key.String()] = ef - return true - }) - - infos := map[string]here.Info{} - p.infos.Range(func(key string, info here.Info) bool { - infos[key] = info - return true - }) - ed := embed.Data{ - Infos: infos, - Files: files, - Here: p.Here, - } - return json.Marshal(ed) -} - -// UnmarshalJSON re-hydrates the *Pkger -func (p *Pkger) UnmarshalJSON(b []byte) error { - y := &embed.Data{ - Infos: map[string]here.Info{}, - Files: map[string]embed.File{}, - } - - if err := json.Unmarshal(b, &y); err != nil { - return err - } - - p.Here = y.Here - p.infos = &maps.Infos{} - for k, v := range y.Infos { - p.infos.Store(k, v) - } - - p.files = &maps.Files{} - for k, v := range y.Files { - pt, err := p.Parse(k) - if err != nil { - return err - } - - f := &File{ - Here: v.Here, - info: v.Info, - path: v.Path, - data: v.Data, - parent: v.Parent, - } - p.files.Store(pt, f) - } - return nil -} - -func UnmarshalEmbed(in []byte) (*Pkger, error) { - b, err := embed.Decode(in) - if err != nil { - return nil, err - } - - p := &Pkger{} - if err := json.Unmarshal(b, p); err != nil { - return nil, err - } - return p, nil -} diff --git a/vendor/github.com/markbates/pkger/pkging/mem/file.go b/vendor/github.com/markbates/pkger/pkging/mem/file.go deleted file mode 100644 index 2d4d244..0000000 --- a/vendor/github.com/markbates/pkger/pkging/mem/file.go +++ /dev/null @@ -1,203 +0,0 @@ -package mem - -import ( - "bytes" - "fmt" - "io" - "net/http" - "os" - "path" - "path/filepath" - "time" - - "github.com/markbates/pkger/here" - "github.com/markbates/pkger/pkging" -) - -const timeFmt = time.RFC3339Nano - -var _ pkging.File = &File{} - -type File struct { - Here here.Info - info *pkging.FileInfo - path here.Path - data []byte - parent here.Path - writer *bytes.Buffer - reader io.Reader - pkging pkging.Pkger -} - -// Seek sets the offset for the next Read or Write on file to offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end. It returns the new offset and an error, if any. -func (f *File) Seek(ofpkginget int64, whence int) (int64, error) { - if len(f.data) > 0 && f.reader == nil { - f.reader = bytes.NewReader(f.data) - } - - if sk, ok := f.reader.(io.Seeker); ok { - return sk.Seek(ofpkginget, whence) - } - return 0, nil -} - -// Close closes the File, rendering it unusable for I/O. -func (f *File) Close() error { - defer func() { - f.reader = nil - f.writer = nil - }() - if f.reader != nil { - if c, ok := f.reader.(io.Closer); ok { - if err := c.Close(); err != nil { - return err - } - } - } - - if f.writer == nil { - return nil - } - - f.data = f.writer.Bytes() - - fi := f.info - fi.Details.Size = int64(len(f.data)) - fi.Details.ModTime = pkging.ModTime(time.Now()) - f.info = fi - return nil -} - -// Read reads up to len(b) bytes from the File. It returns the number of bytes read and any error encountered. At end of file, Read returns 0, io.EOF. -func (f *File) Read(p []byte) (int, error) { - if len(f.data) > 0 && f.reader == nil { - f.reader = bytes.NewReader(f.data) - } - - if f.reader != nil { - return f.reader.Read(p) - } - - return 0, fmt.Errorf("unable to read %s", f.Name()) -} - -// Write writes len(b) bytes to the File. It returns the number of bytes written and an error, if any. Write returns a non-nil error when n != len(b). -func (f *File) Write(b []byte) (int, error) { - if f.writer == nil { - f.writer = &bytes.Buffer{} - } - i, err := f.writer.Write(b) - return i, err -} - -// Info returns the here.Info of the file -func (f File) Info() here.Info { - return f.Here -} - -// Stat returns the FileInfo structure describing file. If there is an error, it will be of type *PathError. -func (f File) Stat() (os.FileInfo, error) { - if f.info == nil { - return nil, os.ErrNotExist - } - return f.info, nil -} - -// Name retuns the name of the file in pkger format -func (f File) Name() string { - return f.path.String() -} - -// Path returns the here.Path of the file -func (f File) Path() here.Path { - return f.path -} - -func (f File) String() string { - return f.Path().String() -} - -// Readdir reads the contents of the directory associated with file and returns a slice of up to n FileInfo values, as would be returned by Lstat, in directory order. Subsequent calls on the same file will yield further FileInfos. -// -// If n > 0, Readdir returns at most n FileInfo structures. In this case, if Readdir returns an empty slice, it will return a non-nil error explaining why. At the end of a directory, the error is io.EOF. -// -// If n <= 0, Readdir returns all the FileInfo from the directory in a single slice. In this case, if Readdir succeeds (reads all the way to the end of the directory), it returns the slice and a nil error. If it encounters an error before the end of the directory, Readdir returns the FileInfo read until that point and a non-nil error. -func (f *File) Readdir(count int) ([]os.FileInfo, error) { - var infos []os.FileInfo - root := f.Path().String() - err := f.pkging.Walk(root, func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - if count > 0 && len(infos) == count { - return io.EOF - } - - if root == path { - return nil - } - - pt, err := f.pkging.Parse(path) - if err != nil { - return err - } - if pt.Name == f.parent.Name { - return nil - } - - infos = append(infos, info) - if info.IsDir() && path != root { - return filepath.SkipDir - } - - return nil - }) - - if err != nil { - if _, ok := err.(*os.PathError); ok { - return infos, nil - } - if err != io.EOF { - return nil, err - } - } - return infos, nil - -} - -// Open implements the http.FileSystem interface. A FileSystem implements access to a collection of named files. The elements in a file path are separated by slash ('/', U+002F) characters, regardless of host operating system convention. -func (f *File) Open(name string) (http.File, error) { - pt, err := f.Here.Parse(name) - if err != nil { - return nil, err - } - - if pt == f.path { - return f, nil - } - - pt.Name = path.Join(f.Path().Name, pt.Name) - - di, err := f.pkging.Open(pt.String()) - if err != nil { - return nil, err - } - - fi, err := di.Stat() - if err != nil { - return nil, err - } - - if fi.IsDir() { - d2 := &File{ - info: pkging.NewFileInfo(fi), - Here: di.Info(), - path: pt, - parent: f.path, - pkging: f.pkging, - } - di = d2 - } - return di, nil -} diff --git a/vendor/github.com/markbates/pkger/pkging/mem/mem.go b/vendor/github.com/markbates/pkger/pkging/mem/mem.go deleted file mode 100644 index 1590e3e..0000000 --- a/vendor/github.com/markbates/pkger/pkging/mem/mem.go +++ /dev/null @@ -1,252 +0,0 @@ -package mem - -import ( - "fmt" - "os" - "path" - "path/filepath" - "strings" - "time" - - "github.com/markbates/pkger/here" - "github.com/markbates/pkger/internal/maps" - "github.com/markbates/pkger/pkging" -) - -var _ pkging.Pkger = &Pkger{} - -// New returns *Pkger for the provided here.Info -func New(info here.Info) (*Pkger, error) { - f := &Pkger{ - infos: &maps.Infos{}, - files: &maps.Files{}, - Here: info, - } - f.infos.Store(info.ImportPath, info) - return f, nil -} - -type Pkger struct { - Here here.Info - infos *maps.Infos - files *maps.Files -} - -// Current returns the here.Info representing the current Pkger implementation. -func (f *Pkger) Current() (here.Info, error) { - return f.Here, nil -} - -// Info returns the here.Info of the here.Path -func (f *Pkger) Info(p string) (here.Info, error) { - info, ok := f.infos.Load(p) - if !ok { - return info, fmt.Errorf("no such package %q", p) - } - - return info, nil -} - -// Parse the string in here.Path format. -func (f *Pkger) Parse(p string) (here.Path, error) { - return f.Here.Parse(p) -} - -// Remove removes the named file or (empty) directory. -func (fx *Pkger) Remove(name string) error { - pt, err := fx.Parse(name) - if err != nil { - return err - } - - if _, ok := fx.files.Load(pt); !ok { - return &os.PathError{"remove", pt.String(), fmt.Errorf("no such file or directory")} - } - - fx.files.Delete(pt) - return nil -} - -// RemoveAll removes path and any children it contains. It removes everything it can but returns the first error it encounters. If the path does not exist, RemoveAll returns nil (no error). -func (fx *Pkger) RemoveAll(name string) error { - pt, err := fx.Parse(name) - if err != nil { - return err - } - - fx.files.Range(func(key here.Path, file pkging.File) bool { - if strings.HasPrefix(key.Name, pt.Name) { - fx.files.Delete(key) - } - return true - }) - - return nil -} - -// Create creates the named file with mode 0666 (before umask) - It's actually 0644, truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR. -func (fx *Pkger) Create(name string) (pkging.File, error) { - fx.MkdirAll("/", 0755) - pt, err := fx.Parse(name) - if err != nil { - return nil, err - } - - her, err := fx.Info(pt.Pkg) - if err != nil { - return nil, err - } - - dir := filepath.Dir(pt.Name) - if dir != "/" { - if _, err := fx.Stat(dir); err != nil { - return nil, err - } - } - - f := &File{ - Here: her, - path: pt, - info: &pkging.FileInfo{ - Details: pkging.Details{ - Name: filepath.Base(name), - Mode: 0644, - ModTime: pkging.ModTime(time.Now()), - }, - }, - pkging: fx, - } - - fx.files.Store(pt, f) - - return f, nil -} - -// MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error. The permission bits perm (before umask) are used for all directories that MkdirAll creates. If path is already a directory, MkdirAll does nothing and returns nil. -func (fx *Pkger) MkdirAll(p string, perm os.FileMode) error { - pt, err := fx.Parse(p) - if err != nil { - return err - } - dir, name := path.Split(pt.Name) - - if dir != "/" { - if err := fx.MkdirAll(dir, perm); err != nil { - return err - } - } - - if dir == "/" && name == "" { - dir = filepath.Base(fx.Here.Dir) - } - - f := &File{ - Here: fx.Here, - pkging: fx, - path: pt, - info: &pkging.FileInfo{ - Details: pkging.Details{ - IsDir: true, - Name: name, - Mode: perm, - ModTime: pkging.ModTime(time.Now()), - }, - }, - } - if err := f.Close(); err != nil { - return err - } - fx.files.Store(pt, f) - return nil - -} - -// Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. -func (fx *Pkger) Open(name string) (pkging.File, error) { - pt, err := fx.Parse(name) - if err != nil { - return nil, &os.PathError{ - Op: "open", - Path: name, - Err: err, - } - } - - fl, ok := fx.files.Load(pt) - if !ok { - return nil, os.ErrNotExist - } - f, ok := fl.(*File) - if !ok { - return nil, os.ErrNotExist - } - nf := &File{ - pkging: fx, - info: pkging.NewFileInfo(f.info), - path: f.path, - data: f.data, - Here: f.Here, - } - - return nf, nil -} - -// Stat returns a FileInfo describing the named file. -func (fx *Pkger) Stat(name string) (os.FileInfo, error) { - pt, err := fx.Parse(name) - if err != nil { - return nil, err - } - f, ok := fx.files.Load(pt) - if ok { - return f.Stat() - } - return nil, fmt.Errorf("could not stat %s", pt) -} - -// Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links. - That is from the standard library. I know. Their grammar teachers can not be happy with them right now. -func (f *Pkger) Walk(p string, wf filepath.WalkFunc) error { - keys := f.files.Keys() - - pt, err := f.Parse(p) - if err != nil { - return err - } - - skip := "!" - for _, k := range keys { - if k.Pkg != pt.Pkg { - continue - } - if !strings.HasPrefix(k.Name, pt.Name) { - continue - } - if strings.HasPrefix(k.Name, skip) { - continue - } - - fl, ok := f.files.Load(k) - if !ok { - return os.ErrNotExist - } - - fi, err := fl.Stat() - if err != nil { - return err - } - - fi = pkging.NewFileInfo(fi) - - err = wf(k.String(), fi, nil) - if err == filepath.SkipDir { - - skip = k.Name - continue - } - - if err != nil { - return err - } - } - return nil -} diff --git a/vendor/github.com/markbates/pkger/pkging/mod_time.go b/vendor/github.com/markbates/pkger/pkging/mod_time.go deleted file mode 100644 index d81a32c..0000000 --- a/vendor/github.com/markbates/pkger/pkging/mod_time.go +++ /dev/null @@ -1,24 +0,0 @@ -package pkging - -import ( - "encoding/json" - "time" -) - -const timeFmt = time.RFC3339Nano - -type ModTime time.Time - -func (m ModTime) MarshalJSON() ([]byte, error) { - t := time.Time(m) - return json.Marshal(t.Format(timeFmt)) -} - -func (m *ModTime) UnmarshalJSON(b []byte) error { - t := time.Time{} - if err := json.Unmarshal(b, &t); err != nil { - return err - } - (*m) = ModTime(t) - return nil -} diff --git a/vendor/github.com/markbates/pkger/pkging/pkger.go b/vendor/github.com/markbates/pkger/pkging/pkger.go deleted file mode 100644 index b2076f6..0000000 --- a/vendor/github.com/markbates/pkger/pkging/pkger.go +++ /dev/null @@ -1,43 +0,0 @@ -package pkging - -import ( - "os" - "path/filepath" - - "github.com/markbates/pkger/here" -) - -type Pkger interface { - // Parse the string in here.Path format. - Parse(p string) (here.Path, error) - - // Current returns the here.Info representing the current Pkger implementation. - Current() (here.Info, error) - - // Info returns the here.Info of the here.Path - Info(p string) (here.Info, error) - - // Create creates the named file with mode 0666 (before umask) - It's actually 0644, truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR. - Create(name string) (File, error) - - // MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error. The permission bits perm (before umask) are used for all directories that MkdirAll creates. If path is already a directory, MkdirAll does nothing and returns nil. - MkdirAll(p string, perm os.FileMode) error - - // Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. - // @Parser Directive - Open(name string) (File, error) - - // Stat returns a FileInfo describing the named file. - // @Parser Directive - Stat(name string) (os.FileInfo, error) - - // Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links. - That is from the standard library. I know. Their grammar teachers can not be happy with them right now. - // @Parser Directive - Walk(p string, wf filepath.WalkFunc) error - - // Remove removes the named file or (empty) directory. - Remove(name string) error - - // RemoveAll removes path and any children it contains. It removes everything it can but returns the first error it encounters. If the path does not exist, RemoveAll returns nil (no error). - RemoveAll(path string) error -} diff --git a/vendor/github.com/markbates/pkger/pkging/stdos/file.go b/vendor/github.com/markbates/pkger/pkging/stdos/file.go deleted file mode 100644 index 35845cf..0000000 --- a/vendor/github.com/markbates/pkger/pkging/stdos/file.go +++ /dev/null @@ -1,73 +0,0 @@ -package stdos - -import ( - "net/http" - "os" - "path" - - "github.com/markbates/pkger/here" - "github.com/markbates/pkger/pkging" -) - -var _ pkging.File = &File{} - -type File struct { - *os.File - info *pkging.FileInfo - her here.Info - path here.Path - pkging pkging.Pkger -} - -// Close closes the File, rendering it unusable for I/O. -func (f *File) Close() error { - return f.File.Close() -} - -// Info returns the here.Info of the file -func (f *File) Info() here.Info { - return f.her -} - -// Name retuns the name of the file in pkger format -func (f File) Name() string { - return f.path.String() -} - -// Readdir reads the contents of the directory associated with file and returns a slice of up to n FileInfo values, as would be returned by Lstat, in directory order. Subsequent calls on the same file will yield further FileInfos. -// -// If n > 0, Readdir returns at most n FileInfo structures. In this case, if Readdir returns an empty slice, it will return a non-nil error explaining why. At the end of a directory, the error is io.EOF. -// -// If n <= 0, Readdir returns all the FileInfo from the directory in a single slice. In this case, if Readdir succeeds (reads all the way to the end of the directory), it returns the slice and a nil error. If it encounters an error before the end of the directory, Readdir returns the FileInfo read until that point and a non-nil error. -func (f *File) Readdir(count int) ([]os.FileInfo, error) { - return f.File.Readdir(count) -} - -// Open implements the http.FileSystem interface. A FileSystem implements access to a collection of named files. The elements in a file path are separated by slash ('/', U+002F) characters, regardless of host operating system convention. -func (f *File) Open(name string) (http.File, error) { - fp := path.Join(f.Path().Name, name) - f2, err := f.pkging.Open(fp) - if err != nil { - return nil, err - } - return f2, nil -} - -// Path returns the here.Path of the file -func (f *File) Path() here.Path { - return f.path -} - -// Stat returns the FileInfo structure describing file. If there is an error, it will be of type *PathError. -func (f *File) Stat() (os.FileInfo, error) { - if f.info != nil { - return f.info, nil - } - - info, err := f.File.Stat() - if err != nil { - return nil, err - } - f.info = pkging.NewFileInfo(info) - return f.info, nil -} diff --git a/vendor/github.com/markbates/pkger/pkging/stdos/json.go b/vendor/github.com/markbates/pkger/pkging/stdos/json.go deleted file mode 100644 index 8a0cfbd..0000000 --- a/vendor/github.com/markbates/pkger/pkging/stdos/json.go +++ /dev/null @@ -1 +0,0 @@ -package stdos diff --git a/vendor/github.com/markbates/pkger/pkging/stdos/stdos.go b/vendor/github.com/markbates/pkger/pkging/stdos/stdos.go deleted file mode 100644 index b811702..0000000 --- a/vendor/github.com/markbates/pkger/pkging/stdos/stdos.go +++ /dev/null @@ -1,223 +0,0 @@ -package stdos - -import ( - "fmt" - "os" - "path/filepath" - "strings" - - "github.com/markbates/pkger/here" - "github.com/markbates/pkger/internal/maps" - "github.com/markbates/pkger/pkging" -) - -var _ pkging.Pkger = &Pkger{} - -type Pkger struct { - Here here.Info - infos *maps.Infos -} - -// New returns *Pkger for the provided here.Info -func New(her here.Info) (*Pkger, error) { - p := &Pkger{ - infos: &maps.Infos{}, - Here: her, - } - p.infos.Store(her.ImportPath, her) - return p, nil -} - -// Create creates the named file with mode 0666 (before umask) - It's actually 0644, truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR. -func (fx *Pkger) Create(name string) (pkging.File, error) { - pt, err := fx.Parse(name) - if err != nil { - return nil, err - } - - her, err := fx.Info(pt.Pkg) - if err != nil { - return nil, err - } - - name = filepath.Join(her.Dir, pt.Name) - f, err := os.Create(name) - if err != nil { - return nil, err - } - - nf := &File{ - File: f, - her: her, - path: pt, - pkging: fx, - } - - info, err := f.Stat() - if err != nil { - return nil, err - } - nf.info = pkging.NewFileInfo(info) - return nf, nil -} - -// Current returns the here.Info representing the current Pkger implementation. -func (f *Pkger) Current() (here.Info, error) { - return f.Here, nil -} - -// Info returns the here.Info of the here.Path -func (f *Pkger) Info(p string) (here.Info, error) { - info, ok := f.infos.Load(p) - if ok { - return info, nil - } - - info, err := here.Package(p) - if err != nil { - return info, err - } - f.infos.Store(p, info) - return info, nil -} - -// MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error. The permission bits perm (before umask) are used for all directories that MkdirAll creates. If path is already a directory, MkdirAll does nothing and returns nil. -func (f *Pkger) MkdirAll(p string, perm os.FileMode) error { - pt, err := f.Parse(p) - if err != nil { - return err - } - info, err := f.Info(pt.Pkg) - if err != nil { - return err - } - return os.MkdirAll(filepath.Join(info.Dir, p), perm) -} - -// Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. -func (fx *Pkger) Open(name string) (pkging.File, error) { - pt, err := fx.Parse(name) - if err != nil { - return nil, err - } - - her, err := fx.Info(pt.Pkg) - if err != nil { - return nil, err - } - - name = filepath.Join(her.Dir, pt.Name) - f, err := os.Open(name) - if err != nil { - return nil, err - } - - nf := &File{ - File: f, - her: her, - path: pt, - pkging: fx, - } - - info, err := f.Stat() - if err != nil { - return nil, err - } - nf.info = pkging.NewFileInfo(info) - - return nf, nil -} - -// Parse the string in here.Path format. -func (f *Pkger) Parse(p string) (here.Path, error) { - return f.Here.Parse(p) -} - -// Stat returns a FileInfo describing the named file. -func (fx *Pkger) Stat(name string) (os.FileInfo, error) { - pt, err := fx.Parse(name) - if err != nil { - return nil, err - } - - her, err := fx.Info(pt.Pkg) - if err != nil { - return nil, err - } - - info, err := os.Stat(filepath.Join(her.Dir, pt.Name)) - if err != nil { - return nil, err - } - - info = pkging.NewFileInfo(info) - - return info, nil -} - -// Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links. - That is from the standard library. I know. Their grammar teachers can not be happy with them right now. -func (f *Pkger) Walk(p string, wf filepath.WalkFunc) error { - pt, err := f.Parse(p) - if err != nil { - return err - } - - info, err := f.Info(pt.Pkg) - if err != nil { - return err - } - - fp := filepath.Join(info.Dir, pt.Name) - err = filepath.Walk(fp, func(path string, fi os.FileInfo, err error) error { - if err != nil { - return err - } - - pt, err := f.Parse(fmt.Sprintf("%s:%s", pt.Pkg, path)) - if err != nil { - return err - } - - info, err := f.Info(pt.Pkg) - if err != nil { - return err - } - - path = strings.TrimPrefix(path, info.Dir) - path = strings.ReplaceAll(path, "\\", "/") - pt.Name = path - return wf(pt.String(), pkging.NewFileInfo(fi), nil) - }) - - return err -} - -// Remove removes the named file or (empty) directory. -func (fx *Pkger) Remove(name string) error { - pt, err := fx.Parse(name) - if err != nil { - return err - } - - info, err := fx.Info(pt.Pkg) - if err != nil { - return err - } - - return os.Remove(filepath.Join(info.Dir, pt.Name)) -} - -// RemoveAll removes path and any children it contains. It removes everything it can but returns the first error it encounters. If the path does not exist, RemoveAll returns nil (no error). -func (fx *Pkger) RemoveAll(name string) error { - pt, err := fx.Parse(name) - if err != nil { - return err - } - - info, err := fx.Info(pt.Pkg) - if err != nil { - return err - } - - return os.RemoveAll(filepath.Join(info.Dir, pt.Name)) -} diff --git a/vendor/github.com/markbates/pkger/pkging/wrap.go b/vendor/github.com/markbates/pkger/pkging/wrap.go deleted file mode 100644 index 438f955..0000000 --- a/vendor/github.com/markbates/pkger/pkging/wrap.go +++ /dev/null @@ -1,145 +0,0 @@ -package pkging - -import ( - "fmt" - "os" - "path/filepath" - - "github.com/markbates/pkger/here" -) - -func Wrap(parent, with Pkger) Pkger { - return withPkger{ - base: with, - parent: parent, - } -} - -type withPkger struct { - base Pkger - parent Pkger -} - -func (w withPkger) String() string { - if w.parent == nil { - return fmt.Sprintf("%T", w.base) - } - return fmt.Sprintf("%T > %T", w.base, w.parent) -} - -func (w withPkger) Parse(p string) (here.Path, error) { - pt, err := w.base.Parse(p) - if err != nil { - if w.parent != nil { - return w.parent.Parse(p) - } - return pt, err - } - return pt, nil -} - -func (w withPkger) Current() (here.Info, error) { - pt, err := w.base.Current() - if err != nil { - if w.parent != nil { - return w.parent.Current() - } - return pt, err - } - return pt, nil -} - -func (w withPkger) Info(p string) (here.Info, error) { - pt, err := w.base.Info(p) - if err != nil { - if w.parent != nil { - return w.parent.Info(p) - } - return pt, err - } - return pt, nil -} - -// Create creates the named file with mode 0666 (before umask) - It's actually 0644, truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR. -func (w withPkger) Create(p string) (File, error) { - pt, err := w.base.Create(p) - if err != nil { - if w.parent != nil { - return w.parent.Create(p) - } - return pt, err - } - return pt, nil -} - -// MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error. The permission bits perm (before umask) are used for all directories that MkdirAll creates. If path is already a directory, MkdirAll does nothing and returns nil. -func (w withPkger) MkdirAll(p string, perm os.FileMode) error { - err := w.base.MkdirAll(p, perm) - if err != nil { - return err - } - if w.parent != nil { - return w.parent.MkdirAll(p, perm) - } - return nil -} - -// Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. -func (w withPkger) Open(p string) (File, error) { - pt, err := w.base.Open(p) - if err != nil { - if w.parent != nil { - return w.parent.Open(p) - } - return pt, err - } - return pt, nil -} - -// Stat returns a FileInfo describing the named file. -func (w withPkger) Stat(p string) (os.FileInfo, error) { - pt, err := w.base.Stat(p) - if err != nil { - if w.parent != nil { - return w.parent.Stat(p) - } - return pt, err - } - return pt, nil -} - -// Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links. - That is from the standard library. I know. Their grammar teachers can not be happy with them right now. -func (w withPkger) Walk(p string, wf filepath.WalkFunc) error { - err := w.base.Walk(p, wf) - if err != nil { - return err - } - if w.parent != nil { - return w.parent.Walk(p, wf) - } - return nil -} - -// Remove removes the named file or (empty) directory. -func (w withPkger) Remove(p string) error { - err := w.base.Remove(p) - if err != nil { - return err - } - if w.parent != nil { - return w.parent.Remove(p) - } - return nil -} - -// RemoveAll removes path and any children it contains. It removes everything it can but returns the first error it encounters. If the path does not exist, RemoveAll returns nil (no error). -func (w withPkger) RemoveAll(p string) error { - err := w.base.RemoveAll(p) - if err != nil { - return err - } - if w.parent != nil { - return w.parent.RemoveAll(p) - } - return nil -} diff --git a/vendor/github.com/markbates/pkger/version.go b/vendor/github.com/markbates/pkger/version.go deleted file mode 100644 index 2d5c955..0000000 --- a/vendor/github.com/markbates/pkger/version.go +++ /dev/null @@ -1,4 +0,0 @@ -package pkger - -// Version of pkger -var Version = "development" diff --git a/vendor/golang.org/x/net/LICENSE b/vendor/golang.org/x/net/LICENSE index 6a66aea..2a7cf70 100644 --- a/vendor/golang.org/x/net/LICENSE +++ b/vendor/golang.org/x/net/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/net/html/doc.go b/vendor/golang.org/x/net/html/doc.go index 2466ae3..3a7e5ab 100644 --- a/vendor/golang.org/x/net/html/doc.go +++ b/vendor/golang.org/x/net/html/doc.go @@ -104,7 +104,7 @@ tokenization, and tokenization and tree construction stages of the WHATWG HTML parsing specification respectively. While the tokenizer parses and normalizes individual HTML tokens, only the parser constructs the DOM tree from the tokenized HTML, as described in the tree construction stage of the -specification, dynamically modifying or extending the docuemnt's DOM tree. +specification, dynamically modifying or extending the document's DOM tree. If your use case requires semantically well-formed HTML documents, as defined by the WHATWG specification, the parser should be used rather than the tokenizer. diff --git a/vendor/golang.org/x/text/LICENSE b/vendor/golang.org/x/text/LICENSE index 6a66aea..2a7cf70 100644 --- a/vendor/golang.org/x/text/LICENSE +++ b/vendor/golang.org/x/text/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/modules.txt b/vendor/modules.txt index 6b088bd..79a32ab 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -4,21 +4,11 @@ github.com/cpuguy83/go-md2man/v2/md2man # github.com/davecgh/go-spew v1.1.1 ## explicit github.com/davecgh/go-spew/spew -# github.com/gobuffalo/here v0.6.0 -## explicit; go 1.13 -github.com/gobuffalo/here # github.com/iancoleman/strcase v0.3.0 ## explicit; go 1.16 github.com/iancoleman/strcase -# github.com/markbates/pkger v0.17.1 -## explicit; go 1.13 -github.com/markbates/pkger -github.com/markbates/pkger/here -github.com/markbates/pkger/internal/maps -github.com/markbates/pkger/pkging -github.com/markbates/pkger/pkging/embed -github.com/markbates/pkger/pkging/mem -github.com/markbates/pkger/pkging/stdos +# github.com/kr/pretty v0.1.0 +## explicit # github.com/pmezard/go-difflib v1.0.0 ## explicit github.com/pmezard/go-difflib/difflib @@ -32,12 +22,12 @@ github.com/stretchr/testify/require # github.com/urfave/cli v1.22.15 ## explicit; go 1.11 github.com/urfave/cli -# golang.org/x/net v0.24.0 +# golang.org/x/net v0.28.0 ## explicit; go 1.18 golang.org/x/net/html golang.org/x/net/html/atom golang.org/x/net/html/charset -# golang.org/x/text v0.14.0 +# golang.org/x/text v0.17.0 ## explicit; go 1.18 golang.org/x/text/encoding golang.org/x/text/encoding/charmap @@ -56,6 +46,8 @@ golang.org/x/text/internal/utf8internal golang.org/x/text/language golang.org/x/text/runes golang.org/x/text/transform +# gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 +## explicit # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3