diff --git a/.travis.yml b/.travis.yml
index 338fff2bb41137fae8287f23c7cc3824287fde14..5ac8d1b42a21249c85200ce766aed66e83237215 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,13 +1,11 @@
matrix:
include:
- language: go
- go: "1.10"
+ go: 1.11.x
- language: go
- go: "1.11"
+ go: 1.12.x
- language: go
- go: "1.12"
- - language: go
- go: "1.13"
+ go: 1.13.x
- language: node_js
node_js: 8
before_install:
@@ -28,6 +26,19 @@ matrix:
before_install:
- cd webui
after_success: []
+ - language: node_js
+ node_js: 12
+ before_install:
+ - cd webui
+ after_success: []
+ - language: node_js
+ node_js: 13
+ before_install:
+ - cd webui
+ after_success: []
+
+env:
+ GO111MODULE=on
install:
- make install
diff --git a/Gopkg.lock b/Gopkg.lock
deleted file mode 100644
index 94d250324ad107429a70f77b01d3d87b9df0d316..0000000000000000000000000000000000000000
--- a/Gopkg.lock
+++ /dev/null
@@ -1,524 +0,0 @@
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-
-
-[[projects]]
- digest = "1:25c825a120e8ae421b807f06eaa30f4d30ad3700fc103b7aaa24af8358498d31"
- name = "github.com/99designs/gqlgen"
- packages = [
- "api",
- "codegen",
- "codegen/config",
- "codegen/templates",
- "complexity",
- "graphql",
- "graphql/introspection",
- "handler",
- "internal/code",
- "internal/imports",
- "plugin",
- "plugin/modelgen",
- "plugin/resolvergen",
- "plugin/schemaconfig",
- ]
- pruneopts = "UT"
- revision = "4eeacc6e4cb7bedc7c5312b6a3947697ad5cfb55"
- version = "v0.9.2"
-
-[[projects]]
- digest = "1:364c89f564ef045872f82ff2f156fd3cb09274e4a3bdbf89aef2c2370c955f95"
- name = "github.com/MichaelMure/go-term-text"
- packages = ["."]
- pruneopts = "UT"
- revision = "6d868251433124ef4ed19c9f8e973ac610d42ef5"
- version = "v0.2.4"
-
-[[projects]]
- digest = "1:897d91c431ce469d35a5e6030e60e617dccd9a0e95bdffa6a80594f5c5800d29"
- name = "github.com/agnivade/levenshtein"
- packages = ["."]
- pruneopts = "UT"
- revision = "3d21ba515fe27b856f230847e856431ae1724adc"
- version = "v1.0.0"
-
-[[projects]]
- branch = "master"
- digest = "1:fdfcd99fd77a0d3e3228d4d0b5061d9a611d40cd369ea44e333401b06936fdc4"
- name = "github.com/araddon/dateparse"
- packages = ["."]
- pruneopts = "UT"
- revision = "0fb0a474d195a3449cf412ae0176faa193f0ef0b"
-
-[[projects]]
- branch = "master"
- digest = "1:1bd56b71a75f4df8aae1d65feb3aee6742ed1a2ff00fa9aaf74b40d9fadc4440"
- name = "github.com/awesome-gocui/gocui"
- packages = ["."]
- pruneopts = "UT"
- revision = "a34ffb055986a3f9461735162c9a2d235b95b8cb"
-
-[[projects]]
- branch = "master"
- digest = "1:237f3e0692e330851b8b5a53117cfcea1beba09aec7668d34db91b809879c296"
- name = "github.com/awesome-gocui/termbox-go"
- packages = ["."]
- pruneopts = "UT"
- revision = "c0aef3d18bcc218a92e318293310ca0191f29654"
-
-[[projects]]
- digest = "1:b6d886569181ec96ca83d529f4d6ba0cbf92ace7bb6f633f90c5f34d9bba7aab"
- name = "github.com/blang/semver"
- packages = ["."]
- pruneopts = "UT"
- revision = "ba2c2ddd89069b46a7011d4106f6868f17ee1705"
- version = "v3.6.1"
-
-[[projects]]
- branch = "master"
- digest = "1:f438d91be142877c3ad83157992c91de787ddfbddcc2a7da1ef6ef61606cadc4"
- name = "github.com/cheekybits/genny"
- packages = ["generic"]
- pruneopts = "UT"
- revision = "9127e812e1e9e501ce899a18121d316ecb52e4ba"
-
-[[projects]]
- branch = "master"
- digest = "1:cc439e1d9d8cff3d575642f5401033b00f2b8d0cd9f859db45604701c990879a"
- name = "github.com/corpix/uarand"
- packages = ["."]
- pruneopts = "UT"
- revision = "2b8494104d86337cdd41d0a49cbed8e4583c0ab4"
-
-[[projects]]
- digest = "1:7cb4fdca4c251b3ef8027c90ea35f70c7b661a593b9eeae34753c65499098bb1"
- name = "github.com/cpuguy83/go-md2man"
- packages = ["md2man"]
- pruneopts = "UT"
- revision = "20f5889cbdc3c73dbd2862796665e7c465ade7d1"
- version = "v1.0.8"
-
-[[projects]]
- digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
- name = "github.com/davecgh/go-spew"
- packages = ["spew"]
- pruneopts = "UT"
- revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
- version = "v1.1.1"
-
-[[projects]]
- branch = "master"
- digest = "1:6f9339c912bbdda81302633ad7e99a28dfa5a639c864061f1929510a9a64aa74"
- name = "github.com/dustin/go-humanize"
- packages = ["."]
- pruneopts = "UT"
- revision = "9f541cc9db5d55bce703bd99987c9d5cb8eea45e"
-
-[[projects]]
- digest = "1:865079840386857c809b72ce300be7580cb50d3d3129ce11bf9aa6ca2bc1934a"
- name = "github.com/fatih/color"
- packages = ["."]
- pruneopts = "UT"
- revision = "5b77d2a35fb0ede96d138fc9a99f5c9b6aef11b4"
- version = "v1.7.0"
-
-[[projects]]
- digest = "1:aacef5f5e45685f2aeda5534d0a750dee6859de7e9088cdd06192787bb01ae6d"
- name = "github.com/go-errors/errors"
- packages = ["."]
- pruneopts = "UT"
- revision = "a6af135bd4e28680facf08a3d206b454abc877a4"
- version = "v1.0.1"
-
-[[projects]]
- digest = "1:97df918963298c287643883209a2c3f642e6593379f97ab400c2a2e219ab647d"
- name = "github.com/golang/protobuf"
- packages = ["proto"]
- pruneopts = "UT"
- revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
- version = "v1.2.0"
-
-[[projects]]
- digest = "1:a63cff6b5d8b95638bfe300385d93b2a6d9d687734b863da8e09dc834510a690"
- name = "github.com/google/go-querystring"
- packages = ["query"]
- pruneopts = "UT"
- revision = "44c6ddd0a2342c386950e880b658017258da92fc"
- version = "v1.0.0"
-
-[[projects]]
- digest = "1:cbec35fe4d5a4fba369a656a8cd65e244ea2c743007d8f6c1ccb132acf9d1296"
- name = "github.com/gorilla/mux"
- packages = ["."]
- pruneopts = "UT"
- revision = "00bdffe0f3c77e27d2cf6f5c70232a2d3e4d9c15"
- version = "v1.7.3"
-
-[[projects]]
- digest = "1:43dd08a10854b2056e615d1b1d22ac94559d822e1f8b6fcc92c1a1057e85188e"
- name = "github.com/gorilla/websocket"
- packages = ["."]
- pruneopts = "UT"
- revision = "ea4d1f681babbce9545c9c5f3d5194a789c89f5b"
- version = "v1.2.0"
-
-[[projects]]
- digest = "1:8ec8d88c248041a6df5f6574b87bc00e7e0b493881dad2e7ef47b11dc69093b5"
- name = "github.com/hashicorp/golang-lru"
- packages = [
- ".",
- "simplelru",
- ]
- pruneopts = "UT"
- revision = "20f1fb78b0740ba8c3cb143a61e86ba5c8669768"
- version = "v0.5.0"
-
-[[projects]]
- branch = "master"
- digest = "1:22725c01ecd8ed0c0f0078944305a57053340d92878b02db925c660cc4accf64"
- name = "github.com/icrowley/fake"
- packages = ["."]
- pruneopts = "UT"
- revision = "4178557ae428460c3780a381c824a1f3aceb6325"
-
-[[projects]]
- digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be"
- name = "github.com/inconshreveable/mousetrap"
- packages = ["."]
- pruneopts = "UT"
- revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
- version = "v1.0"
-
-[[projects]]
- digest = "1:c658e84ad3916da105a761660dcaeb01e63416c8ec7bc62256a9b411a05fcd67"
- name = "github.com/mattn/go-colorable"
- packages = ["."]
- pruneopts = "UT"
- revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"
- version = "v0.0.9"
-
-[[projects]]
- digest = "1:d4d17353dbd05cb52a2a52b7fe1771883b682806f68db442b436294926bbfafb"
- name = "github.com/mattn/go-isatty"
- packages = ["."]
- pruneopts = "UT"
- revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
- version = "v0.0.3"
-
-[[projects]]
- digest = "1:e2d1d410fb367567c2b53ed9e2d719d3c1f0891397bb2fa49afd747cfbf1e8e4"
- name = "github.com/mattn/go-runewidth"
- packages = ["."]
- pruneopts = "UT"
- revision = "9e777a8366cce605130a531d2cd6363d07ad7317"
- version = "v0.0.2"
-
-[[projects]]
- branch = "master"
- digest = "1:645110e089152bd0f4a011a2648fbb0e4df5977be73ca605781157ac297f50c4"
- name = "github.com/mitchellh/mapstructure"
- packages = ["."]
- pruneopts = "UT"
- revision = "fa473d140ef3c6adf42d6b391fe76707f1f243c8"
-
-[[projects]]
- digest = "1:7413525ee648f20b4181be7fe8103d0cb98be9e141926a03ee082dc207061e4e"
- name = "github.com/phayes/freeport"
- packages = ["."]
- pruneopts = "UT"
- revision = "b8543db493a5ed890c5499e935e2cad7504f3a04"
- version = "1.0.2"
-
-[[projects]]
- digest = "1:40e195917a951a8bf867cd05de2a46aaf1806c50cf92eebf4c16f78cd196f747"
- name = "github.com/pkg/errors"
- packages = ["."]
- pruneopts = "UT"
- revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
- version = "v0.8.0"
-
-[[projects]]
- digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
- name = "github.com/pmezard/go-difflib"
- packages = ["difflib"]
- pruneopts = "UT"
- revision = "792786c7400a136282c1664665ae0a8db921c6c2"
- version = "v1.0.0"
-
-[[projects]]
- digest = "1:8bc629776d035c003c7814d4369521afe67fdb8efc4b5f66540d29343b98cf23"
- name = "github.com/russross/blackfriday"
- packages = ["."]
- pruneopts = "UT"
- revision = "55d61fa8aa702f59229e6cff85793c22e580eaf5"
- version = "v1.5.1"
-
-[[projects]]
- branch = "master"
- digest = "1:2befa342040f385b214cfd400887b584d5eba4e4b25a0ebaea839ddb0d59c586"
- name = "github.com/shurcooL/githubv4"
- packages = ["."]
- pruneopts = "UT"
- revision = "068505affed7d8555196a48eb3e0ed43410aa8e8"
-
-[[projects]]
- branch = "master"
- digest = "1:ddaa79b37808fbd09a1c3f484bba6320c884664dfc25ccc5f2d7d5a82222177c"
- name = "github.com/shurcooL/go"
- packages = ["ctxhttp"]
- pruneopts = "UT"
- revision = "9e1955d9fb6e1ee2345ba1f5e71669263e719e27"
-
-[[projects]]
- branch = "master"
- digest = "1:b69bc7c0c0489f6f3467b737e243620b1a545dbeaf7623a9432b658f7b7ecc58"
- name = "github.com/shurcooL/graphql"
- packages = [
- ".",
- "ident",
- "internal/jsonutil",
- ]
- pruneopts = "UT"
- revision = "365899397c9ad12805631fe4c9b2a64be9d74818"
-
-[[projects]]
- branch = "master"
- digest = "1:9d29b003dc5f98647a5dd6754d65c07171fcd35761102ea56ecd3d6993adee7f"
- name = "github.com/shurcooL/httpfs"
- packages = [
- "filter",
- "vfsutil",
- ]
- pruneopts = "UT"
- revision = "809beceb23714880abc4a382a00c05f89d13b1cc"
-
-[[projects]]
- branch = "master"
- digest = "1:98450c86949b8cdc4637b80c1c686ca955e503d3fbae9296d1f49c532895d281"
- name = "github.com/shurcooL/vfsgen"
- packages = ["."]
- pruneopts = "UT"
- revision = "6a9ea43bcacdf716a5c1b38efff722c07adf0069"
-
-[[projects]]
- branch = "master"
- digest = "1:519621a373ae7d96a16415a6356d7b97722ed3a292f73409b361b7c0322971e3"
- name = "github.com/skratchdot/open-golang"
- packages = ["open"]
- pruneopts = "UT"
- revision = "79abb63cd66e41cb1473e26d11ebdcd68b04c8e5"
-
-[[projects]]
- digest = "1:abe9f3f23399646a6263682cacc9e86969f6c7e768f0ef036449926aa24cbbef"
- name = "github.com/spf13/cobra"
- packages = [
- ".",
- "doc",
- ]
- pruneopts = "UT"
- revision = "f2b07da1e2c38d5f12845a4f607e2e1018cbb1f5"
- version = "v0.0.5"
-
-[[projects]]
- digest = "1:9424f440bba8f7508b69414634aef3b2b3a877e522d8a4624692412805407bb7"
- name = "github.com/spf13/pflag"
- packages = ["."]
- pruneopts = "UT"
- revision = "583c0c0531f06d5278b7d917446061adc344b5cd"
- version = "v1.0.1"
-
-[[projects]]
- digest = "1:c40d65817cdd41fac9aa7af8bed56927bb2d6d47e4fea566a74880f5c2b1c41e"
- name = "github.com/stretchr/testify"
- packages = [
- "assert",
- "require",
- ]
- pruneopts = "UT"
- revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
- version = "v1.2.2"
-
-[[projects]]
- digest = "1:8d784da270f610f505e2c9785faec4c81d4a6a6a1034412685a4bf2cffe24cef"
- name = "github.com/theckman/goconstraint"
- packages = ["go1.10/gte"]
- pruneopts = "UT"
- revision = "93babf24513d0e8277635da8169fcc5a46ae3f6a"
- version = "v1.11.0"
-
-[[projects]]
- digest = "1:895fa0f564003de2498fbaf00be596fa814655ab445ce7cc215f7724bb6831ae"
- name = "github.com/vektah/gqlgen"
- packages = ["client"]
- pruneopts = "UT"
- revision = "636435b68700211441303f1a5ed92f3768ba5774"
- version = "v0.5.1"
-
-[[projects]]
- digest = "1:ed6a41de3eedd8d4868eea057837860453ebbe08c5e385fd50d4c24e5642ec18"
- name = "github.com/vektah/gqlparser"
- packages = [
- ".",
- "ast",
- "gqlerror",
- "lexer",
- "parser",
- "validator",
- "validator/rules",
- ]
- pruneopts = "UT"
- revision = "e805d08bb209b1accdea76bd2327811858d81985"
- version = "v1.0.0"
-
-[[projects]]
- digest = "1:3254b94c092d3b29b828cc4c457723ac875f4318bf801745b71ef437459a90e9"
- name = "github.com/xanzy/go-gitlab"
- packages = ["."]
- pruneopts = "UT"
- revision = "d8e9de1d4b4477fe420696e10cd97491d518d90f"
- version = "v0.22.1"
-
-[[projects]]
- branch = "master"
- digest = "1:3f3a05ae0b95893d90b9b3b5afdb79a9b3d96e4e36e099d841ae602e4aca0da8"
- name = "golang.org/x/crypto"
- packages = ["ssh/terminal"]
- pruneopts = "UT"
- revision = "0e37d006457bf46f9e6692014ba72ef82c33022c"
-
-[[projects]]
- branch = "master"
- digest = "1:d6b719875cf8091fbab38527d81d34e71f4521b9ee9ccfbd4a32cff2ac5af96e"
- name = "golang.org/x/net"
- packages = [
- "context",
- "context/ctxhttp",
- ]
- pruneopts = "UT"
- revision = "2f5d2388922f370f4355f327fcf4cfe9f5583908"
-
-[[projects]]
- branch = "master"
- digest = "1:363b547c971a2b07474c598b6e9ebcb238d556d8a27f37b3895ad20cd50e7281"
- name = "golang.org/x/oauth2"
- packages = [
- ".",
- "internal",
- ]
- pruneopts = "UT"
- revision = "d2e6202438beef2727060aa7cabdd924d92ebfd9"
-
-[[projects]]
- branch = "master"
- digest = "1:b521f10a2d8fa85c04a8ef4e62f2d1e14d303599a55d64dabf9f5a02f84d35eb"
- name = "golang.org/x/sync"
- packages = ["errgroup"]
- pruneopts = "UT"
- revision = "cd5d95a43a6e21273425c7ae415d3df9ea832eeb"
-
-[[projects]]
- branch = "master"
- digest = "1:3364d01296ce7eeca363e3d530ae63a2092d6f8efb85fb3d101e8f6d7de83452"
- name = "golang.org/x/sys"
- packages = [
- "unix",
- "windows",
- ]
- pruneopts = "UT"
- revision = "ac767d655b305d4e9612f5f6e33120b9176c4ad4"
-
-[[projects]]
- digest = "1:86cb348528a842f96e651ca3f8197070e9ebc315f8c73e71d0df7a60e92a6db1"
- name = "golang.org/x/text"
- packages = [
- "runes",
- "transform",
- ]
- pruneopts = "UT"
- revision = "342b2e1fbaa52c93f31447ad2c6abc048c63e475"
- version = "v0.3.2"
-
-[[projects]]
- digest = "1:71850ac10bbeb4d8dd06ce0743fe57654daf28510b0f6cbd9692aaf0d269360e"
- name = "golang.org/x/tools"
- packages = [
- "go/ast/astutil",
- "go/gcexportdata",
- "go/internal/gcimporter",
- "go/internal/packagesdriver",
- "go/packages",
- "go/types/typeutil",
- "imports",
- "internal/fastwalk",
- "internal/gopathwalk",
- "internal/module",
- "internal/semver",
- ]
- pruneopts = "UT"
- revision = "7e5bf9270d7061560865b8847c378236480f47e3"
-
-[[projects]]
- digest = "1:6247f76e55a1e1a5c19a81e2d4b4dff6730461eeb5bbb0a16dd4a8ec8637ee93"
- name = "google.golang.org/appengine"
- packages = [
- "internal",
- "internal/base",
- "internal/datastore",
- "internal/log",
- "internal/remote_api",
- "internal/urlfetch",
- "urlfetch",
- ]
- pruneopts = "UT"
- revision = "ae0ab99deb4dc413a2b4bd6c8bdd0eb67f1e4d06"
- version = "v1.2.0"
-
-[[projects]]
- digest = "1:342378ac4dcb378a5448dd723f0784ae519383532f5e70ade24132c4c8693202"
- name = "gopkg.in/yaml.v2"
- packages = ["."]
- pruneopts = "UT"
- revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183"
- version = "v2.2.1"
-
-[solve-meta]
- analyzer-name = "dep"
- analyzer-version = 1
- input-imports = [
- "github.com/99designs/gqlgen/api",
- "github.com/99designs/gqlgen/codegen/config",
- "github.com/99designs/gqlgen/graphql",
- "github.com/99designs/gqlgen/graphql/introspection",
- "github.com/99designs/gqlgen/handler",
- "github.com/MichaelMure/go-term-text",
- "github.com/araddon/dateparse",
- "github.com/awesome-gocui/gocui",
- "github.com/blang/semver",
- "github.com/cheekybits/genny/generic",
- "github.com/dustin/go-humanize",
- "github.com/fatih/color",
- "github.com/go-errors/errors",
- "github.com/gorilla/mux",
- "github.com/icrowley/fake",
- "github.com/mattn/go-isatty",
- "github.com/phayes/freeport",
- "github.com/pkg/errors",
- "github.com/shurcooL/githubv4",
- "github.com/shurcooL/httpfs/filter",
- "github.com/shurcooL/vfsgen",
- "github.com/skratchdot/open-golang/open",
- "github.com/spf13/cobra",
- "github.com/spf13/cobra/doc",
- "github.com/stretchr/testify/assert",
- "github.com/stretchr/testify/require",
- "github.com/theckman/goconstraint/go1.10/gte",
- "github.com/vektah/gqlgen/client",
- "github.com/vektah/gqlparser",
- "github.com/vektah/gqlparser/ast",
- "github.com/xanzy/go-gitlab",
- "golang.org/x/crypto/ssh/terminal",
- "golang.org/x/oauth2",
- "golang.org/x/sync/errgroup",
- "golang.org/x/text/runes",
- "golang.org/x/text/transform",
- ]
- solver-name = "gps-cdcl"
- solver-version = 1
diff --git a/Gopkg.toml b/Gopkg.toml
deleted file mode 100644
index c7496bb0dead87aef390cea2926c05b55578fd0a..0000000000000000000000000000000000000000
--- a/Gopkg.toml
+++ /dev/null
@@ -1,89 +0,0 @@
-# Gopkg.toml example
-#
-# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
-# for detailed Gopkg.toml documentation.
-#
-# required = ["github.com/user/thing/cmd/thing"]
-# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
-#
-# [[constraint]]
-# name = "github.com/user/project"
-# version = "1.0.0"
-#
-# [[constraint]]
-# name = "github.com/user/project2"
-# branch = "dev"
-# source = "github.com/myfork/project2"
-#
-# [[override]]
-# name = "github.com/x/y"
-# version = "2.4.0"
-#
-# [prune]
-# non-go = false
-# go-tests = true
-# unused-packages = true
-
-[prune]
- go-tests = true
- unused-packages = true
-
-[[constraint]]
- name = "github.com/gorilla/mux"
- version = "1.7.3"
-
-[[constraint]]
- name = "github.com/phayes/freeport"
- version = "1.0.2"
-
-[[constraint]]
- name = "github.com/shurcooL/vfsgen"
- branch = "master"
-
-[[constraint]]
- name = "github.com/skratchdot/open-golang"
- branch = "master"
-
-[[constraint]]
- name = "github.com/fatih/color"
- version = "1.7.0"
-
-[[constraint]]
- name = "github.com/spf13/cobra"
- version = "v0.0.5"
-
-[[constraint]]
- name = "github.com/dustin/go-humanize"
- branch = "master"
-
-[[constraint]]
- name = "github.com/99designs/gqlgen"
- version = "0.9.2"
-
-[[constraint]]
- name = "github.com/awesome-gocui/gocui"
- branch = "master"
-
-[[override]]
- name = "golang.org/x/tools"
- revision = "7e5bf9270d7061560865b8847c378236480f47e3"
-
-[[constraint]]
- name = "github.com/blang/semver"
- version = "3.6.1"
-
-[[constraint]]
- name = "github.com/xanzy/go-gitlab"
- version = "0.22.1"
-
-[[constraint]]
- branch = "master"
- name = "golang.org/x/sync"
-
-[[constraint]]
- name = "github.com/MichaelMure/go-term-text"
- version = "0.2.4"
-
-[[constraint]]
- branch = "master"
- name = "github.com/araddon/dateparse"
\ No newline at end of file
diff --git a/commands/webui.go b/commands/webui.go
index 2e1a1bc05a6a7eb3d020256c25b0eaeb6fad18ec..5d3d4b4acb53986016093e4f1f19dd6f60e27eba 100644
--- a/commands/webui.go
+++ b/commands/webui.go
@@ -12,7 +12,7 @@ import (
"os/signal"
"time"
- "github.com/99designs/gqlgen/handler"
+ "github.com/99designs/gqlgen/graphql/playground"
"github.com/gorilla/mux"
"github.com/phayes/freeport"
"github.com/skratchdot/open-golang/open"
@@ -57,7 +57,7 @@ func runWebUI(cmd *cobra.Command, args []string) error {
}
// Routes
- router.Path("/playground").Handler(handler.Playground("git-bug", "/graphql"))
+ router.Path("/playground").Handler(playground.Handler("git-bug", "/graphql"))
router.Path("/graphql").Handler(graphqlHandler)
router.Path("/gitfile/{hash}").Handler(newGitFileHandler(repo))
router.Path("/upload").Methods("POST").Handler(newGitUploadFileHandler(repo))
diff --git a/git-bug.go b/git-bug.go
index 50415ae2082980d94befa2243738a29517960826..70355a862a2c9bf25358eef70552d606338572f6 100644
--- a/git-bug.go
+++ b/git-bug.go
@@ -9,8 +9,8 @@ package main
import (
"github.com/MichaelMure/git-bug/commands"
- // minimal go version is 1.10
- _ "github.com/theckman/goconstraint/go1.10/gte"
+ // minimal go version is 1.11
+ _ "github.com/theckman/goconstraint/go1.11/gte"
)
func main() {
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000000000000000000000000000000000000..140b7bf4610116c407508b5602e0d09b95208347
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,35 @@
+module github.com/MichaelMure/git-bug
+
+go 1.11
+
+require (
+ github.com/99designs/gqlgen v0.10.3-0.20200205113530-b941b970f0b6
+ github.com/MichaelMure/go-term-text v0.2.4
+ github.com/araddon/dateparse v0.0.0-20190622164848-0fb0a474d195
+ github.com/awesome-gocui/gocui v0.6.1-0.20191115151952-a34ffb055986
+ github.com/blang/semver v3.5.1+incompatible
+ github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9
+ github.com/corpix/uarand v0.1.1 // indirect
+ github.com/dustin/go-humanize v1.0.0
+ github.com/fatih/color v1.7.0
+ github.com/go-errors/errors v1.0.1
+ github.com/gorilla/mux v1.7.3
+ github.com/hashicorp/golang-lru v0.5.4 // indirect
+ github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428
+ github.com/mattn/go-colorable v0.1.4 // indirect
+ github.com/mattn/go-isatty v0.0.8
+ github.com/phayes/freeport v0.0.0-20171002181615-b8543db493a5
+ github.com/pkg/errors v0.8.1
+ github.com/shurcooL/githubv4 v0.0.0-20190601194912-068505affed7
+ github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f // indirect
+ github.com/skratchdot/open-golang v0.0.0-20190402232053-79abb63cd66e
+ github.com/spf13/cobra v0.0.5
+ github.com/stretchr/testify v1.4.0
+ github.com/theckman/goconstraint v1.11.0
+ github.com/vektah/gqlparser v1.2.1
+ github.com/xanzy/go-gitlab v0.22.1
+ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
+ golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288
+ golang.org/x/sync v0.0.0-20190423024810-112230192c58
+ golang.org/x/text v0.3.0
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000000000000000000000000000000000000..9b0ea99d29f4b527425e7dfb821066d64a8efe57
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,168 @@
+github.com/99designs/gqlgen v0.10.3-0.20200205113530-b941b970f0b6 h1:WU+9Z7AoCyl+HlB2kE0O+4/3BaVqLQfnX5dHigV5p8A=
+github.com/99designs/gqlgen v0.10.3-0.20200205113530-b941b970f0b6/go.mod h1:28v/ATDVwPUriwNtAIrQEhRHXJjdi5dVGqxSqPna1I8=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/Masterminds/glide v0.13.2/go.mod h1:STyF5vcenH/rUqTEv+/hBXlSTo7KYwg2oc2f4tzPWic=
+github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
+github.com/Masterminds/vcs v1.13.0/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHSmwVJjcKA=
+github.com/MichaelMure/go-term-text v0.2.4 h1:h+lAsjG5o3oNvaJeh7OzE8zdSiB/VyJo9JzSnncrZv4=
+github.com/MichaelMure/go-term-text v0.2.4/go.mod h1:o2Z5T3b28F4kwAojGvvNdbzjHf9t18vbQ7E2pmTe2Ww=
+github.com/agnivade/levenshtein v1.0.1 h1:3oJU7J3FGFmyhn8KHjmVaZCN5hxTr7GxgRue+sxIXdQ=
+github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
+github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
+github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
+github.com/araddon/dateparse v0.0.0-20190622164848-0fb0a474d195 h1:c4mLfegoDw6OhSJXTd2jUEQgZUQuJWtocudb97Qn9EM=
+github.com/araddon/dateparse v0.0.0-20190622164848-0fb0a474d195/go.mod h1:SLqhdZcd+dF3TEVL2RMoob5bBP5R1P1qkox+HtCBgGI=
+github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
+github.com/awesome-gocui/gocui v0.6.1-0.20191115151952-a34ffb055986 h1:QvIfX96O11qjX1Zr3hKkG0dI12JBRBGABWffyZ1GI60=
+github.com/awesome-gocui/gocui v0.6.1-0.20191115151952-a34ffb055986/go.mod h1:1QikxFaPhe2frKeKvEwZEIGia3haiOxOUXKinrv17mA=
+github.com/awesome-gocui/termbox-go v0.0.0-20190427202837-c0aef3d18bcc h1:wGNpKcHU8Aadr9yOzsT3GEsFLS7HQu8HxQIomnekqf0=
+github.com/awesome-gocui/termbox-go v0.0.0-20190427202837-c0aef3d18bcc/go.mod h1:tOy3o5Nf1bA17mnK4W41gD7PS3u4Cv0P0pqFcoWMy8s=
+github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
+github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
+github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9 h1:a1zrFsLFac2xoM6zG1u72DWJwZG3ayttYLfmLbxVETk=
+github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
+github.com/codegangsta/cli v1.20.0/go.mod h1:/qJNoX69yVSKu5o4jLyXAENLRyk1uhi7zkbQ3slBdOA=
+github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
+github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
+github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
+github.com/corpix/uarand v0.1.1 h1:RMr1TWc9F4n5jiPDzFHtmaUXLKLNUFK0SgCLo4BhX/U=
+github.com/corpix/uarand v0.1.1/go.mod h1:SFKZvkcRoLqVRFZ4u25xPmp6m9ktANfbpXZ7SJ0/FNU=
+github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
+github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
+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/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
+github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
+github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
+github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
+github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/go-chi/chi v3.3.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
+github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
+github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
+github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
+github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
+github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
+github.com/gorilla/mux v1.6.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
+github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
+github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
+github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ=
+github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
+github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
+github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
+github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
+github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
+github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428 h1:Mo9W14pwbO9VfRe+ygqZ8dFbPpoIK1HFrG/zjTuQ+nc=
+github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428/go.mod h1:uhpZMVGznybq1itEKXj6RYw9I71qK4kH+OGMjRC4KEo=
+github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
+github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
+github.com/matryer/moq v0.0.0-20200106131100-75d0ddfc0007/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ=
+github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
+github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
+github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
+github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
+github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
+github.com/mattn/go-runewidth v0.0.6 h1:V2iyH+aX9C5fsYCpK60U8BYIvmhqxuOL3JZcqc1NB7k=
+github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
+github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
+github.com/mitchellh/mapstructure v0.0.0-20180203102830-a4e142e9c047/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
+github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/ngdinhtoan/glide-cleanup v0.2.0/go.mod h1:UQzsmiDOb8YV3nOsCxK/c9zPpCZVNoHScRE3EO9pVMM=
+github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
+github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
+github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
+github.com/phayes/freeport v0.0.0-20171002181615-b8543db493a5 h1:rZQtoozkfsiNs36c7Tdv/gyGNzD1X1XWKO8rptVNZuM=
+github.com/phayes/freeport v0.0.0-20171002181615-b8543db493a5/go.mod h1:iIss55rKnNBTvrwdmkUpLnDpZoAHvWaiq5+iMmen4AE=
+github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
+github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
+github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
+github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
+github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
+github.com/shurcooL/githubv4 v0.0.0-20190601194912-068505affed7 h1:Vk3RiBQpF0Ja+OqbFG7lYTk79+l8Cm2QESLXB0x6u6U=
+github.com/shurcooL/githubv4 v0.0.0-20190601194912-068505affed7/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo=
+github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f h1:tygelZueB1EtXkPI6mQ4o9DQ0+FKW41hTbunoXZCTqk=
+github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f/go.mod h1:AuYgA5Kyo4c7HfUmvRGs/6rGlMMV/6B1bVnB9JxJEEg=
+github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
+github.com/shurcooL/vfsgen v0.0.0-20180121065927-ffb13db8def0/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
+github.com/skratchdot/open-golang v0.0.0-20190402232053-79abb63cd66e h1:VAzdS5Nw68fbf5RZ8RDVlUvPXNU6Z3jtPCK/qvm4FoQ=
+github.com/skratchdot/open-golang v0.0.0-20190402232053-79abb63cd66e/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
+github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
+github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
+github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
+github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
+github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
+github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
+github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/theckman/goconstraint v1.11.0 h1:oBUwN5wpE4dwyPhRGraEgJsFTr+JtLWiDnaJZJeeXI0=
+github.com/theckman/goconstraint v1.11.0/go.mod h1:zkCR/f2kOULTk/h1ujgyB9BlCNLaqlQ6GN2Zl4mg81g=
+github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
+github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
+github.com/vektah/dataloaden v0.2.1-0.20190515034641-a19b9a6e7c9e/go.mod h1:/HUdMve7rvxZma+2ZELQeNh88+003LL7Pf/CZ089j8U=
+github.com/vektah/gqlparser v1.2.1 h1:C+L7Go/eUbN0w6Y0kaiq2W6p2wN5j8wU82EdDXxDivc=
+github.com/vektah/gqlparser v1.2.1/go.mod h1:bkVf0FX+Stjg/MHnm8mEyubuaArhNEqfQhF+OTiAL74=
+github.com/xanzy/go-gitlab v0.22.1 h1:TVxgHmoa35jQL+9FCkG0nwPDxU9dQZXknBTDtGaSFno=
+github.com/xanzy/go-gitlab v0.22.1/go.mod h1:t4Bmvnxj7k37S4Y17lfLx+nLqkf/oQwT2HagfWKv5Og=
+github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
+golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288 h1:JIqe8uIcRBHXDQVvZtHwp80ai3Lw3IJAeJEs55Dc1W0=
+golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190515012406-7d7faa4812bd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589 h1:rjUrONFu4kLchcZTfp3/96bR8bW8dIa8uz3cR5n0cgM=
+golang.org/x/tools v0.0.0-20200114235610-7ae403b6b589/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/appengine v1.3.0 h1:FBSsiFRMz3LBeXIomRnVzrQwSDj4ibvcRexLG0LZGQk=
+google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+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 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+sourcegraph.com/sourcegraph/appdash v0.0.0-20180110180208-2cc67fd64755/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
+sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67/go.mod h1:L5q+DGLGOQFpo1snNEkLOJT2d1YTW66rWNzatr3He1k=
diff --git a/graphql/graph/gen_graph.go b/graphql/graph/gen_graph.go
index a1f7133dc10f80b3f44c222ba6a6c770cbad1993..215603cbd0e1891f7c8f36805a744bc71219e4f1 100644
--- a/graphql/graph/gen_graph.go
+++ b/graphql/graph/gen_graph.go
@@ -204,7 +204,7 @@ type ComplexityRoot struct {
}
Identity struct {
- AvatarURL func(childComplexity int) int
+ AvatarUrl func(childComplexity int) int
DisplayName func(childComplexity int) int
Email func(childComplexity int) int
HumanID func(childComplexity int) int
@@ -418,14 +418,8 @@ type EditCommentOperationResolver interface {
Target(ctx context.Context, obj *bug.EditCommentOperation) (string, error)
}
type IdentityResolver interface {
- ID(ctx context.Context, obj *identity.Interface) (string, error)
- HumanID(ctx context.Context, obj *identity.Interface) (string, error)
- Name(ctx context.Context, obj *identity.Interface) (*string, error)
- Email(ctx context.Context, obj *identity.Interface) (*string, error)
- Login(ctx context.Context, obj *identity.Interface) (*string, error)
- DisplayName(ctx context.Context, obj *identity.Interface) (string, error)
- AvatarURL(ctx context.Context, obj *identity.Interface) (*string, error)
- IsProtected(ctx context.Context, obj *identity.Interface) (bool, error)
+ ID(ctx context.Context, obj identity.Interface) (string, error)
+ HumanID(ctx context.Context, obj identity.Interface) (string, error)
}
type LabelResolver interface {
Name(ctx context.Context, obj *bug.Label) (string, error)
@@ -1104,11 +1098,11 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.EditCommentOperation.Target(childComplexity), true
case "Identity.avatarUrl":
- if e.complexity.Identity.AvatarURL == nil {
+ if e.complexity.Identity.AvatarUrl == nil {
break
}
- return e.complexity.Identity.AvatarURL(childComplexity), true
+ return e.complexity.Identity.AvatarUrl(childComplexity), true
case "Identity.displayName":
if e.complexity.Identity.DisplayName == nil {
@@ -1828,46 +1822,48 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return 0, false
}
-func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {
- ec := executionContext{graphql.GetRequestContext(ctx), e}
+func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
+ rc := graphql.GetOperationContext(ctx)
+ ec := executionContext{rc, e}
+ first := true
- buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {
- data := ec._Query(ctx, op.SelectionSet)
- var buf bytes.Buffer
- data.MarshalGQL(&buf)
- return buf.Bytes()
- })
-
- return &graphql.Response{
- Data: buf,
- Errors: ec.Errors,
- Extensions: ec.Extensions,
- }
-}
+ switch rc.Operation.Operation {
+ case ast.Query:
+ return func(ctx context.Context) *graphql.Response {
+ if !first {
+ return nil
+ }
+ first = false
+ data := ec._Query(ctx, rc.Operation.SelectionSet)
+ var buf bytes.Buffer
+ data.MarshalGQL(&buf)
-func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {
- ec := executionContext{graphql.GetRequestContext(ctx), e}
+ return &graphql.Response{
+ Data: buf.Bytes(),
+ }
+ }
+ case ast.Mutation:
+ return func(ctx context.Context) *graphql.Response {
+ if !first {
+ return nil
+ }
+ first = false
+ data := ec._Mutation(ctx, rc.Operation.SelectionSet)
+ var buf bytes.Buffer
+ data.MarshalGQL(&buf)
- buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {
- data := ec._Mutation(ctx, op.SelectionSet)
- var buf bytes.Buffer
- data.MarshalGQL(&buf)
- return buf.Bytes()
- })
+ return &graphql.Response{
+ Data: buf.Bytes(),
+ }
+ }
- return &graphql.Response{
- Data: buf,
- Errors: ec.Errors,
- Extensions: ec.Extensions,
+ default:
+ return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation"))
}
}
-func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response {
- return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported"))
-}
-
type executionContext struct {
- *graphql.RequestContext
+ *graphql.OperationContext
*executableSchema
}
@@ -1886,637 +1882,877 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er
}
var parsedSchema = gqlparser.MustLoadSchema(
- &ast.Source{Name: "schema/bug.graphql", Input: `"""Represents a comment on a bug."""
-type Comment implements Authored {
- """The author of this comment."""
- author: Identity!
-
- """The message of this comment."""
- message: String!
-
- """All media's hash referenced in this comment"""
- files: [Hash!]!
-}
-
-type CommentConnection {
- edges: [CommentEdge!]!
- nodes: [Comment!]!
- pageInfo: PageInfo!
- totalCount: Int!
+ &ast.Source{Name: "schema.graphql", Input: `input AddCommentInput {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
+ """
+ The first message of the new bug.
+ """
+ message: String!
+ """
+ The collection of file's hash required for the first message.
+ """
+ files: [Hash!]
}
-
-type CommentEdge {
- cursor: String!
- node: Comment!
+type AddCommentOperation implements Operation & Authored {
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The author of this object.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+ message: String!
+ files: [Hash!]!
}
-
-enum Status {
- OPEN
- CLOSED
+type AddCommentPayload {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
+ """
+ The resulting operation.
+ """
+ operation: AddCommentOperation!
+}
+"""
+AddCommentTimelineItem is a TimelineItem that represent a Comment and its edition history
+"""
+type AddCommentTimelineItem implements TimelineItem & Authored {
+ """
+ The identifier of the source operation
+ """
+ id: String!
+ author: Identity!
+ message: String!
+ messageIsEmpty: Boolean!
+ files: [Hash!]!
+ createdAt: Time!
+ lastEdit: Time!
+ edited: Boolean!
+ history: [CommentHistoryStep!]!
+}
+"""
+An object that has an author.
+"""
+interface Authored {
+ """
+ The author of this object.
+ """
+ author: Identity!
}
-
type Bug implements Authored {
- """The identifier for this bug"""
- id: String!
- """The human version (truncated) identifier for this bug"""
- humanId: String!
- status: Status!
- title: String!
- labels: [Label!]!
- author: Identity!
- createdAt: Time!
- lastEdit: Time!
-
- """The actors of the bug. Actors are Identity that have interacted with the bug."""
- actors(
- """Returns the elements in the list that come after the specified cursor."""
- after: String
- """Returns the elements in the list that come before the specified cursor."""
- before: String
- """Returns the first _n_ elements from the list."""
- first: Int
- """Returns the last _n_ elements from the list."""
- last: Int
- ): IdentityConnection!
-
- """The participants of the bug. Participants are Identity that have created or
- added a comment on the bug."""
- participants(
- """Returns the elements in the list that come after the specified cursor."""
- after: String
- """Returns the elements in the list that come before the specified cursor."""
- before: String
- """Returns the first _n_ elements from the list."""
- first: Int
- """Returns the last _n_ elements from the list."""
- last: Int
- ): IdentityConnection!
-
- comments(
- """Returns the elements in the list that come after the specified cursor."""
- after: String
- """Returns the elements in the list that come before the specified cursor."""
- before: String
- """Returns the first _n_ elements from the list."""
- first: Int
- """Returns the last _n_ elements from the list."""
- last: Int
- ): CommentConnection!
-
- timeline(
- """Returns the elements in the list that come after the specified cursor."""
- after: String
- """Returns the elements in the list that come before the specified cursor."""
- before: String
- """Returns the first _n_ elements from the list."""
- first: Int
- """Returns the last _n_ elements from the list."""
- last: Int
- ): TimelineItemConnection!
-
- operations(
- """Returns the elements in the list that come after the specified cursor."""
- after: String
- """Returns the elements in the list that come before the specified cursor."""
- before: String
- """Returns the first _n_ elements from the list."""
- first: Int
- """Returns the last _n_ elements from the list."""
- last: Int
- ): OperationConnection!
-}
-
-"""The connection type for Bug."""
+ """
+ The identifier for this bug
+ """
+ id: String!
+ """
+ The human version (truncated) identifier for this bug
+ """
+ humanId: String!
+ status: Status!
+ title: String!
+ labels: [Label!]!
+ author: Identity!
+ createdAt: Time!
+ lastEdit: Time!
+ """
+ The actors of the bug. Actors are Identity that have interacted with the bug.
+ """
+ actors("""
+ Returns the elements in the list that come after the specified cursor.
+ """
+ after: String, """
+ Returns the elements in the list that come before the specified cursor.
+ """
+ before: String, """
+ Returns the first _n_ elements from the list.
+ """
+ first: Int, """
+ Returns the last _n_ elements from the list.
+ """
+ last: Int): IdentityConnection!
+ """
+ The participants of the bug. Participants are Identity that have created or
+ added a comment on the bug.
+ """
+ participants("""
+ Returns the elements in the list that come after the specified cursor.
+ """
+ after: String, """
+ Returns the elements in the list that come before the specified cursor.
+ """
+ before: String, """
+ Returns the first _n_ elements from the list.
+ """
+ first: Int, """
+ Returns the last _n_ elements from the list.
+ """
+ last: Int): IdentityConnection!
+ comments("""
+ Returns the elements in the list that come after the specified cursor.
+ """
+ after: String, """
+ Returns the elements in the list that come before the specified cursor.
+ """
+ before: String, """
+ Returns the first _n_ elements from the list.
+ """
+ first: Int, """
+ Returns the last _n_ elements from the list.
+ """
+ last: Int): CommentConnection!
+ timeline("""
+ Returns the elements in the list that come after the specified cursor.
+ """
+ after: String, """
+ Returns the elements in the list that come before the specified cursor.
+ """
+ before: String, """
+ Returns the first _n_ elements from the list.
+ """
+ first: Int, """
+ Returns the last _n_ elements from the list.
+ """
+ last: Int): TimelineItemConnection!
+ operations("""
+ Returns the elements in the list that come after the specified cursor.
+ """
+ after: String, """
+ Returns the elements in the list that come before the specified cursor.
+ """
+ before: String, """
+ Returns the first _n_ elements from the list.
+ """
+ first: Int, """
+ Returns the last _n_ elements from the list.
+ """
+ last: Int): OperationConnection!
+}
+"""
+The connection type for Bug.
+"""
type BugConnection {
- """A list of edges."""
- edges: [BugEdge!]!
- nodes: [Bug!]!
- """Information to aid in pagination."""
- pageInfo: PageInfo!
- """Identifies the total count of items in the connection."""
- totalCount: Int!
-}
-
-"""An edge in a connection."""
+ """
+ A list of edges.
+ """
+ edges: [BugEdge!]!
+ nodes: [Bug!]!
+ """
+ Information to aid in pagination.
+ """
+ pageInfo: PageInfo!
+ """
+ Identifies the total count of items in the connection.
+ """
+ totalCount: Int!
+}
+"""
+An edge in a connection.
+"""
type BugEdge {
- """A cursor for use in pagination."""
- cursor: String!
- """The item at the end of the edge."""
- node: Bug!
-}
-`},
- &ast.Source{Name: "schema/identity.graphql", Input: `"""Represents an identity"""
-type Identity {
- """The identifier for this identity"""
- id: String!
- """The human version (truncated) identifier for this identity"""
- humanId: String!
- """The name of the person, if known."""
- name: String
- """The email of the person, if known."""
- email: String
- """The login of the person, if known."""
- login: String
- """A string containing the either the name of the person, its login or both"""
- displayName: String!
- """An url to an avatar"""
- avatarUrl: String
- """isProtected is true if the chain of git commits started to be signed.
- If that's the case, only signed commit with a valid key for this identity can be added."""
- isProtected: Boolean!
-}
-
-type IdentityConnection {
- edges: [IdentityEdge!]!
- nodes: [Identity!]!
- pageInfo: PageInfo!
- totalCount: Int!
-}
-
-type IdentityEdge {
- cursor: String!
- node: Identity!
-}`},
- &ast.Source{Name: "schema/label.graphql", Input: `"""Label for a bug."""
-type Label {
- """The name of the label."""
- name: String!
- """Color of the label."""
- color: Color!
-}
-
-type LabelConnection {
- edges: [LabelEdge!]!
- nodes: [Label!]!
- pageInfo: PageInfo!
- totalCount: Int!
-}
-
-type LabelEdge {
- cursor: String!
- node: Label!
-}`},
- &ast.Source{Name: "schema/mutations.graphql", Input: `input NewBugInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The title of the new bug."""
- title: String!
- """The first message of the new bug."""
- message: String!
- """The collection of file's hash required for the first message."""
- files: [Hash!]
-}
-
-type NewBugPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The created bug."""
- bug: Bug!
- """The resulting operation."""
- operation: CreateOperation!
-}
-
-input AddCommentInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
- """The first message of the new bug."""
- message: String!
- """The collection of file's hash required for the first message."""
- files: [Hash!]
-}
-
-type AddCommentPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
- """The resulting operation."""
- operation: AddCommentOperation!
+ """
+ A cursor for use in pagination.
+ """
+ cursor: String!
+ """
+ The item at the end of the edge.
+ """
+ node: Bug!
}
-
input ChangeLabelInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
- """The list of label to add."""
- added: [String!]
- """The list of label to remove."""
- Removed: [String!]
-}
-
-enum LabelChangeStatus {
- ADDED
- REMOVED
- DUPLICATE_IN_OP
- ALREADY_EXIST
- DOESNT_EXIST
-}
-
-type LabelChangeResult {
- """The source label."""
- label: Label!
- """The effect this label had."""
- status: LabelChangeStatus!
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
+ """
+ The list of label to add.
+ """
+ added: [String!]
+ """
+ The list of label to remove.
+ """
+ Removed: [String!]
}
-
type ChangeLabelPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
- """The resulting operation."""
- operation: LabelChangeOperation!
- """The effect each source label had."""
- results: [LabelChangeResult]!
-}
-
-input OpenBugInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
+ """
+ The resulting operation.
+ """
+ operation: LabelChangeOperation!
+ """
+ The effect each source label had.
+ """
+ results: [LabelChangeResult]!
}
-
-type OpenBugPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
- """The resulting operation."""
- operation: SetStatusOperation!
-}
-
input CloseBugInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
}
-
type CloseBugPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
- """The resulting operation."""
- operation: SetStatusOperation!
-}
-
-input SetTitleInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
- """The new title."""
- title: String!
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
+ """
+ The resulting operation.
+ """
+ operation: SetStatusOperation!
+}
+"""
+Defines a color by red, green and blue components.
+"""
+type Color {
+ """
+ Red component of the color.
+ """
+ R: Int!
+ """
+ Green component of the color.
+ """
+ G: Int!
+ """
+ Blue component of the color.
+ """
+ B: Int!
+}
+"""
+Represents a comment on a bug.
+"""
+type Comment implements Authored {
+ """
+ The author of this comment.
+ """
+ author: Identity!
+ """
+ The message of this comment.
+ """
+ message: String!
+ """
+ All media's hash referenced in this comment
+ """
+ files: [Hash!]!
}
-
-type SetTitlePayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
- """The resulting operation"""
- operation: SetTitleOperation!
+type CommentConnection {
+ edges: [CommentEdge!]!
+ nodes: [Comment!]!
+ pageInfo: PageInfo!
+ totalCount: Int!
}
-
-input CommitInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
+type CommentEdge {
+ cursor: String!
+ node: Comment!
}
-
-type CommitPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
+"""
+CommentHistoryStep hold one version of a message in the history
+"""
+type CommentHistoryStep {
+ message: String!
+ date: Time!
}
-
input CommitAsNeededInput {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """"The name of the repository. If not set, the default repository is used."""
- repoRef: String
- """The bug ID's prefix."""
- prefix: String!
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
}
-
type CommitAsNeededPayload {
- """A unique identifier for the client performing the mutation."""
- clientMutationId: String
- """The affected bug."""
- bug: Bug!
-}
-`},
- &ast.Source{Name: "schema/operations.graphql", Input: `"""An operation applied to a bug."""
-interface Operation {
- """The identifier of the operation"""
- id: String!
- """The operations author."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
}
-
-# Connection
-
-"""The connection type for an Operation"""
-type OperationConnection {
- edges: [OperationEdge!]!
- nodes: [Operation!]!
- pageInfo: PageInfo!
- totalCount: Int!
+input CommitInput {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
}
-
-"""Represent an Operation"""
-type OperationEdge {
- cursor: String!
- node: Operation!
+type CommitPayload {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
}
-
-# Operations
-
type CreateOperation implements Operation & Authored {
- """The identifier of the operation"""
- id: String!
- """The author of this object."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
-
- title: String!
- message: String!
- files: [Hash!]!
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The author of this object.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+ title: String!
+ message: String!
+ files: [Hash!]!
+}
+"""
+CreateTimelineItem is a TimelineItem that represent the creation of a bug and its message edition history
+"""
+type CreateTimelineItem implements TimelineItem & Authored {
+ """
+ The identifier of the source operation
+ """
+ id: String!
+ author: Identity!
+ message: String!
+ messageIsEmpty: Boolean!
+ files: [Hash!]!
+ createdAt: Time!
+ lastEdit: Time!
+ edited: Boolean!
+ history: [CommentHistoryStep!]!
}
-
-type SetTitleOperation implements Operation & Authored {
- """The identifier of the operation"""
- id: String!
- """The author of this object."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
-
- title: String!
- was: String!
+type EditCommentOperation implements Operation & Authored {
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The author of this object.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+ target: String!
+ message: String!
+ files: [Hash!]!
}
-
-type AddCommentOperation implements Operation & Authored {
- """The identifier of the operation"""
- id: String!
- """The author of this object."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
-
- message: String!
- files: [Hash!]!
+scalar Hash
+"""
+Represents an identity
+"""
+type Identity {
+ """
+ The identifier for this identity
+ """
+ id: String!
+ """
+ The human version (truncated) identifier for this identity
+ """
+ humanId: String!
+ """
+ The name of the person, if known.
+ """
+ name: String
+ """
+ The email of the person, if known.
+ """
+ email: String
+ """
+ The login of the person, if known.
+ """
+ login: String
+ """
+ A string containing the either the name of the person, its login or both
+ """
+ displayName: String!
+ """
+ An url to an avatar
+ """
+ avatarUrl: String
+ """
+ isProtected is true if the chain of git commits started to be signed.
+ If that's the case, only signed commit with a valid key for this identity can be added.
+ """
+ isProtected: Boolean!
}
-
-type EditCommentOperation implements Operation & Authored {
- """The identifier of the operation"""
- id: String!
- """The author of this object."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
-
- target: String!
- message: String!
- files: [Hash!]!
+type IdentityConnection {
+ edges: [IdentityEdge!]!
+ nodes: [Identity!]!
+ pageInfo: PageInfo!
+ totalCount: Int!
}
-
-type SetStatusOperation implements Operation & Authored {
- """The identifier of the operation"""
- id: String!
- """The author of this object."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
-
- status: Status!
+type IdentityEdge {
+ cursor: String!
+ node: Identity!
+}
+"""
+Label for a bug.
+"""
+type Label {
+ """
+ The name of the label.
+ """
+ name: String!
+ """
+ Color of the label.
+ """
+ color: Color!
}
-
type LabelChangeOperation implements Operation & Authored {
- """The identifier of the operation"""
- id: String!
- """The author of this object."""
- author: Identity!
- """The datetime when this operation was issued."""
- date: Time!
-
- added: [Label!]!
- removed: [Label!]!
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The author of this object.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+ added: [Label!]!
+ removed: [Label!]!
}
-`},
- &ast.Source{Name: "schema/repository.graphql", Input: `
-type Repository {
- """All the bugs"""
- allBugs(
- """Returns the elements in the list that come after the specified cursor."""
- after: String
- """Returns the elements in the list that come before the specified cursor."""
- before: String
- """Returns the first _n_ elements from the list."""
- first: Int
- """Returns the last _n_ elements from the list."""
- last: Int
- """A query to select and order bugs"""
- query: String
- ): BugConnection!
-
- bug(prefix: String!): Bug
-
- """All the identities"""
- allIdentities(
- """Returns the elements in the list that come after the specified cursor."""
- after: String
- """Returns the elements in the list that come before the specified cursor."""
- before: String
- """Returns the first _n_ elements from the list."""
- first: Int
- """Returns the last _n_ elements from the list."""
- last: Int
- ): IdentityConnection!
-
- identity(prefix: String!): Identity
-
- """The identity created or selected by the user as its own"""
- userIdentity: Identity
-
- """List of valid labels."""
- validLabels(
- """Returns the elements in the list that come after the specified cursor."""
- after: String
- """Returns the elements in the list that come before the specified cursor."""
- before: String
- """Returns the first _n_ elements from the list."""
- first: Int
- """Returns the last _n_ elements from the list."""
- last: Int
- ): LabelConnection!
-}`},
- &ast.Source{Name: "schema/root.graphql", Input: `type Query {
- """The default unnamend repository."""
- defaultRepository: Repository
- """Access a repository by reference/name."""
- repository(ref: String!): Repository
+type LabelChangeResult {
+ """
+ The source label.
+ """
+ label: Label!
+ """
+ The effect this label had.
+ """
+ status: LabelChangeStatus!
+}
+enum LabelChangeStatus {
+ ADDED
+ REMOVED
+ DUPLICATE_IN_OP
+ ALREADY_EXIST
+ DOESNT_EXIST
+}
+"""
+LabelChangeTimelineItem is a TimelineItem that represent a change in the labels of a bug
+"""
+type LabelChangeTimelineItem implements TimelineItem & Authored {
+ """
+ The identifier of the source operation
+ """
+ id: String!
+ author: Identity!
+ date: Time!
+ added: [Label!]!
+ removed: [Label!]!
+}
+type LabelConnection {
+ edges: [LabelEdge!]!
+ nodes: [Label!]!
+ pageInfo: PageInfo!
+ totalCount: Int!
+}
+type LabelEdge {
+ cursor: String!
+ node: Label!
}
-
type Mutation {
- """Create a new bug"""
- newBug(input: NewBugInput!): NewBugPayload!
- """Add a new comment to a bug"""
- addComment(input: AddCommentInput!): AddCommentPayload!
- """Add or remove a set of label on a bug"""
- changeLabels(input: ChangeLabelInput): ChangeLabelPayload!
- """Change a bug's status to open"""
- openBug(input: OpenBugInput!): OpenBugPayload!
- """Change a bug's status to closed"""
- closeBug(input: CloseBugInput!): CloseBugPayload!
- """Change a bug's title"""
- setTitle(input: SetTitleInput!): SetTitlePayload!
- """Commit write the pending operations into storage. This mutation fail if nothing is pending"""
- commit(input: CommitInput!): CommitPayload!
- """Commit write the pending operations into storage. This mutation succed if nothing is pending"""
- commitAsNeeded(input: CommitAsNeededInput!): CommitAsNeededPayload!
+ """
+ Create a new bug
+ """
+ newBug(input: NewBugInput!): NewBugPayload!
+ """
+ Add a new comment to a bug
+ """
+ addComment(input: AddCommentInput!): AddCommentPayload!
+ """
+ Add or remove a set of label on a bug
+ """
+ changeLabels(input: ChangeLabelInput): ChangeLabelPayload!
+ """
+ Change a bug's status to open
+ """
+ openBug(input: OpenBugInput!): OpenBugPayload!
+ """
+ Change a bug's status to closed
+ """
+ closeBug(input: CloseBugInput!): CloseBugPayload!
+ """
+ Change a bug's title
+ """
+ setTitle(input: SetTitleInput!): SetTitlePayload!
+ """
+ Commit write the pending operations into storage. This mutation fail if nothing is pending
+ """
+ commit(input: CommitInput!): CommitPayload!
+ """
+ Commit write the pending operations into storage. This mutation succed if nothing is pending
+ """
+ commitAsNeeded(input: CommitAsNeededInput!): CommitAsNeededPayload!
+}
+input NewBugInput {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The title of the new bug.
+ """
+ title: String!
+ """
+ The first message of the new bug.
+ """
+ message: String!
+ """
+ The collection of file's hash required for the first message.
+ """
+ files: [Hash!]
}
-`},
- &ast.Source{Name: "schema/timeline.graphql", Input: `"""An item in the timeline of events"""
-interface TimelineItem {
- """The identifier of the source operation"""
- id: String!
+type NewBugPayload {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The created bug.
+ """
+ bug: Bug!
+ """
+ The resulting operation.
+ """
+ operation: CreateOperation!
}
-
-"""CommentHistoryStep hold one version of a message in the history"""
-type CommentHistoryStep {
- message: String!
- date: Time!
+input OpenBugInput {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
}
-
-# Connection
-
-"""The connection type for TimelineItem"""
-type TimelineItemConnection {
- edges: [TimelineItemEdge!]!
- nodes: [TimelineItem!]!
- pageInfo: PageInfo!
- totalCount: Int!
+type OpenBugPayload {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
+ """
+ The resulting operation.
+ """
+ operation: SetStatusOperation!
+}
+"""
+An operation applied to a bug.
+"""
+interface Operation {
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The operations author.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+}
+"""
+The connection type for an Operation
+"""
+type OperationConnection {
+ edges: [OperationEdge!]!
+ nodes: [Operation!]!
+ pageInfo: PageInfo!
+ totalCount: Int!
+}
+"""
+Represent an Operation
+"""
+type OperationEdge {
+ cursor: String!
+ node: Operation!
}
-
-"""Represent a TimelineItem"""
-type TimelineItemEdge {
- cursor: String!
- node: TimelineItem!
+"""
+Information about pagination in a connection.
+"""
+type PageInfo {
+ """
+ When paginating forwards, are there more items?
+ """
+ hasNextPage: Boolean!
+ """
+ When paginating backwards, are there more items?
+ """
+ hasPreviousPage: Boolean!
+ """
+ When paginating backwards, the cursor to continue.
+ """
+ startCursor: String!
+ """
+ When paginating forwards, the cursor to continue.
+ """
+ endCursor: String!
+}
+type Query {
+ """
+ The default unnamend repository.
+ """
+ defaultRepository: Repository
+ """
+ Access a repository by reference/name.
+ """
+ repository(ref: String!): Repository
}
-
-# Items
-
-"""CreateTimelineItem is a TimelineItem that represent the creation of a bug and its message edition history"""
-type CreateTimelineItem implements TimelineItem & Authored {
- """The identifier of the source operation"""
- id: String!
- author: Identity!
- message: String!
- messageIsEmpty: Boolean!
- files: [Hash!]!
- createdAt: Time!
- lastEdit: Time!
- edited: Boolean!
- history: [CommentHistoryStep!]!
-}
-
-"""AddCommentTimelineItem is a TimelineItem that represent a Comment and its edition history"""
-type AddCommentTimelineItem implements TimelineItem & Authored {
- """The identifier of the source operation"""
- id: String!
- author: Identity!
- message: String!
- messageIsEmpty: Boolean!
- files: [Hash!]!
- createdAt: Time!
- lastEdit: Time!
- edited: Boolean!
- history: [CommentHistoryStep!]!
-}
-
-"""LabelChangeTimelineItem is a TimelineItem that represent a change in the labels of a bug"""
-type LabelChangeTimelineItem implements TimelineItem & Authored {
- """The identifier of the source operation"""
- id: String!
- author: Identity!
- date: Time!
- added: [Label!]!
- removed: [Label!]!
+type Repository {
+ """
+ All the bugs
+ """
+ allBugs("""
+ Returns the elements in the list that come after the specified cursor.
+ """
+ after: String, """
+ Returns the elements in the list that come before the specified cursor.
+ """
+ before: String, """
+ Returns the first _n_ elements from the list.
+ """
+ first: Int, """
+ Returns the last _n_ elements from the list.
+ """
+ last: Int, """
+ A query to select and order bugs
+ """
+ query: String): BugConnection!
+ bug(prefix: String!): Bug
+ """
+ All the identities
+ """
+ allIdentities("""
+ Returns the elements in the list that come after the specified cursor.
+ """
+ after: String, """
+ Returns the elements in the list that come before the specified cursor.
+ """
+ before: String, """
+ Returns the first _n_ elements from the list.
+ """
+ first: Int, """
+ Returns the last _n_ elements from the list.
+ """
+ last: Int): IdentityConnection!
+ identity(prefix: String!): Identity
+ """
+ The identity created or selected by the user as its own
+ """
+ userIdentity: Identity
+ """
+ List of valid labels.
+ """
+ validLabels("""
+ Returns the elements in the list that come after the specified cursor.
+ """
+ after: String, """
+ Returns the elements in the list that come before the specified cursor.
+ """
+ before: String, """
+ Returns the first _n_ elements from the list.
+ """
+ first: Int, """
+ Returns the last _n_ elements from the list.
+ """
+ last: Int): LabelConnection!
}
-
-"""SetStatusTimelineItem is a TimelineItem that represent a change in the status of a bug"""
+type SetStatusOperation implements Operation & Authored {
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The author of this object.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+ status: Status!
+}
+"""
+SetStatusTimelineItem is a TimelineItem that represent a change in the status of a bug
+"""
type SetStatusTimelineItem implements TimelineItem & Authored {
- """The identifier of the source operation"""
- id: String!
- author: Identity!
- date: Time!
- status: Status!
+ """
+ The identifier of the source operation
+ """
+ id: String!
+ author: Identity!
+ date: Time!
+ status: Status!
}
-
-"""LabelChangeTimelineItem is a TimelineItem that represent a change in the title of a bug"""
-type SetTitleTimelineItem implements TimelineItem & Authored {
- """The identifier of the source operation"""
- id: String!
- author: Identity!
- date: Time!
- title: String!
- was: String!
+input SetTitleInput {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ "The name of the repository. If not set, the default repository is used.
+ """
+ repoRef: String
+ """
+ The bug ID's prefix.
+ """
+ prefix: String!
+ """
+ The new title.
+ """
+ title: String!
}
-`},
- &ast.Source{Name: "schema/types.graphql", Input: `scalar Time
-scalar Hash
-
-"""Defines a color by red, green and blue components."""
-type Color {
- """Red component of the color."""
- R: Int!
- """Green component of the color."""
- G: Int!
- """Blue component of the color."""
- B: Int!
+type SetTitleOperation implements Operation & Authored {
+ """
+ The identifier of the operation
+ """
+ id: String!
+ """
+ The author of this object.
+ """
+ author: Identity!
+ """
+ The datetime when this operation was issued.
+ """
+ date: Time!
+ title: String!
+ was: String!
}
-
-"""Information about pagination in a connection."""
-type PageInfo {
- """When paginating forwards, are there more items?"""
- hasNextPage: Boolean!
- """When paginating backwards, are there more items?"""
- hasPreviousPage: Boolean!
- """When paginating backwards, the cursor to continue."""
- startCursor: String!
- """When paginating forwards, the cursor to continue."""
- endCursor: String!
+type SetTitlePayload {
+ """
+ A unique identifier for the client performing the mutation.
+ """
+ clientMutationId: String
+ """
+ The affected bug.
+ """
+ bug: Bug!
+ """
+ The resulting operation
+ """
+ operation: SetTitleOperation!
+}
+"""
+LabelChangeTimelineItem is a TimelineItem that represent a change in the title of a bug
+"""
+type SetTitleTimelineItem implements TimelineItem & Authored {
+ """
+ The identifier of the source operation
+ """
+ id: String!
+ author: Identity!
+ date: Time!
+ title: String!
+ was: String!
}
-
-"""An object that has an author."""
-interface Authored {
- """The author of this object."""
- author: Identity!
+enum Status {
+ OPEN
+ CLOSED
+}
+scalar Time
+"""
+An item in the timeline of events
+"""
+interface TimelineItem {
+ """
+ The identifier of the source operation
+ """
+ id: String!
+}
+"""
+The connection type for TimelineItem
+"""
+type TimelineItemConnection {
+ edges: [TimelineItemEdge!]!
+ nodes: [TimelineItem!]!
+ pageInfo: PageInfo!
+ totalCount: Int!
+}
+"""
+Represent a TimelineItem
+"""
+type TimelineItemEdge {
+ cursor: String!
+ node: TimelineItem!
}
`},
)
@@ -3042,22 +3278,20 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg
// region **************************** field.gotpl *****************************
func (ec *executionContext) _AddCommentOperation_id(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.AddCommentOperation().ID(rctx, obj)
@@ -3067,34 +3301,31 @@ func (ec *executionContext) _AddCommentOperation_id(ctx context.Context, field g
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -3104,34 +3335,31 @@ func (ec *executionContext) _AddCommentOperation_author(ctx context.Context, fie
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.AddCommentOperation().Date(rctx, obj)
@@ -3141,34 +3369,31 @@ func (ec *executionContext) _AddCommentOperation_date(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentOperation_message(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Message, nil
@@ -3178,34 +3403,31 @@ func (ec *executionContext) _AddCommentOperation_message(ctx context.Context, fi
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentOperation_files(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Files, nil
@@ -3215,34 +3437,31 @@ func (ec *executionContext) _AddCommentOperation_files(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]git.Hash)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHashᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *models.AddCommentPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.ClientMutationID, nil
@@ -3255,28 +3474,25 @@ func (ec *executionContext) _AddCommentPayload_clientMutationId(ctx context.Cont
return graphql.Null
}
res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentPayload_bug(ctx context.Context, field graphql.CollectedField, obj *models.AddCommentPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Bug, nil
@@ -3286,34 +3502,31 @@ func (ec *executionContext) _AddCommentPayload_bug(ctx context.Context, field gr
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.Snapshot)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentPayload_operation(ctx context.Context, field graphql.CollectedField, obj *models.AddCommentPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Operation, nil
@@ -3323,34 +3536,31 @@ func (ec *executionContext) _AddCommentPayload_operation(ctx context.Context, fi
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.AddCommentOperation)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNAddCommentOperation2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐAddCommentOperation(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentTimelineItem_id(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.AddCommentTimelineItem().ID(rctx, obj)
@@ -3360,34 +3570,31 @@ func (ec *executionContext) _AddCommentTimelineItem_id(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -3397,34 +3604,31 @@ func (ec *executionContext) _AddCommentTimelineItem_author(ctx context.Context,
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentTimelineItem_message(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Message, nil
@@ -3434,34 +3638,31 @@ func (ec *executionContext) _AddCommentTimelineItem_message(ctx context.Context,
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentTimelineItem_messageIsEmpty(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.MessageIsEmpty(), nil
@@ -3471,34 +3672,31 @@ func (ec *executionContext) _AddCommentTimelineItem_messageIsEmpty(ctx context.C
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentTimelineItem_files(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Files, nil
@@ -3508,34 +3706,31 @@ func (ec *executionContext) _AddCommentTimelineItem_files(ctx context.Context, f
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]git.Hash)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHashᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentTimelineItem_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.AddCommentTimelineItem().CreatedAt(rctx, obj)
@@ -3545,34 +3740,31 @@ func (ec *executionContext) _AddCommentTimelineItem_createdAt(ctx context.Contex
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentTimelineItem_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.AddCommentTimelineItem().LastEdit(rctx, obj)
@@ -3582,34 +3774,31 @@ func (ec *executionContext) _AddCommentTimelineItem_lastEdit(ctx context.Context
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentTimelineItem_edited(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Edited(), nil
@@ -3619,34 +3808,31 @@ func (ec *executionContext) _AddCommentTimelineItem_edited(ctx context.Context,
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) _AddCommentTimelineItem_history(ctx context.Context, field graphql.CollectedField, obj *bug.AddCommentTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "AddCommentTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.History, nil
@@ -3656,34 +3842,31 @@ func (ec *executionContext) _AddCommentTimelineItem_history(ctx context.Context,
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]bug.CommentHistoryStep)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNCommentHistoryStep2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentHistoryStep(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNCommentHistoryStep2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentHistoryStepᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_id(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Bug().ID(rctx, obj)
@@ -3693,34 +3876,31 @@ func (ec *executionContext) _Bug_id(ctx context.Context, field graphql.Collected
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_humanId(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Bug().HumanID(rctx, obj)
@@ -3730,34 +3910,31 @@ func (ec *executionContext) _Bug_humanId(ctx context.Context, field graphql.Coll
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_status(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Bug().Status(rctx, obj)
@@ -3767,34 +3944,31 @@ func (ec *executionContext) _Bug_status(ctx context.Context, field graphql.Colle
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(models.Status)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐStatus(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_title(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Title, nil
@@ -3804,34 +3978,31 @@ func (ec *executionContext) _Bug_title(ctx context.Context, field graphql.Collec
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_labels(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Labels, nil
@@ -3841,34 +4012,31 @@ func (ec *executionContext) _Bug_labels(ctx context.Context, field graphql.Colle
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]bug.Label)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabelᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_author(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -3878,34 +4046,31 @@ func (ec *executionContext) _Bug_author(ctx context.Context, field graphql.Colle
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.CreatedAt, nil
@@ -3915,34 +4080,31 @@ func (ec *executionContext) _Bug_createdAt(ctx context.Context, field graphql.Co
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Bug().LastEdit(rctx, obj)
@@ -3952,41 +4114,38 @@ func (ec *executionContext) _Bug_lastEdit(ctx context.Context, field graphql.Col
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_actors(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Bug_actors_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Bug().Actors(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int))
@@ -3996,41 +4155,38 @@ func (ec *executionContext) _Bug_actors(ctx context.Context, field graphql.Colle
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.IdentityConnection)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentityConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityConnection(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_participants(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Bug_participants_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Bug().Participants(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int))
@@ -4040,41 +4196,38 @@ func (ec *executionContext) _Bug_participants(ctx context.Context, field graphql
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.IdentityConnection)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentityConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityConnection(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_comments(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Bug_comments_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Bug().Comments(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int))
@@ -4084,41 +4237,38 @@ func (ec *executionContext) _Bug_comments(ctx context.Context, field graphql.Col
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.CommentConnection)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNCommentConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentConnection(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_timeline(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Bug_timeline_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Bug().Timeline(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int))
@@ -4128,41 +4278,38 @@ func (ec *executionContext) _Bug_timeline(ctx context.Context, field graphql.Col
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.TimelineItemConnection)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTimelineItemConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemConnection(ctx, field.Selections, res)
}
func (ec *executionContext) _Bug_operations(ctx context.Context, field graphql.CollectedField, obj *bug.Snapshot) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Bug",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Bug_operations_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Bug().Operations(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int))
@@ -4172,34 +4319,31 @@ func (ec *executionContext) _Bug_operations(ctx context.Context, field graphql.C
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.OperationConnection)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNOperationConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationConnection(ctx, field.Selections, res)
}
func (ec *executionContext) _BugConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.BugConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "BugConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Edges, nil
@@ -4209,34 +4353,31 @@ func (ec *executionContext) _BugConnection_edges(ctx context.Context, field grap
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]*models.BugEdge)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNBugEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugEdge(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNBugEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugEdgeᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _BugConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.BugConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "BugConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Nodes, nil
@@ -4246,34 +4387,31 @@ func (ec *executionContext) _BugConnection_nodes(ctx context.Context, field grap
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]*bug.Snapshot)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNBug2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNBug2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshotᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _BugConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.BugConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "BugConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.PageInfo, nil
@@ -4283,34 +4421,31 @@ func (ec *executionContext) _BugConnection_pageInfo(ctx context.Context, field g
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.PageInfo)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNPageInfo2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res)
}
func (ec *executionContext) _BugConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.BugConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "BugConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.TotalCount, nil
@@ -4320,34 +4455,31 @@ func (ec *executionContext) _BugConnection_totalCount(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(int)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNInt2int(ctx, field.Selections, res)
}
func (ec *executionContext) _BugEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.BugEdge) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "BugEdge",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Cursor, nil
@@ -4357,34 +4489,31 @@ func (ec *executionContext) _BugEdge_cursor(ctx context.Context, field graphql.C
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _BugEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.BugEdge) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "BugEdge",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Node, nil
@@ -4394,34 +4523,31 @@ func (ec *executionContext) _BugEdge_node(ctx context.Context, field graphql.Col
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.Snapshot)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res)
}
func (ec *executionContext) _ChangeLabelPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *models.ChangeLabelPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "ChangeLabelPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.ClientMutationID, nil
@@ -4434,28 +4560,25 @@ func (ec *executionContext) _ChangeLabelPayload_clientMutationId(ctx context.Con
return graphql.Null
}
res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) _ChangeLabelPayload_bug(ctx context.Context, field graphql.CollectedField, obj *models.ChangeLabelPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "ChangeLabelPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Bug, nil
@@ -4465,34 +4588,31 @@ func (ec *executionContext) _ChangeLabelPayload_bug(ctx context.Context, field g
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.Snapshot)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res)
}
func (ec *executionContext) _ChangeLabelPayload_operation(ctx context.Context, field graphql.CollectedField, obj *models.ChangeLabelPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "ChangeLabelPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Operation, nil
@@ -4502,34 +4622,31 @@ func (ec *executionContext) _ChangeLabelPayload_operation(ctx context.Context, f
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.LabelChangeOperation)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNLabelChangeOperation2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabelChangeOperation(ctx, field.Selections, res)
}
func (ec *executionContext) _ChangeLabelPayload_results(ctx context.Context, field graphql.CollectedField, obj *models.ChangeLabelPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "ChangeLabelPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Results, nil
@@ -4539,34 +4656,31 @@ func (ec *executionContext) _ChangeLabelPayload_results(ctx context.Context, fie
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]*bug.LabelChangeResult)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNLabelChangeResult2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabelChangeResult(ctx, field.Selections, res)
}
func (ec *executionContext) _CloseBugPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *models.CloseBugPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CloseBugPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.ClientMutationID, nil
@@ -4579,28 +4693,25 @@ func (ec *executionContext) _CloseBugPayload_clientMutationId(ctx context.Contex
return graphql.Null
}
res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) _CloseBugPayload_bug(ctx context.Context, field graphql.CollectedField, obj *models.CloseBugPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CloseBugPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Bug, nil
@@ -4610,34 +4721,31 @@ func (ec *executionContext) _CloseBugPayload_bug(ctx context.Context, field grap
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.Snapshot)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res)
}
func (ec *executionContext) _CloseBugPayload_operation(ctx context.Context, field graphql.CollectedField, obj *models.CloseBugPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CloseBugPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Operation, nil
@@ -4647,34 +4755,31 @@ func (ec *executionContext) _CloseBugPayload_operation(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.SetStatusOperation)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNSetStatusOperation2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSetStatusOperation(ctx, field.Selections, res)
}
func (ec *executionContext) _Color_R(ctx context.Context, field graphql.CollectedField, obj *color.RGBA) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Color",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Color().R(rctx, obj)
@@ -4684,34 +4789,31 @@ func (ec *executionContext) _Color_R(ctx context.Context, field graphql.Collecte
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(int)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNInt2int(ctx, field.Selections, res)
}
func (ec *executionContext) _Color_G(ctx context.Context, field graphql.CollectedField, obj *color.RGBA) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Color",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Color().G(rctx, obj)
@@ -4721,34 +4823,31 @@ func (ec *executionContext) _Color_G(ctx context.Context, field graphql.Collecte
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(int)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNInt2int(ctx, field.Selections, res)
}
func (ec *executionContext) _Color_B(ctx context.Context, field graphql.CollectedField, obj *color.RGBA) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Color",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Color().B(rctx, obj)
@@ -4758,34 +4857,31 @@ func (ec *executionContext) _Color_B(ctx context.Context, field graphql.Collecte
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(int)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNInt2int(ctx, field.Selections, res)
}
func (ec *executionContext) _Comment_author(ctx context.Context, field graphql.CollectedField, obj *bug.Comment) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Comment",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -4795,34 +4891,31 @@ func (ec *executionContext) _Comment_author(ctx context.Context, field graphql.C
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _Comment_message(ctx context.Context, field graphql.CollectedField, obj *bug.Comment) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Comment",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Message, nil
@@ -4832,34 +4925,31 @@ func (ec *executionContext) _Comment_message(ctx context.Context, field graphql.
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _Comment_files(ctx context.Context, field graphql.CollectedField, obj *bug.Comment) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Comment",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Files, nil
@@ -4869,34 +4959,31 @@ func (ec *executionContext) _Comment_files(ctx context.Context, field graphql.Co
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]git.Hash)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHashᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _CommentConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.CommentConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CommentConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Edges, nil
@@ -4906,34 +4993,31 @@ func (ec *executionContext) _CommentConnection_edges(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]*models.CommentEdge)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNCommentEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentEdge(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNCommentEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentEdgeᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _CommentConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.CommentConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CommentConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Nodes, nil
@@ -4943,34 +5027,31 @@ func (ec *executionContext) _CommentConnection_nodes(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]*bug.Comment)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNComment2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐComment(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNComment2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _CommentConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.CommentConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CommentConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.PageInfo, nil
@@ -4980,34 +5061,31 @@ func (ec *executionContext) _CommentConnection_pageInfo(ctx context.Context, fie
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.PageInfo)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNPageInfo2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res)
}
func (ec *executionContext) _CommentConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.CommentConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CommentConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.TotalCount, nil
@@ -5017,34 +5095,31 @@ func (ec *executionContext) _CommentConnection_totalCount(ctx context.Context, f
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(int)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNInt2int(ctx, field.Selections, res)
}
func (ec *executionContext) _CommentEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.CommentEdge) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CommentEdge",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Cursor, nil
@@ -5054,34 +5129,31 @@ func (ec *executionContext) _CommentEdge_cursor(ctx context.Context, field graph
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _CommentEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.CommentEdge) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CommentEdge",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Node, nil
@@ -5091,34 +5163,31 @@ func (ec *executionContext) _CommentEdge_node(ctx context.Context, field graphql
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.Comment)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNComment2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐComment(ctx, field.Selections, res)
}
func (ec *executionContext) _CommentHistoryStep_message(ctx context.Context, field graphql.CollectedField, obj *bug.CommentHistoryStep) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CommentHistoryStep",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Message, nil
@@ -5128,34 +5197,31 @@ func (ec *executionContext) _CommentHistoryStep_message(ctx context.Context, fie
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _CommentHistoryStep_date(ctx context.Context, field graphql.CollectedField, obj *bug.CommentHistoryStep) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CommentHistoryStep",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.CommentHistoryStep().Date(rctx, obj)
@@ -5165,34 +5231,31 @@ func (ec *executionContext) _CommentHistoryStep_date(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _CommitAsNeededPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *models.CommitAsNeededPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CommitAsNeededPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.ClientMutationID, nil
@@ -5205,28 +5268,25 @@ func (ec *executionContext) _CommitAsNeededPayload_clientMutationId(ctx context.
return graphql.Null
}
res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) _CommitAsNeededPayload_bug(ctx context.Context, field graphql.CollectedField, obj *models.CommitAsNeededPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CommitAsNeededPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Bug, nil
@@ -5236,34 +5296,31 @@ func (ec *executionContext) _CommitAsNeededPayload_bug(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.Snapshot)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res)
}
func (ec *executionContext) _CommitPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *models.CommitPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CommitPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.ClientMutationID, nil
@@ -5276,28 +5333,25 @@ func (ec *executionContext) _CommitPayload_clientMutationId(ctx context.Context,
return graphql.Null
}
res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) _CommitPayload_bug(ctx context.Context, field graphql.CollectedField, obj *models.CommitPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CommitPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Bug, nil
@@ -5307,34 +5361,31 @@ func (ec *executionContext) _CommitPayload_bug(ctx context.Context, field graphq
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.Snapshot)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateOperation_id(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.CreateOperation().ID(rctx, obj)
@@ -5344,34 +5395,31 @@ func (ec *executionContext) _CreateOperation_id(ctx context.Context, field graph
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -5381,34 +5429,31 @@ func (ec *executionContext) _CreateOperation_author(ctx context.Context, field g
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.CreateOperation().Date(rctx, obj)
@@ -5418,34 +5463,31 @@ func (ec *executionContext) _CreateOperation_date(ctx context.Context, field gra
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateOperation_title(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Title, nil
@@ -5455,34 +5497,31 @@ func (ec *executionContext) _CreateOperation_title(ctx context.Context, field gr
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateOperation_message(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Message, nil
@@ -5492,34 +5531,31 @@ func (ec *executionContext) _CreateOperation_message(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateOperation_files(ctx context.Context, field graphql.CollectedField, obj *bug.CreateOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Files, nil
@@ -5529,34 +5565,31 @@ func (ec *executionContext) _CreateOperation_files(ctx context.Context, field gr
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]git.Hash)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHashᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateTimelineItem_id(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.CreateTimelineItem().ID(rctx, obj)
@@ -5566,34 +5599,31 @@ func (ec *executionContext) _CreateTimelineItem_id(ctx context.Context, field gr
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -5603,34 +5633,31 @@ func (ec *executionContext) _CreateTimelineItem_author(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateTimelineItem_message(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Message, nil
@@ -5640,34 +5667,31 @@ func (ec *executionContext) _CreateTimelineItem_message(ctx context.Context, fie
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateTimelineItem_messageIsEmpty(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.MessageIsEmpty(), nil
@@ -5677,34 +5701,31 @@ func (ec *executionContext) _CreateTimelineItem_messageIsEmpty(ctx context.Conte
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateTimelineItem_files(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Files, nil
@@ -5714,34 +5735,31 @@ func (ec *executionContext) _CreateTimelineItem_files(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]git.Hash)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHashᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateTimelineItem_createdAt(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.CreateTimelineItem().CreatedAt(rctx, obj)
@@ -5751,34 +5769,31 @@ func (ec *executionContext) _CreateTimelineItem_createdAt(ctx context.Context, f
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateTimelineItem_lastEdit(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.CreateTimelineItem().LastEdit(rctx, obj)
@@ -5788,34 +5803,31 @@ func (ec *executionContext) _CreateTimelineItem_lastEdit(ctx context.Context, fi
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateTimelineItem_edited(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Edited(), nil
@@ -5825,34 +5837,31 @@ func (ec *executionContext) _CreateTimelineItem_edited(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) _CreateTimelineItem_history(ctx context.Context, field graphql.CollectedField, obj *bug.CreateTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "CreateTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.History, nil
@@ -5862,34 +5871,31 @@ func (ec *executionContext) _CreateTimelineItem_history(ctx context.Context, fie
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]bug.CommentHistoryStep)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNCommentHistoryStep2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentHistoryStep(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNCommentHistoryStep2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentHistoryStepᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _EditCommentOperation_id(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "EditCommentOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.EditCommentOperation().ID(rctx, obj)
@@ -5899,34 +5905,31 @@ func (ec *executionContext) _EditCommentOperation_id(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _EditCommentOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "EditCommentOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -5936,34 +5939,31 @@ func (ec *executionContext) _EditCommentOperation_author(ctx context.Context, fi
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _EditCommentOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "EditCommentOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.EditCommentOperation().Date(rctx, obj)
@@ -5973,34 +5973,31 @@ func (ec *executionContext) _EditCommentOperation_date(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _EditCommentOperation_target(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "EditCommentOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.EditCommentOperation().Target(rctx, obj)
@@ -6010,34 +6007,31 @@ func (ec *executionContext) _EditCommentOperation_target(ctx context.Context, fi
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _EditCommentOperation_message(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "EditCommentOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Message, nil
@@ -6047,34 +6041,31 @@ func (ec *executionContext) _EditCommentOperation_message(ctx context.Context, f
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _EditCommentOperation_files(ctx context.Context, field graphql.CollectedField, obj *bug.EditCommentOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "EditCommentOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Files, nil
@@ -6084,34 +6075,31 @@ func (ec *executionContext) _EditCommentOperation_files(ctx context.Context, fie
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]git.Hash)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHashᚄ(ctx, field.Selections, res)
}
-func (ec *executionContext) _Identity_id(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
+func (ec *executionContext) _Identity_id(ctx context.Context, field graphql.CollectedField, obj identity.Interface) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Identity",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Identity().ID(rctx, obj)
@@ -6121,34 +6109,31 @@ func (ec *executionContext) _Identity_id(ctx context.Context, field graphql.Coll
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
-func (ec *executionContext) _Identity_humanId(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
+func (ec *executionContext) _Identity_humanId(ctx context.Context, field graphql.CollectedField, obj identity.Interface) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Identity",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Identity().HumanID(rctx, obj)
@@ -6158,37 +6143,34 @@ func (ec *executionContext) _Identity_humanId(ctx context.Context, field graphql
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
-func (ec *executionContext) _Identity_name(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
+func (ec *executionContext) _Identity_name(ctx context.Context, field graphql.CollectedField, obj identity.Interface) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Identity",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Identity().Name(rctx, obj)
+ return obj.Name(), nil
})
if err != nil {
ec.Error(ctx, err)
@@ -6197,32 +6179,29 @@ func (ec *executionContext) _Identity_name(ctx context.Context, field graphql.Co
if resTmp == nil {
return graphql.Null
}
- res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
+ res := resTmp.(string)
+ fc.Result = res
+ return ec.marshalOString2string(ctx, field.Selections, res)
}
-func (ec *executionContext) _Identity_email(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
+func (ec *executionContext) _Identity_email(ctx context.Context, field graphql.CollectedField, obj identity.Interface) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Identity",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Identity().Email(rctx, obj)
+ return obj.Email(), nil
})
if err != nil {
ec.Error(ctx, err)
@@ -6231,32 +6210,29 @@ func (ec *executionContext) _Identity_email(ctx context.Context, field graphql.C
if resTmp == nil {
return graphql.Null
}
- res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
+ res := resTmp.(string)
+ fc.Result = res
+ return ec.marshalOString2string(ctx, field.Selections, res)
}
-func (ec *executionContext) _Identity_login(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
+func (ec *executionContext) _Identity_login(ctx context.Context, field graphql.CollectedField, obj identity.Interface) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Identity",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Identity().Login(rctx, obj)
+ return obj.Login(), nil
})
if err != nil {
ec.Error(ctx, err)
@@ -6265,69 +6241,63 @@ func (ec *executionContext) _Identity_login(ctx context.Context, field graphql.C
if resTmp == nil {
return graphql.Null
}
- res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
+ res := resTmp.(string)
+ fc.Result = res
+ return ec.marshalOString2string(ctx, field.Selections, res)
}
-func (ec *executionContext) _Identity_displayName(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
+func (ec *executionContext) _Identity_displayName(ctx context.Context, field graphql.CollectedField, obj identity.Interface) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Identity",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Identity().DisplayName(rctx, obj)
+ return obj.DisplayName(), nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
-func (ec *executionContext) _Identity_avatarUrl(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
+func (ec *executionContext) _Identity_avatarUrl(ctx context.Context, field graphql.CollectedField, obj identity.Interface) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Identity",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Identity().AvatarURL(rctx, obj)
+ return obj.AvatarUrl(), nil
})
if err != nil {
ec.Error(ctx, err)
@@ -6336,66 +6306,60 @@ func (ec *executionContext) _Identity_avatarUrl(ctx context.Context, field graph
if resTmp == nil {
return graphql.Null
}
- res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
+ res := resTmp.(string)
+ fc.Result = res
+ return ec.marshalOString2string(ctx, field.Selections, res)
}
-func (ec *executionContext) _Identity_isProtected(ctx context.Context, field graphql.CollectedField, obj *identity.Interface) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
+func (ec *executionContext) _Identity_isProtected(ctx context.Context, field graphql.CollectedField, obj identity.Interface) (ret graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Identity",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
- return ec.resolvers.Identity().IsProtected(rctx, obj)
+ return obj.IsProtected(), nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) _IdentityConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.IdentityConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "IdentityConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Edges, nil
@@ -6405,34 +6369,31 @@ func (ec *executionContext) _IdentityConnection_edges(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]*models.IdentityEdge)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNIdentityEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityEdge(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNIdentityEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityEdgeᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _IdentityConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.IdentityConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "IdentityConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Nodes, nil
@@ -6442,34 +6403,31 @@ func (ec *executionContext) _IdentityConnection_nodes(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNIdentity2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNIdentity2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterfaceᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _IdentityConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.IdentityConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "IdentityConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.PageInfo, nil
@@ -6479,34 +6437,31 @@ func (ec *executionContext) _IdentityConnection_pageInfo(ctx context.Context, fi
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.PageInfo)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNPageInfo2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res)
}
func (ec *executionContext) _IdentityConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.IdentityConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "IdentityConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.TotalCount, nil
@@ -6516,34 +6471,31 @@ func (ec *executionContext) _IdentityConnection_totalCount(ctx context.Context,
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(int)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNInt2int(ctx, field.Selections, res)
}
func (ec *executionContext) _IdentityEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.IdentityEdge) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "IdentityEdge",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Cursor, nil
@@ -6553,34 +6505,31 @@ func (ec *executionContext) _IdentityEdge_cursor(ctx context.Context, field grap
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _IdentityEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.IdentityEdge) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "IdentityEdge",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Node, nil
@@ -6590,34 +6539,31 @@ func (ec *executionContext) _IdentityEdge_node(ctx context.Context, field graphq
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _Label_name(ctx context.Context, field graphql.CollectedField, obj *bug.Label) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Label",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Label().Name(rctx, obj)
@@ -6627,34 +6573,31 @@ func (ec *executionContext) _Label_name(ctx context.Context, field graphql.Colle
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _Label_color(ctx context.Context, field graphql.CollectedField, obj *bug.Label) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Label",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Label().Color(rctx, obj)
@@ -6664,34 +6607,31 @@ func (ec *executionContext) _Label_color(ctx context.Context, field graphql.Coll
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*color.RGBA)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNColor2ᚖimageᚋcolorᚐRGBA(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelChangeOperation_id(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelChangeOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.LabelChangeOperation().ID(rctx, obj)
@@ -6701,34 +6641,31 @@ func (ec *executionContext) _LabelChangeOperation_id(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelChangeOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelChangeOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -6738,34 +6675,31 @@ func (ec *executionContext) _LabelChangeOperation_author(ctx context.Context, fi
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelChangeOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelChangeOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.LabelChangeOperation().Date(rctx, obj)
@@ -6775,34 +6709,31 @@ func (ec *executionContext) _LabelChangeOperation_date(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelChangeOperation_added(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelChangeOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Added, nil
@@ -6812,34 +6743,31 @@ func (ec *executionContext) _LabelChangeOperation_added(ctx context.Context, fie
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]bug.Label)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabelᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelChangeOperation_removed(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelChangeOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Removed, nil
@@ -6849,34 +6777,31 @@ func (ec *executionContext) _LabelChangeOperation_removed(ctx context.Context, f
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]bug.Label)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabelᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelChangeResult_label(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeResult) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelChangeResult",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Label, nil
@@ -6886,34 +6811,31 @@ func (ec *executionContext) _LabelChangeResult_label(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bug.Label)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNLabel2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelChangeResult_status(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeResult) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelChangeResult",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.LabelChangeResult().Status(rctx, obj)
@@ -6923,34 +6845,31 @@ func (ec *executionContext) _LabelChangeResult_status(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(models.LabelChangeStatus)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNLabelChangeStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐLabelChangeStatus(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelChangeTimelineItem_id(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelChangeTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.LabelChangeTimelineItem().ID(rctx, obj)
@@ -6960,34 +6879,31 @@ func (ec *executionContext) _LabelChangeTimelineItem_id(ctx context.Context, fie
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelChangeTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelChangeTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -6997,34 +6913,31 @@ func (ec *executionContext) _LabelChangeTimelineItem_author(ctx context.Context,
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelChangeTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelChangeTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.LabelChangeTimelineItem().Date(rctx, obj)
@@ -7034,34 +6947,31 @@ func (ec *executionContext) _LabelChangeTimelineItem_date(ctx context.Context, f
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelChangeTimelineItem_added(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelChangeTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Added, nil
@@ -7071,34 +6981,31 @@ func (ec *executionContext) _LabelChangeTimelineItem_added(ctx context.Context,
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]bug.Label)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabelᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelChangeTimelineItem_removed(ctx context.Context, field graphql.CollectedField, obj *bug.LabelChangeTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelChangeTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Removed, nil
@@ -7108,34 +7015,31 @@ func (ec *executionContext) _LabelChangeTimelineItem_removed(ctx context.Context
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]bug.Label)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabelᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.LabelConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Edges, nil
@@ -7145,34 +7049,31 @@ func (ec *executionContext) _LabelConnection_edges(ctx context.Context, field gr
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]*models.LabelEdge)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNLabelEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐLabelEdge(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNLabelEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐLabelEdgeᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.LabelConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Nodes, nil
@@ -7182,34 +7083,31 @@ func (ec *executionContext) _LabelConnection_nodes(ctx context.Context, field gr
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]bug.Label)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabelᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.LabelConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.PageInfo, nil
@@ -7219,34 +7117,31 @@ func (ec *executionContext) _LabelConnection_pageInfo(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.PageInfo)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNPageInfo2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.LabelConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.TotalCount, nil
@@ -7256,34 +7151,31 @@ func (ec *executionContext) _LabelConnection_totalCount(ctx context.Context, fie
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(int)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNInt2int(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.LabelEdge) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelEdge",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Cursor, nil
@@ -7293,34 +7185,31 @@ func (ec *executionContext) _LabelEdge_cursor(ctx context.Context, field graphql
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _LabelEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.LabelEdge) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "LabelEdge",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Node, nil
@@ -7330,41 +7219,38 @@ func (ec *executionContext) _LabelEdge_node(ctx context.Context, field graphql.C
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bug.Label)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNLabel2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx, field.Selections, res)
}
func (ec *executionContext) _Mutation_newBug(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Mutation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Mutation_newBug_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Mutation().NewBug(rctx, args["input"].(models.NewBugInput))
@@ -7374,41 +7260,38 @@ func (ec *executionContext) _Mutation_newBug(ctx context.Context, field graphql.
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.NewBugPayload)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNNewBugPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐNewBugPayload(ctx, field.Selections, res)
}
func (ec *executionContext) _Mutation_addComment(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Mutation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Mutation_addComment_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Mutation().AddComment(rctx, args["input"].(models.AddCommentInput))
@@ -7418,41 +7301,38 @@ func (ec *executionContext) _Mutation_addComment(ctx context.Context, field grap
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.AddCommentPayload)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNAddCommentPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐAddCommentPayload(ctx, field.Selections, res)
}
func (ec *executionContext) _Mutation_changeLabels(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Mutation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Mutation_changeLabels_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Mutation().ChangeLabels(rctx, args["input"].(*models.ChangeLabelInput))
@@ -7462,41 +7342,38 @@ func (ec *executionContext) _Mutation_changeLabels(ctx context.Context, field gr
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.ChangeLabelPayload)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNChangeLabelPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐChangeLabelPayload(ctx, field.Selections, res)
}
func (ec *executionContext) _Mutation_openBug(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Mutation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Mutation_openBug_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Mutation().OpenBug(rctx, args["input"].(models.OpenBugInput))
@@ -7506,41 +7383,38 @@ func (ec *executionContext) _Mutation_openBug(ctx context.Context, field graphql
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.OpenBugPayload)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNOpenBugPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOpenBugPayload(ctx, field.Selections, res)
}
func (ec *executionContext) _Mutation_closeBug(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Mutation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Mutation_closeBug_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Mutation().CloseBug(rctx, args["input"].(models.CloseBugInput))
@@ -7550,41 +7424,38 @@ func (ec *executionContext) _Mutation_closeBug(ctx context.Context, field graphq
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.CloseBugPayload)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNCloseBugPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCloseBugPayload(ctx, field.Selections, res)
}
func (ec *executionContext) _Mutation_setTitle(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Mutation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Mutation_setTitle_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Mutation().SetTitle(rctx, args["input"].(models.SetTitleInput))
@@ -7594,41 +7465,38 @@ func (ec *executionContext) _Mutation_setTitle(ctx context.Context, field graphq
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.SetTitlePayload)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNSetTitlePayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐSetTitlePayload(ctx, field.Selections, res)
}
func (ec *executionContext) _Mutation_commit(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Mutation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Mutation_commit_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Mutation().Commit(rctx, args["input"].(models.CommitInput))
@@ -7638,41 +7506,38 @@ func (ec *executionContext) _Mutation_commit(ctx context.Context, field graphql.
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.CommitPayload)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNCommitPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitPayload(ctx, field.Selections, res)
}
func (ec *executionContext) _Mutation_commitAsNeeded(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Mutation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Mutation_commitAsNeeded_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Mutation().CommitAsNeeded(rctx, args["input"].(models.CommitAsNeededInput))
@@ -7682,34 +7547,31 @@ func (ec *executionContext) _Mutation_commitAsNeeded(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.CommitAsNeededPayload)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNCommitAsNeededPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitAsNeededPayload(ctx, field.Selections, res)
}
func (ec *executionContext) _NewBugPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *models.NewBugPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "NewBugPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.ClientMutationID, nil
@@ -7722,28 +7584,25 @@ func (ec *executionContext) _NewBugPayload_clientMutationId(ctx context.Context,
return graphql.Null
}
res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) _NewBugPayload_bug(ctx context.Context, field graphql.CollectedField, obj *models.NewBugPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "NewBugPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Bug, nil
@@ -7753,34 +7612,31 @@ func (ec *executionContext) _NewBugPayload_bug(ctx context.Context, field graphq
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.Snapshot)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res)
}
func (ec *executionContext) _NewBugPayload_operation(ctx context.Context, field graphql.CollectedField, obj *models.NewBugPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "NewBugPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Operation, nil
@@ -7790,34 +7646,31 @@ func (ec *executionContext) _NewBugPayload_operation(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.CreateOperation)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNCreateOperation2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCreateOperation(ctx, field.Selections, res)
}
func (ec *executionContext) _OpenBugPayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *models.OpenBugPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "OpenBugPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.ClientMutationID, nil
@@ -7830,28 +7683,25 @@ func (ec *executionContext) _OpenBugPayload_clientMutationId(ctx context.Context
return graphql.Null
}
res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) _OpenBugPayload_bug(ctx context.Context, field graphql.CollectedField, obj *models.OpenBugPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "OpenBugPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Bug, nil
@@ -7861,34 +7711,31 @@ func (ec *executionContext) _OpenBugPayload_bug(ctx context.Context, field graph
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.Snapshot)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res)
}
func (ec *executionContext) _OpenBugPayload_operation(ctx context.Context, field graphql.CollectedField, obj *models.OpenBugPayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "OpenBugPayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Operation, nil
@@ -7898,34 +7745,31 @@ func (ec *executionContext) _OpenBugPayload_operation(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.SetStatusOperation)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNSetStatusOperation2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSetStatusOperation(ctx, field.Selections, res)
}
func (ec *executionContext) _OperationConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "OperationConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Edges, nil
@@ -7935,34 +7779,31 @@ func (ec *executionContext) _OperationConnection_edges(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]*models.OperationEdge)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNOperationEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationEdge(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNOperationEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationEdgeᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _OperationConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "OperationConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Nodes, nil
@@ -7972,34 +7813,31 @@ func (ec *executionContext) _OperationConnection_nodes(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]bug.Operation)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNOperation2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐOperation(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNOperation2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐOperationᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _OperationConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "OperationConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.PageInfo, nil
@@ -8009,34 +7847,31 @@ func (ec *executionContext) _OperationConnection_pageInfo(ctx context.Context, f
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.PageInfo)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNPageInfo2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res)
}
func (ec *executionContext) _OperationConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.OperationConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "OperationConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.TotalCount, nil
@@ -8046,34 +7881,31 @@ func (ec *executionContext) _OperationConnection_totalCount(ctx context.Context,
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(int)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNInt2int(ctx, field.Selections, res)
}
func (ec *executionContext) _OperationEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.OperationEdge) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "OperationEdge",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Cursor, nil
@@ -8083,34 +7915,31 @@ func (ec *executionContext) _OperationEdge_cursor(ctx context.Context, field gra
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _OperationEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.OperationEdge) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "OperationEdge",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Node, nil
@@ -8120,34 +7949,31 @@ func (ec *executionContext) _OperationEdge_node(ctx context.Context, field graph
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bug.Operation)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNOperation2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐOperation(ctx, field.Selections, res)
}
func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "PageInfo",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.HasNextPage, nil
@@ -8157,34 +7983,31 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "PageInfo",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.HasPreviousPage, nil
@@ -8194,34 +8017,31 @@ func (ec *executionContext) _PageInfo_hasPreviousPage(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "PageInfo",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.StartCursor, nil
@@ -8231,34 +8051,31 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "PageInfo",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.EndCursor, nil
@@ -8268,34 +8085,31 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _Query_defaultRepository(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Query",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Query().DefaultRepository(rctx)
@@ -8308,35 +8122,32 @@ func (ec *executionContext) _Query_defaultRepository(ctx context.Context, field
return graphql.Null
}
res := resTmp.(*models.Repository)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalORepository2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐRepository(ctx, field.Selections, res)
}
func (ec *executionContext) _Query_repository(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Query",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Query_repository_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Query().Repository(rctx, args["ref"].(string))
@@ -8349,35 +8160,32 @@ func (ec *executionContext) _Query_repository(ctx context.Context, field graphql
return graphql.Null
}
res := resTmp.(*models.Repository)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalORepository2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐRepository(ctx, field.Selections, res)
}
func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Query",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Query___type_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.introspectType(args["name"].(string))
@@ -8390,28 +8198,25 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col
return graphql.Null
}
res := resTmp.(*introspection.Type)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalO__Type2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
}
func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Query",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.introspectSchema()
@@ -8424,35 +8229,32 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C
return graphql.Null
}
res := resTmp.(*introspection.Schema)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalO__Schema2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res)
}
func (ec *executionContext) _Repository_allBugs(ctx context.Context, field graphql.CollectedField, obj *models.Repository) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Repository",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Repository_allBugs_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Repository().AllBugs(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int), args["query"].(*string))
@@ -8462,41 +8264,38 @@ func (ec *executionContext) _Repository_allBugs(ctx context.Context, field graph
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.BugConnection)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBugConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugConnection(ctx, field.Selections, res)
}
func (ec *executionContext) _Repository_bug(ctx context.Context, field graphql.CollectedField, obj *models.Repository) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Repository",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Repository_bug_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Repository().Bug(rctx, obj, args["prefix"].(string))
@@ -8509,35 +8308,32 @@ func (ec *executionContext) _Repository_bug(ctx context.Context, field graphql.C
return graphql.Null
}
res := resTmp.(*bug.Snapshot)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res)
}
func (ec *executionContext) _Repository_allIdentities(ctx context.Context, field graphql.CollectedField, obj *models.Repository) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Repository",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Repository_allIdentities_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Repository().AllIdentities(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int))
@@ -8547,41 +8343,38 @@ func (ec *executionContext) _Repository_allIdentities(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.IdentityConnection)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentityConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityConnection(ctx, field.Selections, res)
}
func (ec *executionContext) _Repository_identity(ctx context.Context, field graphql.CollectedField, obj *models.Repository) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Repository",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Repository_identity_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Repository().Identity(rctx, obj, args["prefix"].(string))
@@ -8594,28 +8387,25 @@ func (ec *executionContext) _Repository_identity(ctx context.Context, field grap
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _Repository_userIdentity(ctx context.Context, field graphql.CollectedField, obj *models.Repository) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Repository",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Repository().UserIdentity(rctx, obj)
@@ -8628,35 +8418,32 @@ func (ec *executionContext) _Repository_userIdentity(ctx context.Context, field
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _Repository_validLabels(ctx context.Context, field graphql.CollectedField, obj *models.Repository) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "Repository",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field_Repository_validLabels_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.Repository().ValidLabels(rctx, obj, args["after"].(*string), args["before"].(*string), args["first"].(*int), args["last"].(*int))
@@ -8666,34 +8453,31 @@ func (ec *executionContext) _Repository_validLabels(ctx context.Context, field g
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.LabelConnection)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNLabelConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐLabelConnection(ctx, field.Selections, res)
}
func (ec *executionContext) _SetStatusOperation_id(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetStatusOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.SetStatusOperation().ID(rctx, obj)
@@ -8703,34 +8487,31 @@ func (ec *executionContext) _SetStatusOperation_id(ctx context.Context, field gr
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _SetStatusOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetStatusOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -8740,34 +8521,31 @@ func (ec *executionContext) _SetStatusOperation_author(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _SetStatusOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetStatusOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.SetStatusOperation().Date(rctx, obj)
@@ -8777,34 +8555,31 @@ func (ec *executionContext) _SetStatusOperation_date(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _SetStatusOperation_status(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetStatusOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.SetStatusOperation().Status(rctx, obj)
@@ -8814,34 +8589,31 @@ func (ec *executionContext) _SetStatusOperation_status(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(models.Status)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐStatus(ctx, field.Selections, res)
}
func (ec *executionContext) _SetStatusTimelineItem_id(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetStatusTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.SetStatusTimelineItem().ID(rctx, obj)
@@ -8851,34 +8623,31 @@ func (ec *executionContext) _SetStatusTimelineItem_id(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _SetStatusTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetStatusTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -8888,34 +8657,31 @@ func (ec *executionContext) _SetStatusTimelineItem_author(ctx context.Context, f
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _SetStatusTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetStatusTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.SetStatusTimelineItem().Date(rctx, obj)
@@ -8925,34 +8691,31 @@ func (ec *executionContext) _SetStatusTimelineItem_date(ctx context.Context, fie
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _SetStatusTimelineItem_status(ctx context.Context, field graphql.CollectedField, obj *bug.SetStatusTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetStatusTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.SetStatusTimelineItem().Status(rctx, obj)
@@ -8962,34 +8725,31 @@ func (ec *executionContext) _SetStatusTimelineItem_status(ctx context.Context, f
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(models.Status)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNStatus2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐStatus(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitleOperation_id(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitleOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.SetTitleOperation().ID(rctx, obj)
@@ -8999,34 +8759,31 @@ func (ec *executionContext) _SetTitleOperation_id(ctx context.Context, field gra
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitleOperation_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitleOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -9036,34 +8793,31 @@ func (ec *executionContext) _SetTitleOperation_author(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitleOperation_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitleOperation",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.SetTitleOperation().Date(rctx, obj)
@@ -9073,34 +8827,31 @@ func (ec *executionContext) _SetTitleOperation_date(ctx context.Context, field g
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitleOperation_title(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitleOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Title, nil
@@ -9110,34 +8861,31 @@ func (ec *executionContext) _SetTitleOperation_title(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitleOperation_was(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleOperation) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitleOperation",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Was, nil
@@ -9147,34 +8895,31 @@ func (ec *executionContext) _SetTitleOperation_was(ctx context.Context, field gr
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitlePayload_clientMutationId(ctx context.Context, field graphql.CollectedField, obj *models.SetTitlePayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitlePayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.ClientMutationID, nil
@@ -9187,28 +8932,25 @@ func (ec *executionContext) _SetTitlePayload_clientMutationId(ctx context.Contex
return graphql.Null
}
res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitlePayload_bug(ctx context.Context, field graphql.CollectedField, obj *models.SetTitlePayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitlePayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Bug, nil
@@ -9218,34 +8960,31 @@ func (ec *executionContext) _SetTitlePayload_bug(ctx context.Context, field grap
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.Snapshot)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitlePayload_operation(ctx context.Context, field graphql.CollectedField, obj *models.SetTitlePayload) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitlePayload",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Operation, nil
@@ -9255,34 +8994,31 @@ func (ec *executionContext) _SetTitlePayload_operation(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*bug.SetTitleOperation)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNSetTitleOperation2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSetTitleOperation(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitleTimelineItem_id(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitleTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.SetTitleTimelineItem().ID(rctx, obj)
@@ -9292,34 +9028,31 @@ func (ec *executionContext) _SetTitleTimelineItem_id(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitleTimelineItem_author(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitleTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Author, nil
@@ -9329,34 +9062,31 @@ func (ec *executionContext) _SetTitleTimelineItem_author(ctx context.Context, fi
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(identity.Interface)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitleTimelineItem_date(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitleTimelineItem",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return ec.resolvers.SetTitleTimelineItem().Date(rctx, obj)
@@ -9366,34 +9096,31 @@ func (ec *executionContext) _SetTitleTimelineItem_date(ctx context.Context, fiel
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*time.Time)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTime2ᚖtimeᚐTime(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitleTimelineItem_title(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitleTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Title, nil
@@ -9403,34 +9130,31 @@ func (ec *executionContext) _SetTitleTimelineItem_title(ctx context.Context, fie
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _SetTitleTimelineItem_was(ctx context.Context, field graphql.CollectedField, obj *bug.SetTitleTimelineItem) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "SetTitleTimelineItem",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Was, nil
@@ -9440,34 +9164,31 @@ func (ec *executionContext) _SetTitleTimelineItem_was(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _TimelineItemConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "TimelineItemConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Edges, nil
@@ -9477,34 +9198,31 @@ func (ec *executionContext) _TimelineItemConnection_edges(ctx context.Context, f
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]*models.TimelineItemEdge)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNTimelineItemEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemEdge(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNTimelineItemEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemEdgeᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _TimelineItemConnection_nodes(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "TimelineItemConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Nodes, nil
@@ -9514,34 +9232,31 @@ func (ec *executionContext) _TimelineItemConnection_nodes(ctx context.Context, f
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]bug.TimelineItem)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalNTimelineItem2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐTimelineItem(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalNTimelineItem2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐTimelineItemᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) _TimelineItemConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "TimelineItemConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.PageInfo, nil
@@ -9551,34 +9266,31 @@ func (ec *executionContext) _TimelineItemConnection_pageInfo(ctx context.Context
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*models.PageInfo)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNPageInfo2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx, field.Selections, res)
}
func (ec *executionContext) _TimelineItemConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemConnection) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "TimelineItemConnection",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.TotalCount, nil
@@ -9588,34 +9300,31 @@ func (ec *executionContext) _TimelineItemConnection_totalCount(ctx context.Conte
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(int)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNInt2int(ctx, field.Selections, res)
}
func (ec *executionContext) _TimelineItemEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemEdge) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "TimelineItemEdge",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Cursor, nil
@@ -9625,34 +9334,31 @@ func (ec *executionContext) _TimelineItemEdge_cursor(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) _TimelineItemEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.TimelineItemEdge) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "TimelineItemEdge",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Node, nil
@@ -9662,34 +9368,31 @@ func (ec *executionContext) _TimelineItemEdge_node(ctx context.Context, field gr
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bug.TimelineItem)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNTimelineItem2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐTimelineItem(ctx, field.Selections, res)
}
func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Directive",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Name, nil
@@ -9699,34 +9402,31 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Directive",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Description, nil
@@ -9739,28 +9439,25 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2string(ctx, field.Selections, res)
}
func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Directive",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Locations, nil
@@ -9770,34 +9467,31 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Directive",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Args, nil
@@ -9807,34 +9501,31 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]introspection.InputValue)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalN__InputValue2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__EnumValue",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Name, nil
@@ -9844,34 +9535,31 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__EnumValue",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Description, nil
@@ -9884,28 +9572,25 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2string(ctx, field.Selections, res)
}
func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__EnumValue",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.IsDeprecated(), nil
@@ -9915,34 +9600,31 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__EnumValue",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.DeprecationReason(), nil
@@ -9955,28 +9637,25 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context,
return graphql.Null
}
res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Field",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Name, nil
@@ -9986,34 +9665,31 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Field",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Description, nil
@@ -10026,28 +9702,25 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2string(ctx, field.Selections, res)
}
func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Field",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Args, nil
@@ -10057,34 +9730,31 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]introspection.InputValue)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalN__InputValue2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Field",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Type, nil
@@ -10094,34 +9764,31 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*introspection.Type)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalN__Type2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
}
func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Field",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.IsDeprecated(), nil
@@ -10131,34 +9798,31 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Field",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.DeprecationReason(), nil
@@ -10171,28 +9835,25 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel
return graphql.Null
}
res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__InputValue",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Name, nil
@@ -10202,34 +9863,31 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalNString2string(ctx, field.Selections, res)
}
func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__InputValue",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Description, nil
@@ -10242,28 +9900,25 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2string(ctx, field.Selections, res)
}
func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__InputValue",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Type, nil
@@ -10273,34 +9928,31 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*introspection.Type)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalN__Type2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
}
func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__InputValue",
Field: field,
Args: nil,
IsMethod: false,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.DefaultValue, nil
@@ -10313,28 +9965,25 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel
return graphql.Null
}
res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Schema",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Types(), nil
@@ -10344,34 +9993,31 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]introspection.Type)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalN__Type2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Schema",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.QueryType(), nil
@@ -10381,34 +10027,31 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(*introspection.Type)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalN__Type2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
}
func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Schema",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.MutationType(), nil
@@ -10421,28 +10064,25 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr
return graphql.Null
}
res := resTmp.(*introspection.Type)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalO__Type2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
}
func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Schema",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.SubscriptionType(), nil
@@ -10455,28 +10095,25 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel
return graphql.Null
}
res := resTmp.(*introspection.Type)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalO__Type2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
}
func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Schema",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Directives(), nil
@@ -10486,34 +10123,31 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.([]introspection.Directive)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalN__Directive2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Type",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Kind(), nil
@@ -10523,34 +10157,31 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll
return graphql.Null
}
if resTmp == nil {
- if !ec.HasError(rctx) {
+ if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalN__TypeKind2string(ctx, field.Selections, res)
}
func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Type",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Name(), nil
@@ -10563,28 +10194,25 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll
return graphql.Null
}
res := resTmp.(*string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
}
func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Type",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Description(), nil
@@ -10597,35 +10225,32 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph
return graphql.Null
}
res := resTmp.(string)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
+ fc.Result = res
return ec.marshalOString2string(ctx, field.Selections, res)
}
func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Type",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field___Type_fields_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Fields(args["includeDeprecated"].(bool)), nil
@@ -10638,28 +10263,25 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co
return graphql.Null
}
res := resTmp.([]introspection.Field)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalO__Field2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Type",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.Interfaces(), nil
@@ -10672,28 +10294,25 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq
return graphql.Null
}
res := resTmp.([]introspection.Type)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalO__Type2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Type",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.PossibleTypes(), nil
@@ -10706,35 +10325,32 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra
return graphql.Null
}
res := resTmp.([]introspection.Type)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalO__Type2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Type",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
rawArgs := field.ArgumentMap(ec.Variables)
args, err := ec.field___Type_enumValues_args(ctx, rawArgs)
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
- rctx.Args = args
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+ fc.Args = args
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.EnumValues(args["includeDeprecated"].(bool)), nil
@@ -10747,28 +10363,25 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq
return graphql.Null
}
res := resTmp.([]introspection.EnumValue)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Type",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.InputFields(), nil
@@ -10781,28 +10394,25 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph
return graphql.Null
}
res := resTmp.([]introspection.InputValue)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalO__InputValue2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res)
}
func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
- ec.Tracer.EndFieldExecution(ctx)
}()
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Object: "__Type",
Field: field,
Args: nil,
IsMethod: true,
}
- ctx = graphql.WithResolverContext(ctx, rctx)
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
+
+ ctx = graphql.WithFieldContext(ctx, fc)
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.OfType(), nil
@@ -10815,9 +10425,8 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co
return graphql.Null
}
res := resTmp.(*introspection.Type)
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.marshalO__Type2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
+ fc.Result = res
+ return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res)
}
// endregion **************************** field.gotpl *****************************
@@ -10856,7 +10465,7 @@ func (ec *executionContext) unmarshalInputAddCommentInput(ctx context.Context, o
}
case "files":
var err error
- it.Files, err = ec.unmarshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, v)
+ it.Files, err = ec.unmarshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHashᚄ(ctx, v)
if err != nil {
return it, err
}
@@ -10892,13 +10501,13 @@ func (ec *executionContext) unmarshalInputChangeLabelInput(ctx context.Context,
}
case "added":
var err error
- it.Added, err = ec.unmarshalOString2ᚕstring(ctx, v)
+ it.Added, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v)
if err != nil {
return it, err
}
case "Removed":
var err error
- it.Removed, err = ec.unmarshalOString2ᚕstring(ctx, v)
+ it.Removed, err = ec.unmarshalOString2ᚕstringᚄ(ctx, v)
if err != nil {
return it, err
}
@@ -11030,7 +10639,7 @@ func (ec *executionContext) unmarshalInputNewBugInput(ctx context.Context, obj i
}
case "files":
var err error
- it.Files, err = ec.unmarshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, v)
+ it.Files, err = ec.unmarshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHashᚄ(ctx, v)
if err != nil {
return it, err
}
@@ -11110,83 +10719,155 @@ func (ec *executionContext) unmarshalInputSetTitleInput(ctx context.Context, obj
// region ************************** interface.gotpl ***************************
-func (ec *executionContext) _Authored(ctx context.Context, sel ast.SelectionSet, obj *models.Authored) graphql.Marshaler {
- switch obj := (*obj).(type) {
+func (ec *executionContext) _Authored(ctx context.Context, sel ast.SelectionSet, obj models.Authored) graphql.Marshaler {
+ switch obj := (obj).(type) {
case nil:
return graphql.Null
case bug.Comment:
return ec._Comment(ctx, sel, &obj)
case *bug.Comment:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._Comment(ctx, sel, obj)
case *bug.Snapshot:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._Bug(ctx, sel, obj)
case *bug.CreateOperation:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._CreateOperation(ctx, sel, obj)
case *bug.SetTitleOperation:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._SetTitleOperation(ctx, sel, obj)
case *bug.AddCommentOperation:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._AddCommentOperation(ctx, sel, obj)
case *bug.EditCommentOperation:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._EditCommentOperation(ctx, sel, obj)
case *bug.SetStatusOperation:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._SetStatusOperation(ctx, sel, obj)
case *bug.LabelChangeOperation:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._LabelChangeOperation(ctx, sel, obj)
case *bug.CreateTimelineItem:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._CreateTimelineItem(ctx, sel, obj)
case *bug.AddCommentTimelineItem:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._AddCommentTimelineItem(ctx, sel, obj)
case *bug.LabelChangeTimelineItem:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._LabelChangeTimelineItem(ctx, sel, obj)
case *bug.SetStatusTimelineItem:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._SetStatusTimelineItem(ctx, sel, obj)
case *bug.SetTitleTimelineItem:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._SetTitleTimelineItem(ctx, sel, obj)
default:
panic(fmt.Errorf("unexpected type %T", obj))
}
}
-func (ec *executionContext) _Operation(ctx context.Context, sel ast.SelectionSet, obj *bug.Operation) graphql.Marshaler {
- switch obj := (*obj).(type) {
+func (ec *executionContext) _Operation(ctx context.Context, sel ast.SelectionSet, obj bug.Operation) graphql.Marshaler {
+ switch obj := (obj).(type) {
case nil:
return graphql.Null
case *bug.CreateOperation:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._CreateOperation(ctx, sel, obj)
case *bug.SetTitleOperation:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._SetTitleOperation(ctx, sel, obj)
case *bug.AddCommentOperation:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._AddCommentOperation(ctx, sel, obj)
case *bug.EditCommentOperation:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._EditCommentOperation(ctx, sel, obj)
case *bug.SetStatusOperation:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._SetStatusOperation(ctx, sel, obj)
case *bug.LabelChangeOperation:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._LabelChangeOperation(ctx, sel, obj)
default:
panic(fmt.Errorf("unexpected type %T", obj))
}
}
-func (ec *executionContext) _TimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.TimelineItem) graphql.Marshaler {
- switch obj := (*obj).(type) {
+func (ec *executionContext) _TimelineItem(ctx context.Context, sel ast.SelectionSet, obj bug.TimelineItem) graphql.Marshaler {
+ switch obj := (obj).(type) {
case nil:
return graphql.Null
case *bug.CreateTimelineItem:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._CreateTimelineItem(ctx, sel, obj)
case *bug.AddCommentTimelineItem:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._AddCommentTimelineItem(ctx, sel, obj)
case bug.LabelChangeTimelineItem:
return ec._LabelChangeTimelineItem(ctx, sel, &obj)
case *bug.LabelChangeTimelineItem:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._LabelChangeTimelineItem(ctx, sel, obj)
case bug.SetStatusTimelineItem:
return ec._SetStatusTimelineItem(ctx, sel, &obj)
case *bug.SetStatusTimelineItem:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._SetStatusTimelineItem(ctx, sel, obj)
case bug.SetTitleTimelineItem:
return ec._SetTitleTimelineItem(ctx, sel, &obj)
case *bug.SetTitleTimelineItem:
+ if obj == nil {
+ return graphql.Null
+ }
return ec._SetTitleTimelineItem(ctx, sel, obj)
default:
panic(fmt.Errorf("unexpected type %T", obj))
@@ -11200,7 +10881,7 @@ func (ec *executionContext) _TimelineItem(ctx context.Context, sel ast.Selection
var addCommentOperationImplementors = []string{"AddCommentOperation", "Operation", "Authored"}
func (ec *executionContext) _AddCommentOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.AddCommentOperation) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, addCommentOperationImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, addCommentOperationImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11265,7 +10946,7 @@ func (ec *executionContext) _AddCommentOperation(ctx context.Context, sel ast.Se
var addCommentPayloadImplementors = []string{"AddCommentPayload"}
func (ec *executionContext) _AddCommentPayload(ctx context.Context, sel ast.SelectionSet, obj *models.AddCommentPayload) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, addCommentPayloadImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, addCommentPayloadImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11299,7 +10980,7 @@ func (ec *executionContext) _AddCommentPayload(ctx context.Context, sel ast.Sele
var addCommentTimelineItemImplementors = []string{"AddCommentTimelineItem", "TimelineItem", "Authored"}
func (ec *executionContext) _AddCommentTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.AddCommentTimelineItem) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, addCommentTimelineItemImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, addCommentTimelineItemImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11393,7 +11074,7 @@ func (ec *executionContext) _AddCommentTimelineItem(ctx context.Context, sel ast
var bugImplementors = []string{"Bug", "Authored"}
func (ec *executionContext) _Bug(ctx context.Context, sel ast.SelectionSet, obj *bug.Snapshot) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, bugImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, bugImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11561,7 +11242,7 @@ func (ec *executionContext) _Bug(ctx context.Context, sel ast.SelectionSet, obj
var bugConnectionImplementors = []string{"BugConnection"}
func (ec *executionContext) _BugConnection(ctx context.Context, sel ast.SelectionSet, obj *models.BugConnection) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, bugConnectionImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, bugConnectionImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11603,7 +11284,7 @@ func (ec *executionContext) _BugConnection(ctx context.Context, sel ast.Selectio
var bugEdgeImplementors = []string{"BugEdge"}
func (ec *executionContext) _BugEdge(ctx context.Context, sel ast.SelectionSet, obj *models.BugEdge) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, bugEdgeImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, bugEdgeImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11635,7 +11316,7 @@ func (ec *executionContext) _BugEdge(ctx context.Context, sel ast.SelectionSet,
var changeLabelPayloadImplementors = []string{"ChangeLabelPayload"}
func (ec *executionContext) _ChangeLabelPayload(ctx context.Context, sel ast.SelectionSet, obj *models.ChangeLabelPayload) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, changeLabelPayloadImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, changeLabelPayloadImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11674,7 +11355,7 @@ func (ec *executionContext) _ChangeLabelPayload(ctx context.Context, sel ast.Sel
var closeBugPayloadImplementors = []string{"CloseBugPayload"}
func (ec *executionContext) _CloseBugPayload(ctx context.Context, sel ast.SelectionSet, obj *models.CloseBugPayload) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, closeBugPayloadImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, closeBugPayloadImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11708,7 +11389,7 @@ func (ec *executionContext) _CloseBugPayload(ctx context.Context, sel ast.Select
var colorImplementors = []string{"Color"}
func (ec *executionContext) _Color(ctx context.Context, sel ast.SelectionSet, obj *color.RGBA) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, colorImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, colorImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11772,7 +11453,7 @@ func (ec *executionContext) _Color(ctx context.Context, sel ast.SelectionSet, ob
var commentImplementors = []string{"Comment", "Authored"}
func (ec *executionContext) _Comment(ctx context.Context, sel ast.SelectionSet, obj *bug.Comment) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, commentImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, commentImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11809,7 +11490,7 @@ func (ec *executionContext) _Comment(ctx context.Context, sel ast.SelectionSet,
var commentConnectionImplementors = []string{"CommentConnection"}
func (ec *executionContext) _CommentConnection(ctx context.Context, sel ast.SelectionSet, obj *models.CommentConnection) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, commentConnectionImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, commentConnectionImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11851,7 +11532,7 @@ func (ec *executionContext) _CommentConnection(ctx context.Context, sel ast.Sele
var commentEdgeImplementors = []string{"CommentEdge"}
func (ec *executionContext) _CommentEdge(ctx context.Context, sel ast.SelectionSet, obj *models.CommentEdge) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, commentEdgeImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, commentEdgeImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11883,7 +11564,7 @@ func (ec *executionContext) _CommentEdge(ctx context.Context, sel ast.SelectionS
var commentHistoryStepImplementors = []string{"CommentHistoryStep"}
func (ec *executionContext) _CommentHistoryStep(ctx context.Context, sel ast.SelectionSet, obj *bug.CommentHistoryStep) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, commentHistoryStepImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, commentHistoryStepImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11924,7 +11605,7 @@ func (ec *executionContext) _CommentHistoryStep(ctx context.Context, sel ast.Sel
var commitAsNeededPayloadImplementors = []string{"CommitAsNeededPayload"}
func (ec *executionContext) _CommitAsNeededPayload(ctx context.Context, sel ast.SelectionSet, obj *models.CommitAsNeededPayload) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, commitAsNeededPayloadImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, commitAsNeededPayloadImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11953,7 +11634,7 @@ func (ec *executionContext) _CommitAsNeededPayload(ctx context.Context, sel ast.
var commitPayloadImplementors = []string{"CommitPayload"}
func (ec *executionContext) _CommitPayload(ctx context.Context, sel ast.SelectionSet, obj *models.CommitPayload) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, commitPayloadImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, commitPayloadImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -11982,7 +11663,7 @@ func (ec *executionContext) _CommitPayload(ctx context.Context, sel ast.Selectio
var createOperationImplementors = []string{"CreateOperation", "Operation", "Authored"}
func (ec *executionContext) _CreateOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.CreateOperation) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, createOperationImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, createOperationImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12052,7 +11733,7 @@ func (ec *executionContext) _CreateOperation(ctx context.Context, sel ast.Select
var createTimelineItemImplementors = []string{"CreateTimelineItem", "TimelineItem", "Authored"}
func (ec *executionContext) _CreateTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.CreateTimelineItem) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, createTimelineItemImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, createTimelineItemImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12146,7 +11827,7 @@ func (ec *executionContext) _CreateTimelineItem(ctx context.Context, sel ast.Sel
var editCommentOperationImplementors = []string{"EditCommentOperation", "Operation", "Authored"}
func (ec *executionContext) _EditCommentOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.EditCommentOperation) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, editCommentOperationImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, editCommentOperationImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12224,8 +11905,8 @@ func (ec *executionContext) _EditCommentOperation(ctx context.Context, sel ast.S
var identityImplementors = []string{"Identity"}
-func (ec *executionContext) _Identity(ctx context.Context, sel ast.SelectionSet, obj *identity.Interface) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, identityImplementors)
+func (ec *executionContext) _Identity(ctx context.Context, sel ast.SelectionSet, obj identity.Interface) graphql.Marshaler {
+ fields := graphql.CollectFields(ec.OperationContext, sel, identityImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12262,77 +11943,23 @@ func (ec *executionContext) _Identity(ctx context.Context, sel ast.SelectionSet,
return res
})
case "name":
- field := field
- out.Concurrently(i, func() (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Identity_name(ctx, field, obj)
- return res
- })
+ out.Values[i] = ec._Identity_name(ctx, field, obj)
case "email":
- field := field
- out.Concurrently(i, func() (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Identity_email(ctx, field, obj)
- return res
- })
+ out.Values[i] = ec._Identity_email(ctx, field, obj)
case "login":
- field := field
- out.Concurrently(i, func() (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Identity_login(ctx, field, obj)
- return res
- })
+ out.Values[i] = ec._Identity_login(ctx, field, obj)
case "displayName":
- field := field
- out.Concurrently(i, func() (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Identity_displayName(ctx, field, obj)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- })
+ out.Values[i] = ec._Identity_displayName(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
case "avatarUrl":
- field := field
- out.Concurrently(i, func() (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Identity_avatarUrl(ctx, field, obj)
- return res
- })
+ out.Values[i] = ec._Identity_avatarUrl(ctx, field, obj)
case "isProtected":
- field := field
- out.Concurrently(i, func() (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._Identity_isProtected(ctx, field, obj)
- if res == graphql.Null {
- atomic.AddUint32(&invalids, 1)
- }
- return res
- })
+ out.Values[i] = ec._Identity_isProtected(ctx, field, obj)
+ if out.Values[i] == graphql.Null {
+ atomic.AddUint32(&invalids, 1)
+ }
default:
panic("unknown field " + strconv.Quote(field.Name))
}
@@ -12347,7 +11974,7 @@ func (ec *executionContext) _Identity(ctx context.Context, sel ast.SelectionSet,
var identityConnectionImplementors = []string{"IdentityConnection"}
func (ec *executionContext) _IdentityConnection(ctx context.Context, sel ast.SelectionSet, obj *models.IdentityConnection) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, identityConnectionImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, identityConnectionImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12389,7 +12016,7 @@ func (ec *executionContext) _IdentityConnection(ctx context.Context, sel ast.Sel
var identityEdgeImplementors = []string{"IdentityEdge"}
func (ec *executionContext) _IdentityEdge(ctx context.Context, sel ast.SelectionSet, obj *models.IdentityEdge) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, identityEdgeImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, identityEdgeImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12421,7 +12048,7 @@ func (ec *executionContext) _IdentityEdge(ctx context.Context, sel ast.Selection
var labelImplementors = []string{"Label"}
func (ec *executionContext) _Label(ctx context.Context, sel ast.SelectionSet, obj *bug.Label) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, labelImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, labelImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12471,7 +12098,7 @@ func (ec *executionContext) _Label(ctx context.Context, sel ast.SelectionSet, ob
var labelChangeOperationImplementors = []string{"LabelChangeOperation", "Operation", "Authored"}
func (ec *executionContext) _LabelChangeOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.LabelChangeOperation) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, labelChangeOperationImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, labelChangeOperationImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12536,7 +12163,7 @@ func (ec *executionContext) _LabelChangeOperation(ctx context.Context, sel ast.S
var labelChangeResultImplementors = []string{"LabelChangeResult"}
func (ec *executionContext) _LabelChangeResult(ctx context.Context, sel ast.SelectionSet, obj *bug.LabelChangeResult) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, labelChangeResultImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, labelChangeResultImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12577,7 +12204,7 @@ func (ec *executionContext) _LabelChangeResult(ctx context.Context, sel ast.Sele
var labelChangeTimelineItemImplementors = []string{"LabelChangeTimelineItem", "TimelineItem", "Authored"}
func (ec *executionContext) _LabelChangeTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.LabelChangeTimelineItem) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, labelChangeTimelineItemImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, labelChangeTimelineItemImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12642,7 +12269,7 @@ func (ec *executionContext) _LabelChangeTimelineItem(ctx context.Context, sel as
var labelConnectionImplementors = []string{"LabelConnection"}
func (ec *executionContext) _LabelConnection(ctx context.Context, sel ast.SelectionSet, obj *models.LabelConnection) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, labelConnectionImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, labelConnectionImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12684,7 +12311,7 @@ func (ec *executionContext) _LabelConnection(ctx context.Context, sel ast.Select
var labelEdgeImplementors = []string{"LabelEdge"}
func (ec *executionContext) _LabelEdge(ctx context.Context, sel ast.SelectionSet, obj *models.LabelEdge) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, labelEdgeImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, labelEdgeImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12716,9 +12343,9 @@ func (ec *executionContext) _LabelEdge(ctx context.Context, sel ast.SelectionSet
var mutationImplementors = []string{"Mutation"}
func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, mutationImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors)
- ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{
+ ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{
Object: "Mutation",
})
@@ -12782,7 +12409,7 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet)
var newBugPayloadImplementors = []string{"NewBugPayload"}
func (ec *executionContext) _NewBugPayload(ctx context.Context, sel ast.SelectionSet, obj *models.NewBugPayload) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, newBugPayloadImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, newBugPayloadImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12816,7 +12443,7 @@ func (ec *executionContext) _NewBugPayload(ctx context.Context, sel ast.Selectio
var openBugPayloadImplementors = []string{"OpenBugPayload"}
func (ec *executionContext) _OpenBugPayload(ctx context.Context, sel ast.SelectionSet, obj *models.OpenBugPayload) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, openBugPayloadImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, openBugPayloadImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12850,7 +12477,7 @@ func (ec *executionContext) _OpenBugPayload(ctx context.Context, sel ast.Selecti
var operationConnectionImplementors = []string{"OperationConnection"}
func (ec *executionContext) _OperationConnection(ctx context.Context, sel ast.SelectionSet, obj *models.OperationConnection) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, operationConnectionImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, operationConnectionImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12892,7 +12519,7 @@ func (ec *executionContext) _OperationConnection(ctx context.Context, sel ast.Se
var operationEdgeImplementors = []string{"OperationEdge"}
func (ec *executionContext) _OperationEdge(ctx context.Context, sel ast.SelectionSet, obj *models.OperationEdge) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, operationEdgeImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, operationEdgeImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12924,7 +12551,7 @@ func (ec *executionContext) _OperationEdge(ctx context.Context, sel ast.Selectio
var pageInfoImplementors = []string{"PageInfo"}
func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet, obj *models.PageInfo) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, pageInfoImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, pageInfoImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -12966,9 +12593,9 @@ func (ec *executionContext) _PageInfo(ctx context.Context, sel ast.SelectionSet,
var queryImplementors = []string{"Query"}
func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, queryImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors)
- ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{
+ ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{
Object: "Query",
})
@@ -13018,7 +12645,7 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr
var repositoryImplementors = []string{"Repository"}
func (ec *executionContext) _Repository(ctx context.Context, sel ast.SelectionSet, obj *models.Repository) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, repositoryImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, repositoryImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13115,7 +12742,7 @@ func (ec *executionContext) _Repository(ctx context.Context, sel ast.SelectionSe
var setStatusOperationImplementors = []string{"SetStatusOperation", "Operation", "Authored"}
func (ec *executionContext) _SetStatusOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.SetStatusOperation) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, setStatusOperationImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, setStatusOperationImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13184,7 +12811,7 @@ func (ec *executionContext) _SetStatusOperation(ctx context.Context, sel ast.Sel
var setStatusTimelineItemImplementors = []string{"SetStatusTimelineItem", "TimelineItem", "Authored"}
func (ec *executionContext) _SetStatusTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.SetStatusTimelineItem) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, setStatusTimelineItemImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, setStatusTimelineItemImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13253,7 +12880,7 @@ func (ec *executionContext) _SetStatusTimelineItem(ctx context.Context, sel ast.
var setTitleOperationImplementors = []string{"SetTitleOperation", "Operation", "Authored"}
func (ec *executionContext) _SetTitleOperation(ctx context.Context, sel ast.SelectionSet, obj *bug.SetTitleOperation) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, setTitleOperationImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, setTitleOperationImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13318,7 +12945,7 @@ func (ec *executionContext) _SetTitleOperation(ctx context.Context, sel ast.Sele
var setTitlePayloadImplementors = []string{"SetTitlePayload"}
func (ec *executionContext) _SetTitlePayload(ctx context.Context, sel ast.SelectionSet, obj *models.SetTitlePayload) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, setTitlePayloadImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, setTitlePayloadImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13352,7 +12979,7 @@ func (ec *executionContext) _SetTitlePayload(ctx context.Context, sel ast.Select
var setTitleTimelineItemImplementors = []string{"SetTitleTimelineItem", "TimelineItem", "Authored"}
func (ec *executionContext) _SetTitleTimelineItem(ctx context.Context, sel ast.SelectionSet, obj *bug.SetTitleTimelineItem) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, setTitleTimelineItemImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, setTitleTimelineItemImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13417,7 +13044,7 @@ func (ec *executionContext) _SetTitleTimelineItem(ctx context.Context, sel ast.S
var timelineItemConnectionImplementors = []string{"TimelineItemConnection"}
func (ec *executionContext) _TimelineItemConnection(ctx context.Context, sel ast.SelectionSet, obj *models.TimelineItemConnection) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, timelineItemConnectionImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, timelineItemConnectionImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13459,7 +13086,7 @@ func (ec *executionContext) _TimelineItemConnection(ctx context.Context, sel ast
var timelineItemEdgeImplementors = []string{"TimelineItemEdge"}
func (ec *executionContext) _TimelineItemEdge(ctx context.Context, sel ast.SelectionSet, obj *models.TimelineItemEdge) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, timelineItemEdgeImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, timelineItemEdgeImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13491,7 +13118,7 @@ func (ec *executionContext) _TimelineItemEdge(ctx context.Context, sel ast.Selec
var __DirectiveImplementors = []string{"__Directive"}
func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, __DirectiveImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13530,7 +13157,7 @@ func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionS
var __EnumValueImplementors = []string{"__EnumValue"}
func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, __EnumValueImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13566,7 +13193,7 @@ func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionS
var __FieldImplementors = []string{"__Field"}
func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, __FieldImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13612,7 +13239,7 @@ func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet,
var __InputValueImplementors = []string{"__InputValue"}
func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, __InputValueImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13648,7 +13275,7 @@ func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.Selection
var __SchemaImplementors = []string{"__Schema"}
func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, __SchemaImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13689,7 +13316,7 @@ func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet,
var __TypeImplementors = []string{"__Type"}
func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, __TypeImplementors)
+ fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors)
out := graphql.NewFieldSet(fields)
var invalids uint32
@@ -13743,7 +13370,7 @@ func (ec *executionContext) marshalNAddCommentOperation2githubᚗcomᚋMichaelMu
func (ec *executionContext) marshalNAddCommentOperation2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐAddCommentOperation(ctx context.Context, sel ast.SelectionSet, v *bug.AddCommentOperation) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -13757,7 +13384,7 @@ func (ec *executionContext) marshalNAddCommentPayload2githubᚗcomᚋMichaelMure
func (ec *executionContext) marshalNAddCommentPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐAddCommentPayload(ctx context.Context, sel ast.SelectionSet, v *models.AddCommentPayload) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -13772,7 +13399,7 @@ func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interf
func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler {
res := graphql.MarshalBoolean(v)
if res == graphql.Null {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
}
@@ -13783,7 +13410,7 @@ func (ec *executionContext) marshalNBug2githubᚗcomᚋMichaelMureᚋgitᚑbug
return ec._Bug(ctx, sel, &v)
}
-func (ec *executionContext) marshalNBug2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx context.Context, sel ast.SelectionSet, v []*bug.Snapshot) graphql.Marshaler {
+func (ec *executionContext) marshalNBug2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshotᚄ(ctx context.Context, sel ast.SelectionSet, v []*bug.Snapshot) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -13792,11 +13419,11 @@ func (ec *executionContext) marshalNBug2ᚕᚖgithubᚗcomᚋMichaelMureᚋgit
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -13822,7 +13449,7 @@ func (ec *executionContext) marshalNBug2ᚕᚖgithubᚗcomᚋMichaelMureᚋgit
func (ec *executionContext) marshalNBug2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSnapshot(ctx context.Context, sel ast.SelectionSet, v *bug.Snapshot) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -13836,7 +13463,7 @@ func (ec *executionContext) marshalNBugConnection2githubᚗcomᚋMichaelMureᚋg
func (ec *executionContext) marshalNBugConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugConnection(ctx context.Context, sel ast.SelectionSet, v *models.BugConnection) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -13848,7 +13475,7 @@ func (ec *executionContext) marshalNBugEdge2githubᚗcomᚋMichaelMureᚋgitᚑb
return ec._BugEdge(ctx, sel, &v)
}
-func (ec *executionContext) marshalNBugEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugEdge(ctx context.Context, sel ast.SelectionSet, v []*models.BugEdge) graphql.Marshaler {
+func (ec *executionContext) marshalNBugEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*models.BugEdge) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -13857,11 +13484,11 @@ func (ec *executionContext) marshalNBugEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋg
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -13887,7 +13514,7 @@ func (ec *executionContext) marshalNBugEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋg
func (ec *executionContext) marshalNBugEdge2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐBugEdge(ctx context.Context, sel ast.SelectionSet, v *models.BugEdge) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -13901,7 +13528,7 @@ func (ec *executionContext) marshalNChangeLabelPayload2githubᚗcomᚋMichaelMur
func (ec *executionContext) marshalNChangeLabelPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐChangeLabelPayload(ctx context.Context, sel ast.SelectionSet, v *models.ChangeLabelPayload) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -13919,7 +13546,7 @@ func (ec *executionContext) marshalNCloseBugPayload2githubᚗcomᚋMichaelMure
func (ec *executionContext) marshalNCloseBugPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCloseBugPayload(ctx context.Context, sel ast.SelectionSet, v *models.CloseBugPayload) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -13933,7 +13560,7 @@ func (ec *executionContext) marshalNColor2imageᚋcolorᚐRGBA(ctx context.Conte
func (ec *executionContext) marshalNColor2ᚖimageᚋcolorᚐRGBA(ctx context.Context, sel ast.SelectionSet, v *color.RGBA) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -13945,7 +13572,7 @@ func (ec *executionContext) marshalNComment2githubᚗcomᚋMichaelMureᚋgitᚑb
return ec._Comment(ctx, sel, &v)
}
-func (ec *executionContext) marshalNComment2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐComment(ctx context.Context, sel ast.SelectionSet, v []*bug.Comment) graphql.Marshaler {
+func (ec *executionContext) marshalNComment2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentᚄ(ctx context.Context, sel ast.SelectionSet, v []*bug.Comment) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -13954,11 +13581,11 @@ func (ec *executionContext) marshalNComment2ᚕᚖgithubᚗcomᚋMichaelMureᚋg
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -13984,7 +13611,7 @@ func (ec *executionContext) marshalNComment2ᚕᚖgithubᚗcomᚋMichaelMureᚋg
func (ec *executionContext) marshalNComment2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐComment(ctx context.Context, sel ast.SelectionSet, v *bug.Comment) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -13998,7 +13625,7 @@ func (ec *executionContext) marshalNCommentConnection2githubᚗcomᚋMichaelMure
func (ec *executionContext) marshalNCommentConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentConnection(ctx context.Context, sel ast.SelectionSet, v *models.CommentConnection) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14010,7 +13637,7 @@ func (ec *executionContext) marshalNCommentEdge2githubᚗcomᚋMichaelMureᚋgit
return ec._CommentEdge(ctx, sel, &v)
}
-func (ec *executionContext) marshalNCommentEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentEdge(ctx context.Context, sel ast.SelectionSet, v []*models.CommentEdge) graphql.Marshaler {
+func (ec *executionContext) marshalNCommentEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*models.CommentEdge) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14019,11 +13646,11 @@ func (ec *executionContext) marshalNCommentEdge2ᚕᚖgithubᚗcomᚋMichaelMure
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14049,7 +13676,7 @@ func (ec *executionContext) marshalNCommentEdge2ᚕᚖgithubᚗcomᚋMichaelMure
func (ec *executionContext) marshalNCommentEdge2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommentEdge(ctx context.Context, sel ast.SelectionSet, v *models.CommentEdge) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14061,7 +13688,7 @@ func (ec *executionContext) marshalNCommentHistoryStep2githubᚗcomᚋMichaelMur
return ec._CommentHistoryStep(ctx, sel, &v)
}
-func (ec *executionContext) marshalNCommentHistoryStep2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentHistoryStep(ctx context.Context, sel ast.SelectionSet, v []bug.CommentHistoryStep) graphql.Marshaler {
+func (ec *executionContext) marshalNCommentHistoryStep2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCommentHistoryStepᚄ(ctx context.Context, sel ast.SelectionSet, v []bug.CommentHistoryStep) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14070,11 +13697,11 @@ func (ec *executionContext) marshalNCommentHistoryStep2ᚕgithubᚗcomᚋMichael
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14108,7 +13735,7 @@ func (ec *executionContext) marshalNCommitAsNeededPayload2githubᚗcomᚋMichael
func (ec *executionContext) marshalNCommitAsNeededPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitAsNeededPayload(ctx context.Context, sel ast.SelectionSet, v *models.CommitAsNeededPayload) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14126,7 +13753,7 @@ func (ec *executionContext) marshalNCommitPayload2githubᚗcomᚋMichaelMureᚋg
func (ec *executionContext) marshalNCommitPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐCommitPayload(ctx context.Context, sel ast.SelectionSet, v *models.CommitPayload) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14140,7 +13767,7 @@ func (ec *executionContext) marshalNCreateOperation2githubᚗcomᚋMichaelMure
func (ec *executionContext) marshalNCreateOperation2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐCreateOperation(ctx context.Context, sel ast.SelectionSet, v *bug.CreateOperation) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14157,7 +13784,7 @@ func (ec *executionContext) marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbug
return v
}
-func (ec *executionContext) unmarshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx context.Context, v interface{}) ([]git.Hash, error) {
+func (ec *executionContext) unmarshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHashᚄ(ctx context.Context, v interface{}) ([]git.Hash, error) {
var vSlice []interface{}
if v != nil {
if tmp1, ok := v.([]interface{}); ok {
@@ -14177,7 +13804,7 @@ func (ec *executionContext) unmarshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgit
return res, nil
}
-func (ec *executionContext) marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx context.Context, sel ast.SelectionSet, v []git.Hash) graphql.Marshaler {
+func (ec *executionContext) marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHashᚄ(ctx context.Context, sel ast.SelectionSet, v []git.Hash) graphql.Marshaler {
ret := make(graphql.Array, len(v))
for i := range v {
ret[i] = ec.marshalNHash2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx, sel, v[i])
@@ -14187,10 +13814,16 @@ func (ec *executionContext) marshalNHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑb
}
func (ec *executionContext) marshalNIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx context.Context, sel ast.SelectionSet, v identity.Interface) graphql.Marshaler {
- return ec._Identity(ctx, sel, &v)
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ return ec._Identity(ctx, sel, v)
}
-func (ec *executionContext) marshalNIdentity2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx context.Context, sel ast.SelectionSet, v []identity.Interface) graphql.Marshaler {
+func (ec *executionContext) marshalNIdentity2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterfaceᚄ(ctx context.Context, sel ast.SelectionSet, v []identity.Interface) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14199,11 +13832,11 @@ func (ec *executionContext) marshalNIdentity2ᚕgithubᚗcomᚋMichaelMureᚋgit
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14233,7 +13866,7 @@ func (ec *executionContext) marshalNIdentityConnection2githubᚗcomᚋMichaelMur
func (ec *executionContext) marshalNIdentityConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityConnection(ctx context.Context, sel ast.SelectionSet, v *models.IdentityConnection) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14245,7 +13878,7 @@ func (ec *executionContext) marshalNIdentityEdge2githubᚗcomᚋMichaelMureᚋgi
return ec._IdentityEdge(ctx, sel, &v)
}
-func (ec *executionContext) marshalNIdentityEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityEdge(ctx context.Context, sel ast.SelectionSet, v []*models.IdentityEdge) graphql.Marshaler {
+func (ec *executionContext) marshalNIdentityEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*models.IdentityEdge) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14254,11 +13887,11 @@ func (ec *executionContext) marshalNIdentityEdge2ᚕᚖgithubᚗcomᚋMichaelMur
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14284,7 +13917,7 @@ func (ec *executionContext) marshalNIdentityEdge2ᚕᚖgithubᚗcomᚋMichaelMur
func (ec *executionContext) marshalNIdentityEdge2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐIdentityEdge(ctx context.Context, sel ast.SelectionSet, v *models.IdentityEdge) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14299,7 +13932,7 @@ func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}
func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler {
res := graphql.MarshalInt(v)
if res == graphql.Null {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
}
@@ -14310,7 +13943,7 @@ func (ec *executionContext) marshalNLabel2githubᚗcomᚋMichaelMureᚋgitᚑbug
return ec._Label(ctx, sel, &v)
}
-func (ec *executionContext) marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabel(ctx context.Context, sel ast.SelectionSet, v []bug.Label) graphql.Marshaler {
+func (ec *executionContext) marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabelᚄ(ctx context.Context, sel ast.SelectionSet, v []bug.Label) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14319,11 +13952,11 @@ func (ec *executionContext) marshalNLabel2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑ
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14353,7 +13986,7 @@ func (ec *executionContext) marshalNLabelChangeOperation2githubᚗcomᚋMichaelM
func (ec *executionContext) marshalNLabelChangeOperation2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐLabelChangeOperation(ctx context.Context, sel ast.SelectionSet, v *bug.LabelChangeOperation) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14370,11 +14003,11 @@ func (ec *executionContext) marshalNLabelChangeResult2ᚕᚖgithubᚗcomᚋMicha
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14413,7 +14046,7 @@ func (ec *executionContext) marshalNLabelConnection2githubᚗcomᚋMichaelMure
func (ec *executionContext) marshalNLabelConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐLabelConnection(ctx context.Context, sel ast.SelectionSet, v *models.LabelConnection) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14425,7 +14058,7 @@ func (ec *executionContext) marshalNLabelEdge2githubᚗcomᚋMichaelMureᚋgit
return ec._LabelEdge(ctx, sel, &v)
}
-func (ec *executionContext) marshalNLabelEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐLabelEdge(ctx context.Context, sel ast.SelectionSet, v []*models.LabelEdge) graphql.Marshaler {
+func (ec *executionContext) marshalNLabelEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐLabelEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*models.LabelEdge) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14434,11 +14067,11 @@ func (ec *executionContext) marshalNLabelEdge2ᚕᚖgithubᚗcomᚋMichaelMure
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14464,7 +14097,7 @@ func (ec *executionContext) marshalNLabelEdge2ᚕᚖgithubᚗcomᚋMichaelMure
func (ec *executionContext) marshalNLabelEdge2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐLabelEdge(ctx context.Context, sel ast.SelectionSet, v *models.LabelEdge) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14482,7 +14115,7 @@ func (ec *executionContext) marshalNNewBugPayload2githubᚗcomᚋMichaelMureᚋg
func (ec *executionContext) marshalNNewBugPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐNewBugPayload(ctx context.Context, sel ast.SelectionSet, v *models.NewBugPayload) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14500,7 +14133,7 @@ func (ec *executionContext) marshalNOpenBugPayload2githubᚗcomᚋMichaelMureᚋ
func (ec *executionContext) marshalNOpenBugPayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOpenBugPayload(ctx context.Context, sel ast.SelectionSet, v *models.OpenBugPayload) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14509,10 +14142,16 @@ func (ec *executionContext) marshalNOpenBugPayload2ᚖgithubᚗcomᚋMichaelMure
}
func (ec *executionContext) marshalNOperation2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐOperation(ctx context.Context, sel ast.SelectionSet, v bug.Operation) graphql.Marshaler {
- return ec._Operation(ctx, sel, &v)
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ return ec._Operation(ctx, sel, v)
}
-func (ec *executionContext) marshalNOperation2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐOperation(ctx context.Context, sel ast.SelectionSet, v []bug.Operation) graphql.Marshaler {
+func (ec *executionContext) marshalNOperation2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐOperationᚄ(ctx context.Context, sel ast.SelectionSet, v []bug.Operation) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14521,11 +14160,11 @@ func (ec *executionContext) marshalNOperation2ᚕgithubᚗcomᚋMichaelMureᚋgi
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14555,7 +14194,7 @@ func (ec *executionContext) marshalNOperationConnection2githubᚗcomᚋMichaelMu
func (ec *executionContext) marshalNOperationConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationConnection(ctx context.Context, sel ast.SelectionSet, v *models.OperationConnection) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14567,7 +14206,7 @@ func (ec *executionContext) marshalNOperationEdge2githubᚗcomᚋMichaelMureᚋg
return ec._OperationEdge(ctx, sel, &v)
}
-func (ec *executionContext) marshalNOperationEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationEdge(ctx context.Context, sel ast.SelectionSet, v []*models.OperationEdge) graphql.Marshaler {
+func (ec *executionContext) marshalNOperationEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*models.OperationEdge) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14576,11 +14215,11 @@ func (ec *executionContext) marshalNOperationEdge2ᚕᚖgithubᚗcomᚋMichaelMu
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14606,7 +14245,7 @@ func (ec *executionContext) marshalNOperationEdge2ᚕᚖgithubᚗcomᚋMichaelMu
func (ec *executionContext) marshalNOperationEdge2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐOperationEdge(ctx context.Context, sel ast.SelectionSet, v *models.OperationEdge) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14620,7 +14259,7 @@ func (ec *executionContext) marshalNPageInfo2githubᚗcomᚋMichaelMureᚋgitᚑ
func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v *models.PageInfo) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14634,7 +14273,7 @@ func (ec *executionContext) marshalNSetStatusOperation2githubᚗcomᚋMichaelMur
func (ec *executionContext) marshalNSetStatusOperation2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSetStatusOperation(ctx context.Context, sel ast.SelectionSet, v *bug.SetStatusOperation) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14652,7 +14291,7 @@ func (ec *executionContext) marshalNSetTitleOperation2githubᚗcomᚋMichaelMure
func (ec *executionContext) marshalNSetTitleOperation2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐSetTitleOperation(ctx context.Context, sel ast.SelectionSet, v *bug.SetTitleOperation) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14666,7 +14305,7 @@ func (ec *executionContext) marshalNSetTitlePayload2githubᚗcomᚋMichaelMure
func (ec *executionContext) marshalNSetTitlePayload2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐSetTitlePayload(ctx context.Context, sel ast.SelectionSet, v *models.SetTitlePayload) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14690,7 +14329,7 @@ func (ec *executionContext) unmarshalNString2string(ctx context.Context, v inter
func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler {
res := graphql.MarshalString(v)
if res == graphql.Null {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
}
@@ -14704,7 +14343,7 @@ func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v in
func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler {
res := graphql.MarshalTime(v)
if res == graphql.Null {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
}
@@ -14721,7 +14360,7 @@ func (ec *executionContext) unmarshalNTime2ᚖtimeᚐTime(ctx context.Context, v
func (ec *executionContext) marshalNTime2ᚖtimeᚐTime(ctx context.Context, sel ast.SelectionSet, v *time.Time) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14730,10 +14369,16 @@ func (ec *executionContext) marshalNTime2ᚖtimeᚐTime(ctx context.Context, sel
}
func (ec *executionContext) marshalNTimelineItem2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐTimelineItem(ctx context.Context, sel ast.SelectionSet, v bug.TimelineItem) graphql.Marshaler {
- return ec._TimelineItem(ctx, sel, &v)
+ if v == nil {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
+ ec.Errorf(ctx, "must not be null")
+ }
+ return graphql.Null
+ }
+ return ec._TimelineItem(ctx, sel, v)
}
-func (ec *executionContext) marshalNTimelineItem2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐTimelineItem(ctx context.Context, sel ast.SelectionSet, v []bug.TimelineItem) graphql.Marshaler {
+func (ec *executionContext) marshalNTimelineItem2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋbugᚐTimelineItemᚄ(ctx context.Context, sel ast.SelectionSet, v []bug.TimelineItem) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14742,11 +14387,11 @@ func (ec *executionContext) marshalNTimelineItem2ᚕgithubᚗcomᚋMichaelMure
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14776,7 +14421,7 @@ func (ec *executionContext) marshalNTimelineItemConnection2githubᚗcomᚋMichae
func (ec *executionContext) marshalNTimelineItemConnection2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemConnection(ctx context.Context, sel ast.SelectionSet, v *models.TimelineItemConnection) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14788,7 +14433,7 @@ func (ec *executionContext) marshalNTimelineItemEdge2githubᚗcomᚋMichaelMure
return ec._TimelineItemEdge(ctx, sel, &v)
}
-func (ec *executionContext) marshalNTimelineItemEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemEdge(ctx context.Context, sel ast.SelectionSet, v []*models.TimelineItemEdge) graphql.Marshaler {
+func (ec *executionContext) marshalNTimelineItemEdge2ᚕᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*models.TimelineItemEdge) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14797,11 +14442,11 @@ func (ec *executionContext) marshalNTimelineItemEdge2ᚕᚖgithubᚗcomᚋMichae
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14827,7 +14472,7 @@ func (ec *executionContext) marshalNTimelineItemEdge2ᚕᚖgithubᚗcomᚋMichae
func (ec *executionContext) marshalNTimelineItemEdge2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋgraphqlᚋmodelsᚐTimelineItemEdge(ctx context.Context, sel ast.SelectionSet, v *models.TimelineItemEdge) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -14835,11 +14480,11 @@ func (ec *executionContext) marshalNTimelineItemEdge2ᚖgithubᚗcomᚋMichaelMu
return ec._TimelineItemEdge(ctx, sel, v)
}
-func (ec *executionContext) marshalN__Directive2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler {
+func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler {
return ec.___Directive(ctx, sel, &v)
}
-func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler {
+func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14848,11 +14493,11 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋMichaelMureᚋ
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14863,7 +14508,7 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋMichaelMureᚋ
if !isLen1 {
defer wg.Done()
}
- ret[i] = ec.marshalN__Directive2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i])
+ ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i])
}
if isLen1 {
f(i)
@@ -14883,14 +14528,14 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Con
func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler {
res := graphql.MarshalString(v)
if res == graphql.Null {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
}
return res
}
-func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstring(ctx context.Context, v interface{}) ([]string, error) {
+func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) {
var vSlice []interface{}
if v != nil {
if tmp1, ok := v.([]interface{}); ok {
@@ -14910,7 +14555,7 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstring(ctx context.
return res, nil
}
-func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
+func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14919,11 +14564,11 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14947,19 +14592,19 @@ func (ec *executionContext) marshalN__DirectiveLocation2ᚕstring(ctx context.Co
return ret
}
-func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler {
+func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler {
return ec.___EnumValue(ctx, sel, &v)
}
-func (ec *executionContext) marshalN__Field2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler {
+func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler {
return ec.___Field(ctx, sel, &v)
}
-func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler {
+func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler {
return ec.___InputValue(ctx, sel, &v)
}
-func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler {
+func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -14968,11 +14613,11 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋMichaelMure
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -14983,7 +14628,7 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋMichaelMure
if !isLen1 {
defer wg.Done()
}
- ret[i] = ec.marshalN__InputValue2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i])
+ ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i])
}
if isLen1 {
f(i)
@@ -14996,11 +14641,11 @@ func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋMichaelMure
return ret
}
-func (ec *executionContext) marshalN__Type2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler {
+func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler {
return ec.___Type(ctx, sel, &v)
}
-func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler {
+func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler {
ret := make(graphql.Array, len(v))
var wg sync.WaitGroup
isLen1 := len(v) == 1
@@ -15009,11 +14654,11 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋMichaelMureᚋgit
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -15024,7 +14669,7 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋMichaelMureᚋgit
if !isLen1 {
defer wg.Done()
}
- ret[i] = ec.marshalN__Type2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i])
+ ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i])
}
if isLen1 {
f(i)
@@ -15037,9 +14682,9 @@ func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋMichaelMureᚋgit
return ret
}
-func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler {
+func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler {
if v == nil {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
@@ -15054,7 +14699,7 @@ func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v i
func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler {
res := graphql.MarshalString(v)
if res == graphql.Null {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
+ if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
ec.Errorf(ctx, "must not be null")
}
}
@@ -15107,7 +14752,7 @@ func (ec *executionContext) unmarshalOChangeLabelInput2ᚖgithubᚗcomᚋMichael
return &res, err
}
-func (ec *executionContext) unmarshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx context.Context, v interface{}) ([]git.Hash, error) {
+func (ec *executionContext) unmarshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHashᚄ(ctx context.Context, v interface{}) ([]git.Hash, error) {
var vSlice []interface{}
if v != nil {
if tmp1, ok := v.([]interface{}); ok {
@@ -15127,7 +14772,7 @@ func (ec *executionContext) unmarshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgit
return res, nil
}
-func (ec *executionContext) marshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHash(ctx context.Context, sel ast.SelectionSet, v []git.Hash) graphql.Marshaler {
+func (ec *executionContext) marshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋutilᚋgitᚐHashᚄ(ctx context.Context, sel ast.SelectionSet, v []git.Hash) graphql.Marshaler {
if v == nil {
return graphql.Null
}
@@ -15140,7 +14785,10 @@ func (ec *executionContext) marshalOHash2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑb
}
func (ec *executionContext) marshalOIdentity2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋidentityᚐInterface(ctx context.Context, sel ast.SelectionSet, v identity.Interface) graphql.Marshaler {
- return ec._Identity(ctx, sel, &v)
+ if v == nil {
+ return graphql.Null
+ }
+ return ec._Identity(ctx, sel, v)
}
func (ec *executionContext) unmarshalOInt2int(ctx context.Context, v interface{}) (int, error) {
@@ -15196,7 +14844,7 @@ func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.S
return graphql.MarshalString(v)
}
-func (ec *executionContext) unmarshalOString2ᚕstring(ctx context.Context, v interface{}) ([]string, error) {
+func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) {
var vSlice []interface{}
if v != nil {
if tmp1, ok := v.([]interface{}); ok {
@@ -15216,7 +14864,7 @@ func (ec *executionContext) unmarshalOString2ᚕstring(ctx context.Context, v in
return res, nil
}
-func (ec *executionContext) marshalOString2ᚕstring(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
+func (ec *executionContext) marshalOString2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler {
if v == nil {
return graphql.Null
}
@@ -15243,7 +14891,7 @@ func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel as
return ec.marshalOString2string(ctx, sel, *v)
}
-func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler {
+func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler {
if v == nil {
return graphql.Null
}
@@ -15255,11 +14903,11 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋMichaelMureᚋ
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -15270,7 +14918,7 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋMichaelMureᚋ
if !isLen1 {
defer wg.Done()
}
- ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i])
+ ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i])
}
if isLen1 {
f(i)
@@ -15283,7 +14931,7 @@ func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋMichaelMureᚋ
return ret
}
-func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler {
+func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler {
if v == nil {
return graphql.Null
}
@@ -15295,11 +14943,11 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋMichaelMureᚋgit
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -15310,7 +14958,7 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋMichaelMureᚋgit
if !isLen1 {
defer wg.Done()
}
- ret[i] = ec.marshalN__Field2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i])
+ ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i])
}
if isLen1 {
f(i)
@@ -15323,7 +14971,7 @@ func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋMichaelMureᚋgit
return ret
}
-func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler {
+func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler {
if v == nil {
return graphql.Null
}
@@ -15335,11 +14983,11 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋMichaelMure
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -15350,7 +14998,7 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋMichaelMure
if !isLen1 {
defer wg.Done()
}
- ret[i] = ec.marshalN__InputValue2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i])
+ ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i])
}
if isLen1 {
f(i)
@@ -15363,22 +15011,22 @@ func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋMichaelMure
return ret
}
-func (ec *executionContext) marshalO__Schema2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v introspection.Schema) graphql.Marshaler {
+func (ec *executionContext) marshalO__Schema2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v introspection.Schema) graphql.Marshaler {
return ec.___Schema(ctx, sel, &v)
}
-func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler {
+func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler {
if v == nil {
return graphql.Null
}
return ec.___Schema(ctx, sel, v)
}
-func (ec *executionContext) marshalO__Type2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler {
+func (ec *executionContext) marshalO__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler {
return ec.___Type(ctx, sel, &v)
}
-func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler {
+func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler {
if v == nil {
return graphql.Null
}
@@ -15390,11 +15038,11 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋMichaelMureᚋgit
}
for i := range v {
i := i
- rctx := &graphql.ResolverContext{
+ fc := &graphql.FieldContext{
Index: &i,
Result: &v[i],
}
- ctx := graphql.WithResolverContext(ctx, rctx)
+ ctx := graphql.WithFieldContext(ctx, fc)
f := func(i int) {
defer func() {
if r := recover(); r != nil {
@@ -15405,7 +15053,7 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋMichaelMureᚋgit
if !isLen1 {
defer wg.Done()
}
- ret[i] = ec.marshalN__Type2githubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i])
+ ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i])
}
if isLen1 {
f(i)
@@ -15418,7 +15066,7 @@ func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋMichaelMureᚋgit
return ret
}
-func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋMichaelMureᚋgitᚑbugᚋvendorᚋgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler {
+func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler {
if v == nil {
return graphql.Null
}
diff --git a/graphql/graphql_test.go b/graphql/graphql_test.go
index 6784df96e6205ad8081d8737a5442aee3f12ea02..4bab7f5869f600237ee2b8f58b1fc1a7594abc91 100644
--- a/graphql/graphql_test.go
+++ b/graphql/graphql_test.go
@@ -1,10 +1,9 @@
package graphql
import (
- "net/http/httptest"
"testing"
- "github.com/vektah/gqlgen/client"
+ "github.com/99designs/gqlgen/client"
"github.com/MichaelMure/git-bug/graphql/models"
"github.com/MichaelMure/git-bug/misc/random_bugs"
@@ -22,8 +21,7 @@ func TestQueries(t *testing.T) {
t.Fatal(err)
}
- srv := httptest.NewServer(handler)
- c := client.New(srv.URL)
+ c := client.New(handler)
query := `
query {
diff --git a/graphql/handler.go b/graphql/handler.go
index aadcf4cbda7fa4b0df1141837b57c96d6355860f..55ef6fc49896f029bf35175550a6c3245c2c08bd 100644
--- a/graphql/handler.go
+++ b/graphql/handler.go
@@ -6,7 +6,8 @@ package graphql
import (
"net/http"
- "github.com/99designs/gqlgen/handler"
+ "github.com/99designs/gqlgen/graphql/handler"
+
"github.com/MichaelMure/git-bug/graphql/graph"
"github.com/MichaelMure/git-bug/graphql/resolvers"
"github.com/MichaelMure/git-bug/repository"
@@ -14,7 +15,7 @@ import (
// Handler is the root GraphQL http handler
type Handler struct {
- http.HandlerFunc
+ http.Handler
*resolvers.RootResolver
}
@@ -32,7 +33,7 @@ func NewHandler(repo repository.ClockedRepo) (Handler, error) {
Resolvers: h.RootResolver,
}
- h.HandlerFunc = handler.GraphQL(graph.NewExecutableSchema(config))
+ h.Handler = handler.NewDefaultServer(graph.NewExecutableSchema(config))
return h, nil
}
diff --git a/graphql/resolvers/identity.go b/graphql/resolvers/identity.go
index ee40d4d813dac99947a464834e9a8f2184d8f552..da8e7b08b9e0114a401e6595135a13e42bd7cc58 100644
--- a/graphql/resolvers/identity.go
+++ b/graphql/resolvers/identity.go
@@ -11,41 +11,10 @@ var _ graph.IdentityResolver = &identityResolver{}
type identityResolver struct{}
-func (identityResolver) ID(ctx context.Context, obj *identity.Interface) (string, error) {
- return (*obj).Id().String(), nil
+func (identityResolver) ID(ctx context.Context, obj identity.Interface) (string, error) {
+ return obj.Id().String(), nil
}
-func (identityResolver) HumanID(ctx context.Context, obj *identity.Interface) (string, error) {
- return (*obj).Id().Human(), nil
-}
-
-func (identityResolver) Name(ctx context.Context, obj *identity.Interface) (*string, error) {
- return nilIfEmpty((*obj).Name())
-}
-
-func (identityResolver) Email(ctx context.Context, obj *identity.Interface) (*string, error) {
- return nilIfEmpty((*obj).Email())
-}
-
-func (identityResolver) Login(ctx context.Context, obj *identity.Interface) (*string, error) {
- return nilIfEmpty((*obj).Login())
-}
-
-func (identityResolver) DisplayName(ctx context.Context, obj *identity.Interface) (string, error) {
- return (*obj).DisplayName(), nil
-}
-
-func (identityResolver) AvatarURL(ctx context.Context, obj *identity.Interface) (*string, error) {
- return nilIfEmpty((*obj).AvatarUrl())
-}
-
-func (identityResolver) IsProtected(ctx context.Context, obj *identity.Interface) (bool, error) {
- return (*obj).IsProtected(), nil
-}
-
-func nilIfEmpty(s string) (*string, error) {
- if s == "" {
- return nil, nil
- }
- return &s, nil
+func (identityResolver) HumanID(ctx context.Context, obj identity.Interface) (string, error) {
+ return obj.Id().Human(), nil
}
diff --git a/vendor/github.com/99designs/gqlgen/LICENSE b/vendor/github.com/99designs/gqlgen/LICENSE
deleted file mode 100644
index 18e1b249344fc28852b4906cda5568bad9b6f1e4..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2018 Adam Scarr
-
-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/99designs/gqlgen/api/generate.go b/vendor/github.com/99designs/gqlgen/api/generate.go
deleted file mode 100644
index 3256bdc3de11482b6bffecf5f679542e3dd11fc4..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/api/generate.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package api
-
-import (
- "syscall"
-
- "github.com/99designs/gqlgen/codegen"
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/plugin"
- "github.com/99designs/gqlgen/plugin/modelgen"
- "github.com/99designs/gqlgen/plugin/resolvergen"
- "github.com/99designs/gqlgen/plugin/schemaconfig"
- "github.com/pkg/errors"
- "golang.org/x/tools/go/packages"
-)
-
-func Generate(cfg *config.Config, option ...Option) error {
- _ = syscall.Unlink(cfg.Exec.Filename)
- _ = syscall.Unlink(cfg.Model.Filename)
-
- plugins := []plugin.Plugin{
- schemaconfig.New(),
- modelgen.New(),
- resolvergen.New(),
- }
-
- for _, o := range option {
- o(cfg, &plugins)
- }
-
- for _, p := range plugins {
- if mut, ok := p.(plugin.ConfigMutator); ok {
- err := mut.MutateConfig(cfg)
- if err != nil {
- return errors.Wrap(err, p.Name())
- }
- }
- }
- // Merge again now that the generated models have been injected into the typemap
- data, err := codegen.BuildData(cfg)
- if err != nil {
- return errors.Wrap(err, "merging failed")
- }
-
- if err = codegen.GenerateCode(data); err != nil {
- return errors.Wrap(err, "generating core failed")
- }
-
- for _, p := range plugins {
- if mut, ok := p.(plugin.CodeGenerator); ok {
- err := mut.GenerateCode(data)
- if err != nil {
- return errors.Wrap(err, p.Name())
- }
- }
- }
-
- if err := validate(cfg); err != nil {
- return errors.Wrap(err, "validation failed")
- }
-
- return nil
-}
-
-func validate(cfg *config.Config) error {
- roots := []string{cfg.Exec.ImportPath()}
- if cfg.Model.IsDefined() {
- roots = append(roots, cfg.Model.ImportPath())
- }
-
- if cfg.Resolver.IsDefined() {
- roots = append(roots, cfg.Resolver.ImportPath())
- }
- _, err := packages.Load(&packages.Config{Mode: packages.LoadTypes | packages.LoadSyntax}, roots...)
- if err != nil {
- return errors.Wrap(err, "validation failed")
- }
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/api/option.go b/vendor/github.com/99designs/gqlgen/api/option.go
deleted file mode 100644
index f7ba6774bd0c326106f25e43f05bcb11973d3287..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/api/option.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package api
-
-import (
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/plugin"
-)
-
-type Option func(cfg *config.Config, plugins *[]plugin.Plugin)
-
-func NoPlugins() Option {
- return func(cfg *config.Config, plugins *[]plugin.Plugin) {
- *plugins = nil
- }
-}
-
-func AddPlugin(p plugin.Plugin) Option {
- return func(cfg *config.Config, plugins *[]plugin.Plugin) {
- *plugins = append(*plugins, p)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/args.go b/vendor/github.com/99designs/gqlgen/codegen/args.go
deleted file mode 100644
index 1d3e51aa3ada4bea225e8c6391f32095a4634cfc..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/args.go
+++ /dev/null
@@ -1,120 +0,0 @@
-package codegen
-
-import (
- "fmt"
- "go/types"
- "strings"
-
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/pkg/errors"
- "github.com/vektah/gqlparser/ast"
-)
-
-type ArgSet struct {
- Args []*FieldArgument
- FuncDecl string
-}
-
-type FieldArgument struct {
- *ast.ArgumentDefinition
- TypeReference *config.TypeReference
- VarName string // The name of the var in go
- Object *Object // A link back to the parent object
- Default interface{} // The default value
- Directives []*Directive
- Value interface{} // value set in Data
-}
-
-//ImplDirectives get not Builtin and location ARGUMENT_DEFINITION directive
-func (f *FieldArgument) ImplDirectives() []*Directive {
- d := make([]*Directive, 0)
- for i := range f.Directives {
- if !f.Directives[i].Builtin && f.Directives[i].IsLocation(ast.LocationArgumentDefinition) {
- d = append(d, f.Directives[i])
- }
- }
-
- return d
-}
-
-func (f *FieldArgument) DirectiveObjName() string {
- return "rawArgs"
-}
-
-func (f *FieldArgument) Stream() bool {
- return f.Object != nil && f.Object.Stream
-}
-
-func (b *builder) buildArg(obj *Object, arg *ast.ArgumentDefinition) (*FieldArgument, error) {
- tr, err := b.Binder.TypeReference(arg.Type, nil)
- if err != nil {
- return nil, err
- }
-
- argDirs, err := b.getDirectives(arg.Directives)
- if err != nil {
- return nil, err
- }
- newArg := FieldArgument{
- ArgumentDefinition: arg,
- TypeReference: tr,
- Object: obj,
- VarName: templates.ToGoPrivate(arg.Name),
- Directives: argDirs,
- }
-
- if arg.DefaultValue != nil {
- newArg.Default, err = arg.DefaultValue.Value(nil)
- if err != nil {
- return nil, errors.Errorf("default value is not valid: %s", err.Error())
- }
- }
-
- return &newArg, nil
-}
-
-func (b *builder) bindArgs(field *Field, params *types.Tuple) error {
- var newArgs []*FieldArgument
-
-nextArg:
- for j := 0; j < params.Len(); j++ {
- param := params.At(j)
- for _, oldArg := range field.Args {
- if strings.EqualFold(oldArg.Name, param.Name()) {
- tr, err := b.Binder.TypeReference(oldArg.Type, param.Type())
- if err != nil {
- return err
- }
- oldArg.TypeReference = tr
-
- newArgs = append(newArgs, oldArg)
- continue nextArg
- }
- }
-
- // no matching arg found, abort
- return fmt.Errorf("arg %s not in schema", param.Name())
- }
-
- field.Args = newArgs
- return nil
-}
-
-func (a *Data) Args() map[string][]*FieldArgument {
- ret := map[string][]*FieldArgument{}
- for _, o := range a.Objects {
- for _, f := range o.Fields {
- if len(f.Args) > 0 {
- ret[f.ArgsFunc()] = f.Args
- }
- }
- }
-
- for _, d := range a.Directives {
- if len(d.Args) > 0 {
- ret[d.ArgsFunc()] = d.Args
- }
- }
- return ret
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/args.gotpl b/vendor/github.com/99designs/gqlgen/codegen/args.gotpl
deleted file mode 100644
index 318f1ff451bcaaf0d04bae33ec365e742998764a..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/args.gotpl
+++ /dev/null
@@ -1,35 +0,0 @@
-{{ range $name, $args := .Args }}
-func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
- var err error
- args := map[string]interface{}{}
- {{- range $i, $arg := . }}
- var arg{{$i}} {{ $arg.TypeReference.GO | ref}}
- if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok {
- {{- if $arg.ImplDirectives }}
- directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) }
- {{ template "implDirectives" $arg }}
- tmp, err = directive{{$arg.ImplDirectives|len}}(ctx)
- if err != nil {
- return nil, err
- }
- if data, ok := tmp.({{ $arg.TypeReference.GO | ref }}) ; ok {
- arg{{$i}} = data
- {{- if $arg.TypeReference.IsNilable }}
- } else if tmp == nil {
- arg{{$i}} = nil
- {{- end }}
- } else {
- return nil, fmt.Errorf(`unexpected type %T from directive, should be {{ $arg.TypeReference.GO }}`, tmp)
- }
- {{- else }}
- arg{{$i}}, err = ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp)
- if err != nil {
- return nil, err
- }
- {{- end }}
- }
- args[{{$arg.Name|quote}}] = arg{{$i}}
- {{- end }}
- return args, nil
-}
-{{ end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/complexity.go b/vendor/github.com/99designs/gqlgen/codegen/complexity.go
deleted file mode 100644
index e9c6a20ee83abf7c99d8ef630444a653fbb918c2..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/complexity.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package codegen
-
-func (o *Object) UniqueFields() map[string][]*Field {
- m := map[string][]*Field{}
-
- for _, f := range o.Fields {
- m[f.GoFieldName] = append(m[f.GoFieldName], f)
- }
-
- return m
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/binder.go b/vendor/github.com/99designs/gqlgen/codegen/config/binder.go
deleted file mode 100644
index 72956de4d1e70c33cdd535abb785a45ab8f5e8c1..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/config/binder.go
+++ /dev/null
@@ -1,448 +0,0 @@
-package config
-
-import (
- "fmt"
- "go/token"
- "go/types"
-
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/99designs/gqlgen/internal/code"
- "github.com/pkg/errors"
- "github.com/vektah/gqlparser/ast"
- "golang.org/x/tools/go/packages"
-)
-
-// Binder connects graphql types to golang types using static analysis
-type Binder struct {
- pkgs map[string]*packages.Package
- schema *ast.Schema
- cfg *Config
- References []*TypeReference
-}
-
-func (c *Config) NewBinder(s *ast.Schema) (*Binder, error) {
- pkgs, err := packages.Load(&packages.Config{Mode: packages.LoadTypes | packages.LoadSyntax}, c.Models.ReferencedPackages()...)
- if err != nil {
- return nil, err
- }
-
- mp := map[string]*packages.Package{}
- for _, p := range pkgs {
- populatePkg(mp, p)
- for _, e := range p.Errors {
- if e.Kind == packages.ListError {
- return nil, p.Errors[0]
- }
- }
- }
-
- return &Binder{
- pkgs: mp,
- schema: s,
- cfg: c,
- }, nil
-}
-
-func populatePkg(mp map[string]*packages.Package, p *packages.Package) {
- imp := code.NormalizeVendor(p.PkgPath)
- if _, ok := mp[imp]; ok {
- return
- }
- mp[imp] = p
- for _, p := range p.Imports {
- populatePkg(mp, p)
- }
-}
-
-func (b *Binder) TypePosition(typ types.Type) token.Position {
- named, isNamed := typ.(*types.Named)
- if !isNamed {
- return token.Position{
- Filename: "unknown",
- }
- }
-
- return b.ObjectPosition(named.Obj())
-}
-
-func (b *Binder) ObjectPosition(typ types.Object) token.Position {
- if typ == nil {
- return token.Position{
- Filename: "unknown",
- }
- }
- pkg := b.getPkg(typ.Pkg().Path())
- return pkg.Fset.Position(typ.Pos())
-}
-
-func (b *Binder) FindType(pkgName string, typeName string) (types.Type, error) {
- obj, err := b.FindObject(pkgName, typeName)
- if err != nil {
- return nil, err
- }
-
- if fun, isFunc := obj.(*types.Func); isFunc {
- return fun.Type().(*types.Signature).Params().At(0).Type(), nil
- }
- return obj.Type(), nil
-}
-
-func (b *Binder) getPkg(find string) *packages.Package {
- imp := code.NormalizeVendor(find)
- if p, ok := b.pkgs[imp]; ok {
- return p
- }
- return nil
-}
-
-var MapType = types.NewMap(types.Typ[types.String], types.NewInterfaceType(nil, nil).Complete())
-var InterfaceType = types.NewInterfaceType(nil, nil)
-
-func (b *Binder) DefaultUserObject(name string) (types.Type, error) {
- models := b.cfg.Models[name].Model
- if len(models) == 0 {
- return nil, fmt.Errorf(name + " not found in typemap")
- }
-
- if models[0] == "map[string]interface{}" {
- return MapType, nil
- }
-
- if models[0] == "interface{}" {
- return InterfaceType, nil
- }
-
- pkgName, typeName := code.PkgAndType(models[0])
- if pkgName == "" {
- return nil, fmt.Errorf("missing package name for %s", name)
- }
-
- obj, err := b.FindObject(pkgName, typeName)
- if err != nil {
- return nil, err
- }
-
- return obj.Type(), nil
-}
-
-func (b *Binder) FindObject(pkgName string, typeName string) (types.Object, error) {
- if pkgName == "" {
- return nil, fmt.Errorf("package cannot be nil")
- }
- fullName := typeName
- if pkgName != "" {
- fullName = pkgName + "." + typeName
- }
-
- pkg := b.getPkg(pkgName)
- if pkg == nil {
- return nil, errors.Errorf("required package was not loaded: %s", fullName)
- }
-
- // function based marshalers take precedence
- for astNode, def := range pkg.TypesInfo.Defs {
- // only look at defs in the top scope
- if def == nil || def.Parent() == nil || def.Parent() != pkg.Types.Scope() {
- continue
- }
-
- if astNode.Name == "Marshal"+typeName {
- return def, nil
- }
- }
-
- // then look for types directly
- for astNode, def := range pkg.TypesInfo.Defs {
- // only look at defs in the top scope
- if def == nil || def.Parent() == nil || def.Parent() != pkg.Types.Scope() {
- continue
- }
-
- if astNode.Name == typeName {
- return def, nil
- }
- }
-
- return nil, errors.Errorf("unable to find type %s\n", fullName)
-}
-
-func (b *Binder) PointerTo(ref *TypeReference) *TypeReference {
- newRef := &TypeReference{
- GO: types.NewPointer(ref.GO),
- GQL: ref.GQL,
- CastType: ref.CastType,
- Definition: ref.Definition,
- Unmarshaler: ref.Unmarshaler,
- Marshaler: ref.Marshaler,
- IsMarshaler: ref.IsMarshaler,
- }
-
- b.References = append(b.References, newRef)
- return newRef
-}
-
-// TypeReference is used by args and field types. The Definition can refer to both input and output types.
-type TypeReference struct {
- Definition *ast.Definition
- GQL *ast.Type
- GO types.Type
- CastType types.Type // Before calling marshalling functions cast from/to this base type
- Marshaler *types.Func // When using external marshalling functions this will point to the Marshal function
- Unmarshaler *types.Func // When using external marshalling functions this will point to the Unmarshal function
- IsMarshaler bool // Does the type implement graphql.Marshaler and graphql.Unmarshaler
-}
-
-func (ref *TypeReference) Elem() *TypeReference {
- if p, isPtr := ref.GO.(*types.Pointer); isPtr {
- return &TypeReference{
- GO: p.Elem(),
- GQL: ref.GQL,
- CastType: ref.CastType,
- Definition: ref.Definition,
- Unmarshaler: ref.Unmarshaler,
- Marshaler: ref.Marshaler,
- IsMarshaler: ref.IsMarshaler,
- }
- }
-
- if ref.IsSlice() {
- return &TypeReference{
- GO: ref.GO.(*types.Slice).Elem(),
- GQL: ref.GQL.Elem,
- CastType: ref.CastType,
- Definition: ref.Definition,
- Unmarshaler: ref.Unmarshaler,
- Marshaler: ref.Marshaler,
- IsMarshaler: ref.IsMarshaler,
- }
- }
- return nil
-}
-
-func (t *TypeReference) IsPtr() bool {
- _, isPtr := t.GO.(*types.Pointer)
- return isPtr
-}
-
-func (t *TypeReference) IsNilable() bool {
- _, isPtr := t.GO.(*types.Pointer)
- _, isMap := t.GO.(*types.Map)
- _, isInterface := t.GO.(*types.Interface)
- return isPtr || isMap || isInterface
-}
-
-func (t *TypeReference) IsSlice() bool {
- _, isSlice := t.GO.(*types.Slice)
- return t.GQL.Elem != nil && isSlice
-}
-
-func (t *TypeReference) IsNamed() bool {
- _, isSlice := t.GO.(*types.Named)
- return isSlice
-}
-
-func (t *TypeReference) IsStruct() bool {
- _, isStruct := t.GO.Underlying().(*types.Struct)
- return isStruct
-}
-
-func (t *TypeReference) IsScalar() bool {
- return t.Definition.Kind == ast.Scalar
-}
-
-func (t *TypeReference) UniquenessKey() string {
- var nullability = "O"
- if t.GQL.NonNull {
- nullability = "N"
- }
-
- return nullability + t.Definition.Name + "2" + templates.TypeIdentifier(t.GO)
-}
-
-func (t *TypeReference) MarshalFunc() string {
- if t.Definition == nil {
- panic(errors.New("Definition missing for " + t.GQL.Name()))
- }
-
- if t.Definition.Kind == ast.InputObject {
- return ""
- }
-
- return "marshal" + t.UniquenessKey()
-}
-
-func (t *TypeReference) UnmarshalFunc() string {
- if t.Definition == nil {
- panic(errors.New("Definition missing for " + t.GQL.Name()))
- }
-
- if !t.Definition.IsInputType() {
- return ""
- }
-
- return "unmarshal" + t.UniquenessKey()
-}
-
-func (b *Binder) PushRef(ret *TypeReference) {
- b.References = append(b.References, ret)
-}
-
-func isMap(t types.Type) bool {
- if t == nil {
- return true
- }
- _, ok := t.(*types.Map)
- return ok
-}
-
-func isIntf(t types.Type) bool {
- if t == nil {
- return true
- }
- _, ok := t.(*types.Interface)
- return ok
-}
-
-func (b *Binder) TypeReference(schemaType *ast.Type, bindTarget types.Type) (ret *TypeReference, err error) {
- var pkgName, typeName string
- def := b.schema.Types[schemaType.Name()]
- defer func() {
- if err == nil && ret != nil {
- b.PushRef(ret)
- }
- }()
-
- if len(b.cfg.Models[schemaType.Name()].Model) == 0 {
- return nil, fmt.Errorf("%s was not found", schemaType.Name())
- }
-
- for _, model := range b.cfg.Models[schemaType.Name()].Model {
- if model == "map[string]interface{}" {
- if !isMap(bindTarget) {
- continue
- }
- return &TypeReference{
- Definition: def,
- GQL: schemaType,
- GO: MapType,
- }, nil
- }
-
- if model == "interface{}" {
- if !isIntf(bindTarget) {
- continue
- }
- return &TypeReference{
- Definition: def,
- GQL: schemaType,
- GO: InterfaceType,
- }, nil
- }
-
- pkgName, typeName = code.PkgAndType(model)
- if pkgName == "" {
- return nil, fmt.Errorf("missing package name for %s", schemaType.Name())
- }
-
- ref := &TypeReference{
- Definition: def,
- GQL: schemaType,
- }
-
- obj, err := b.FindObject(pkgName, typeName)
- if err != nil {
- return nil, err
- }
-
- if fun, isFunc := obj.(*types.Func); isFunc {
- ref.GO = fun.Type().(*types.Signature).Params().At(0).Type()
- ref.Marshaler = fun
- ref.Unmarshaler = types.NewFunc(0, fun.Pkg(), "Unmarshal"+typeName, nil)
- } else if hasMethod(obj.Type(), "MarshalGQL") && hasMethod(obj.Type(), "UnmarshalGQL") {
- ref.GO = obj.Type()
- ref.IsMarshaler = true
- } else if underlying := basicUnderlying(obj.Type()); def.IsLeafType() && underlying != nil && underlying.Kind() == types.String {
- // Special case for named types wrapping strings. Used by default enum implementations.
-
- ref.GO = obj.Type()
- ref.CastType = underlying
-
- underlyingRef, err := b.TypeReference(&ast.Type{NamedType: "String"}, nil)
- if err != nil {
- return nil, err
- }
-
- ref.Marshaler = underlyingRef.Marshaler
- ref.Unmarshaler = underlyingRef.Unmarshaler
- } else {
- ref.GO = obj.Type()
- }
-
- ref.GO = b.CopyModifiersFromAst(schemaType, ref.GO)
-
- if bindTarget != nil {
- if err = code.CompatibleTypes(ref.GO, bindTarget); err != nil {
- continue
- }
- ref.GO = bindTarget
- }
-
- return ref, nil
- }
-
- return nil, fmt.Errorf("%s has type compatible with %s", schemaType.Name(), bindTarget.String())
-}
-
-func (b *Binder) CopyModifiersFromAst(t *ast.Type, base types.Type) types.Type {
- if t.Elem != nil {
- child := b.CopyModifiersFromAst(t.Elem, base)
- if _, isStruct := child.Underlying().(*types.Struct); isStruct {
- child = types.NewPointer(child)
- }
- return types.NewSlice(child)
- }
-
- var isInterface bool
- if named, ok := base.(*types.Named); ok {
- _, isInterface = named.Underlying().(*types.Interface)
- }
-
- if !isInterface && !t.NonNull {
- return types.NewPointer(base)
- }
-
- return base
-}
-
-func hasMethod(it types.Type, name string) bool {
- if ptr, isPtr := it.(*types.Pointer); isPtr {
- it = ptr.Elem()
- }
- namedType, ok := it.(*types.Named)
- if !ok {
- return false
- }
-
- for i := 0; i < namedType.NumMethods(); i++ {
- if namedType.Method(i).Name() == name {
- return true
- }
- }
- return false
-}
-
-func basicUnderlying(it types.Type) *types.Basic {
- if ptr, isPtr := it.(*types.Pointer); isPtr {
- it = ptr.Elem()
- }
- namedType, ok := it.(*types.Named)
- if !ok {
- return nil
- }
-
- if basic, ok := namedType.Underlying().(*types.Basic); ok {
- return basic
- }
-
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/config/config.go b/vendor/github.com/99designs/gqlgen/codegen/config/config.go
deleted file mode 100644
index 8e8992e37c473ef07d543274dfa4be92e3222b4b..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/config/config.go
+++ /dev/null
@@ -1,490 +0,0 @@
-package config
-
-import (
- "fmt"
- "go/types"
- "io/ioutil"
- "os"
- "path/filepath"
- "regexp"
- "sort"
- "strings"
-
- "golang.org/x/tools/go/packages"
-
- "github.com/99designs/gqlgen/internal/code"
- "github.com/pkg/errors"
- "github.com/vektah/gqlparser"
- "github.com/vektah/gqlparser/ast"
- "gopkg.in/yaml.v2"
-)
-
-type Config struct {
- SchemaFilename StringList `yaml:"schema,omitempty"`
- Exec PackageConfig `yaml:"exec"`
- Model PackageConfig `yaml:"model"`
- Resolver PackageConfig `yaml:"resolver,omitempty"`
- AutoBind []string `yaml:"autobind"`
- Models TypeMap `yaml:"models,omitempty"`
- StructTag string `yaml:"struct_tag,omitempty"`
- Directives map[string]DirectiveConfig `yaml:"directives,omitempty"`
-}
-
-var cfgFilenames = []string{".gqlgen.yml", "gqlgen.yml", "gqlgen.yaml"}
-
-// DefaultConfig creates a copy of the default config
-func DefaultConfig() *Config {
- return &Config{
- SchemaFilename: StringList{"schema.graphql"},
- Model: PackageConfig{Filename: "models_gen.go"},
- Exec: PackageConfig{Filename: "generated.go"},
- Directives: map[string]DirectiveConfig{},
- }
-}
-
-// LoadConfigFromDefaultLocations looks for a config file in the current directory, and all parent directories
-// walking up the tree. The closest config file will be returned.
-func LoadConfigFromDefaultLocations() (*Config, error) {
- cfgFile, err := findCfg()
- if err != nil {
- return nil, err
- }
-
- err = os.Chdir(filepath.Dir(cfgFile))
- if err != nil {
- return nil, errors.Wrap(err, "unable to enter config dir")
- }
- return LoadConfig(cfgFile)
-}
-
-var path2regex = strings.NewReplacer(
- `.`, `\.`,
- `*`, `.+`,
- `\`, `[\\/]`,
- `/`, `[\\/]`,
-)
-
-// LoadConfig reads the gqlgen.yml config file
-func LoadConfig(filename string) (*Config, error) {
- config := DefaultConfig()
-
- b, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, errors.Wrap(err, "unable to read config")
- }
-
- if err := yaml.UnmarshalStrict(b, config); err != nil {
- return nil, errors.Wrap(err, "unable to parse config")
- }
-
- defaultDirectives := map[string]DirectiveConfig{
- "skip": {SkipRuntime: true},
- "include": {SkipRuntime: true},
- "deprecated": {SkipRuntime: true},
- }
-
- for key, value := range defaultDirectives {
- if _, defined := config.Directives[key]; !defined {
- config.Directives[key] = value
- }
- }
-
- preGlobbing := config.SchemaFilename
- config.SchemaFilename = StringList{}
- for _, f := range preGlobbing {
- var matches []string
-
- // for ** we want to override default globbing patterns and walk all
- // subdirectories to match schema files.
- if strings.Contains(f, "**") {
- pathParts := strings.SplitN(f, "**", 2)
- rest := strings.TrimPrefix(strings.TrimPrefix(pathParts[1], `\`), `/`)
- // turn the rest of the glob into a regex, anchored only at the end because ** allows
- // for any number of dirs in between and walk will let us match against the full path name
- globRe := regexp.MustCompile(path2regex.Replace(rest) + `$`)
-
- if err := filepath.Walk(pathParts[0], func(path string, info os.FileInfo, err error) error {
- if err != nil {
- return err
- }
-
- if globRe.MatchString(strings.TrimPrefix(path, pathParts[0])) {
- matches = append(matches, path)
- }
-
- return nil
- }); err != nil {
- return nil, errors.Wrapf(err, "failed to walk schema at root %s", pathParts[0])
- }
- } else {
- matches, err = filepath.Glob(f)
- if err != nil {
- return nil, errors.Wrapf(err, "failed to glob schema filename %s", f)
- }
- }
-
- for _, m := range matches {
- if config.SchemaFilename.Has(m) {
- continue
- }
- config.SchemaFilename = append(config.SchemaFilename, m)
- }
- }
-
- return config, nil
-}
-
-type PackageConfig struct {
- Filename string `yaml:"filename,omitempty"`
- Package string `yaml:"package,omitempty"`
- Type string `yaml:"type,omitempty"`
-}
-
-type TypeMapEntry struct {
- Model StringList `yaml:"model"`
- Fields map[string]TypeMapField `yaml:"fields,omitempty"`
-}
-
-type TypeMapField struct {
- Resolver bool `yaml:"resolver"`
- FieldName string `yaml:"fieldName"`
-}
-
-type StringList []string
-
-func (a *StringList) UnmarshalYAML(unmarshal func(interface{}) error) error {
- var single string
- err := unmarshal(&single)
- if err == nil {
- *a = []string{single}
- return nil
- }
-
- var multi []string
- err = unmarshal(&multi)
- if err != nil {
- return err
- }
-
- *a = multi
- return nil
-}
-
-func (a StringList) Has(file string) bool {
- for _, existing := range a {
- if existing == file {
- return true
- }
- }
- return false
-}
-
-func (c *PackageConfig) normalize() error {
- if c.Filename == "" {
- return errors.New("Filename is required")
- }
- c.Filename = abs(c.Filename)
- // If Package is not set, first attempt to load the package at the output dir. If that fails
- // fallback to just the base dir name of the output filename.
- if c.Package == "" {
- c.Package = code.NameForDir(c.Dir())
- }
-
- return nil
-}
-
-func (c *PackageConfig) ImportPath() string {
- return code.ImportPathForDir(c.Dir())
-}
-
-func (c *PackageConfig) Dir() string {
- return filepath.Dir(c.Filename)
-}
-
-func (c *PackageConfig) Check() error {
- if strings.ContainsAny(c.Package, "./\\") {
- return fmt.Errorf("package should be the output package name only, do not include the output filename")
- }
- if c.Filename != "" && !strings.HasSuffix(c.Filename, ".go") {
- return fmt.Errorf("filename should be path to a go source file")
- }
-
- return c.normalize()
-}
-
-func (c *PackageConfig) Pkg() *types.Package {
- return types.NewPackage(c.ImportPath(), c.Dir())
-}
-
-func (c *PackageConfig) IsDefined() bool {
- return c.Filename != ""
-}
-
-func (c *Config) Check() error {
- if err := c.Models.Check(); err != nil {
- return errors.Wrap(err, "config.models")
- }
- if err := c.Exec.Check(); err != nil {
- return errors.Wrap(err, "config.exec")
- }
- if err := c.Model.Check(); err != nil {
- return errors.Wrap(err, "config.model")
- }
- if c.Resolver.IsDefined() {
- if err := c.Resolver.Check(); err != nil {
- return errors.Wrap(err, "config.resolver")
- }
- }
-
- // check packages names against conflict, if present in the same dir
- // and check filenames for uniqueness
- packageConfigList := []PackageConfig{
- c.Model,
- c.Exec,
- c.Resolver,
- }
- filesMap := make(map[string]bool)
- pkgConfigsByDir := make(map[string]PackageConfig)
- for _, current := range packageConfigList {
- _, fileFound := filesMap[current.Filename]
- if fileFound {
- return fmt.Errorf("filename %s defined more than once", current.Filename)
- }
- filesMap[current.Filename] = true
- previous, inSameDir := pkgConfigsByDir[current.Dir()]
- if inSameDir && current.Package != previous.Package {
- return fmt.Errorf("filenames %s and %s are in the same directory but have different package definitions", stripPath(current.Filename), stripPath(previous.Filename))
- }
- pkgConfigsByDir[current.Dir()] = current
- }
-
- return c.normalize()
-}
-
-func stripPath(path string) string {
- return filepath.Base(path)
-}
-
-type TypeMap map[string]TypeMapEntry
-
-func (tm TypeMap) Exists(typeName string) bool {
- _, ok := tm[typeName]
- return ok
-}
-
-func (tm TypeMap) UserDefined(typeName string) bool {
- m, ok := tm[typeName]
- return ok && len(m.Model) > 0
-}
-
-func (tm TypeMap) Check() error {
- for typeName, entry := range tm {
- for _, model := range entry.Model {
- if strings.LastIndex(model, ".") < strings.LastIndex(model, "/") {
- return fmt.Errorf("model %s: invalid type specifier \"%s\" - you need to specify a struct to map to", typeName, entry.Model)
- }
- }
- }
- return nil
-}
-
-func (tm TypeMap) ReferencedPackages() []string {
- var pkgs []string
-
- for _, typ := range tm {
- for _, model := range typ.Model {
- if model == "map[string]interface{}" || model == "interface{}" {
- continue
- }
- pkg, _ := code.PkgAndType(model)
- if pkg == "" || inStrSlice(pkgs, pkg) {
- continue
- }
- pkgs = append(pkgs, code.QualifyPackagePath(pkg))
- }
- }
-
- sort.Slice(pkgs, func(i, j int) bool {
- return pkgs[i] > pkgs[j]
- })
- return pkgs
-}
-
-func (tm TypeMap) Add(name string, goType string) {
- modelCfg := tm[name]
- modelCfg.Model = append(modelCfg.Model, goType)
- tm[name] = modelCfg
-}
-
-type DirectiveConfig struct {
- SkipRuntime bool `yaml:"skip_runtime"`
-}
-
-func inStrSlice(haystack []string, needle string) bool {
- for _, v := range haystack {
- if needle == v {
- return true
- }
- }
-
- return false
-}
-
-// findCfg searches for the config file in this directory and all parents up the tree
-// looking for the closest match
-func findCfg() (string, error) {
- dir, err := os.Getwd()
- if err != nil {
- return "", errors.Wrap(err, "unable to get working dir to findCfg")
- }
-
- cfg := findCfgInDir(dir)
-
- for cfg == "" && dir != filepath.Dir(dir) {
- dir = filepath.Dir(dir)
- cfg = findCfgInDir(dir)
- }
-
- if cfg == "" {
- return "", os.ErrNotExist
- }
-
- return cfg, nil
-}
-
-func findCfgInDir(dir string) string {
- for _, cfgName := range cfgFilenames {
- path := filepath.Join(dir, cfgName)
- if _, err := os.Stat(path); err == nil {
- return path
- }
- }
- return ""
-}
-
-func (c *Config) normalize() error {
- if err := c.Model.normalize(); err != nil {
- return errors.Wrap(err, "model")
- }
-
- if err := c.Exec.normalize(); err != nil {
- return errors.Wrap(err, "exec")
- }
-
- if c.Resolver.IsDefined() {
- if err := c.Resolver.normalize(); err != nil {
- return errors.Wrap(err, "resolver")
- }
- }
-
- if c.Models == nil {
- c.Models = TypeMap{}
- }
-
- return nil
-}
-
-func (c *Config) Autobind(s *ast.Schema) error {
- if len(c.AutoBind) == 0 {
- return nil
- }
- ps, err := packages.Load(&packages.Config{Mode: packages.LoadTypes}, c.AutoBind...)
- if err != nil {
- return err
- }
-
- for _, t := range s.Types {
- if c.Models.UserDefined(t.Name) {
- continue
- }
-
- for _, p := range ps {
- if t := p.Types.Scope().Lookup(t.Name); t != nil {
- c.Models.Add(t.Name(), t.Pkg().Path()+"."+t.Name())
- break
- }
- }
- }
-
- return nil
-}
-
-func (c *Config) InjectBuiltins(s *ast.Schema) {
- builtins := TypeMap{
- "__Directive": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Directive"}},
- "__DirectiveLocation": {Model: StringList{"github.com/99designs/gqlgen/graphql.String"}},
- "__Type": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Type"}},
- "__TypeKind": {Model: StringList{"github.com/99designs/gqlgen/graphql.String"}},
- "__Field": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Field"}},
- "__EnumValue": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.EnumValue"}},
- "__InputValue": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.InputValue"}},
- "__Schema": {Model: StringList{"github.com/99designs/gqlgen/graphql/introspection.Schema"}},
- "Float": {Model: StringList{"github.com/99designs/gqlgen/graphql.Float"}},
- "String": {Model: StringList{"github.com/99designs/gqlgen/graphql.String"}},
- "Boolean": {Model: StringList{"github.com/99designs/gqlgen/graphql.Boolean"}},
- "Int": {Model: StringList{
- "github.com/99designs/gqlgen/graphql.Int",
- "github.com/99designs/gqlgen/graphql.Int32",
- "github.com/99designs/gqlgen/graphql.Int64",
- }},
- "ID": {
- Model: StringList{
- "github.com/99designs/gqlgen/graphql.ID",
- "github.com/99designs/gqlgen/graphql.IntID",
- },
- },
- }
-
- for typeName, entry := range builtins {
- if !c.Models.Exists(typeName) {
- c.Models[typeName] = entry
- }
- }
-
- // These are additional types that are injected if defined in the schema as scalars.
- extraBuiltins := TypeMap{
- "Time": {Model: StringList{"github.com/99designs/gqlgen/graphql.Time"}},
- "Map": {Model: StringList{"github.com/99designs/gqlgen/graphql.Map"}},
- "Upload": {Model: StringList{"github.com/99designs/gqlgen/graphql.Upload"}},
- "Any": {Model: StringList{"github.com/99designs/gqlgen/graphql.Any"}},
- }
-
- for typeName, entry := range extraBuiltins {
- if t, ok := s.Types[typeName]; !c.Models.Exists(typeName) && ok && t.Kind == ast.Scalar {
- c.Models[typeName] = entry
- }
- }
-}
-
-func (c *Config) LoadSchema() (*ast.Schema, map[string]string, error) {
- schemaStrings := map[string]string{}
-
- sources := make([]*ast.Source, len(c.SchemaFilename))
-
- for i, filename := range c.SchemaFilename {
- filename = filepath.ToSlash(filename)
- var err error
- var schemaRaw []byte
- schemaRaw, err = ioutil.ReadFile(filename)
- if err != nil {
- fmt.Fprintln(os.Stderr, "unable to open schema: "+err.Error())
- os.Exit(1)
- }
- schemaStrings[filename] = string(schemaRaw)
- sources[i] = &ast.Source{Name: filename, Input: schemaStrings[filename]}
- }
-
- schema, err := gqlparser.LoadSchema(sources...)
- if err != nil {
- return nil, nil, err
- }
- return schema, schemaStrings, nil
-}
-
-func abs(path string) string {
- absPath, err := filepath.Abs(path)
- if err != nil {
- panic(err)
- }
- return filepath.ToSlash(absPath)
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/data.go b/vendor/github.com/99designs/gqlgen/codegen/data.go
deleted file mode 100644
index f743dee36242111d45109c025b6aeec1aa9a4bdf..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/data.go
+++ /dev/null
@@ -1,170 +0,0 @@
-package codegen
-
-import (
- "fmt"
- "sort"
-
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/pkg/errors"
- "github.com/vektah/gqlparser/ast"
-)
-
-// Data is a unified model of the code to be generated. Plugins may modify this structure to do things like implement
-// resolvers or directives automatically (eg grpc, validation)
-type Data struct {
- Config *config.Config
- Schema *ast.Schema
- SchemaStr map[string]string
- Directives DirectiveList
- Objects Objects
- Inputs Objects
- Interfaces map[string]*Interface
- ReferencedTypes map[string]*config.TypeReference
- ComplexityRoots map[string]*Object
-
- QueryRoot *Object
- MutationRoot *Object
- SubscriptionRoot *Object
-}
-
-type builder struct {
- Config *config.Config
- Schema *ast.Schema
- SchemaStr map[string]string
- Binder *config.Binder
- Directives map[string]*Directive
-}
-
-func BuildData(cfg *config.Config) (*Data, error) {
- b := builder{
- Config: cfg,
- }
-
- var err error
- b.Schema, b.SchemaStr, err = cfg.LoadSchema()
- if err != nil {
- return nil, err
- }
-
- err = cfg.Check()
- if err != nil {
- return nil, err
- }
-
- err = cfg.Autobind(b.Schema)
- if err != nil {
- return nil, err
- }
-
- cfg.InjectBuiltins(b.Schema)
-
- b.Binder, err = b.Config.NewBinder(b.Schema)
- if err != nil {
- return nil, err
- }
-
- b.Directives, err = b.buildDirectives()
- if err != nil {
- return nil, err
- }
-
- dataDirectives := make(map[string]*Directive)
- for name, d := range b.Directives {
- if !d.Builtin {
- dataDirectives[name] = d
- }
- }
-
- s := Data{
- Config: cfg,
- Directives: dataDirectives,
- Schema: b.Schema,
- SchemaStr: b.SchemaStr,
- Interfaces: map[string]*Interface{},
- }
-
- for _, schemaType := range b.Schema.Types {
- switch schemaType.Kind {
- case ast.Object:
- obj, err := b.buildObject(schemaType)
- if err != nil {
- return nil, errors.Wrap(err, "unable to build object definition")
- }
-
- s.Objects = append(s.Objects, obj)
- case ast.InputObject:
- input, err := b.buildObject(schemaType)
- if err != nil {
- return nil, errors.Wrap(err, "unable to build input definition")
- }
-
- s.Inputs = append(s.Inputs, input)
-
- case ast.Union, ast.Interface:
- s.Interfaces[schemaType.Name] = b.buildInterface(schemaType)
- }
- }
-
- if s.Schema.Query != nil {
- s.QueryRoot = s.Objects.ByName(s.Schema.Query.Name)
- } else {
- return nil, fmt.Errorf("query entry point missing")
- }
-
- if s.Schema.Mutation != nil {
- s.MutationRoot = s.Objects.ByName(s.Schema.Mutation.Name)
- }
-
- if s.Schema.Subscription != nil {
- s.SubscriptionRoot = s.Objects.ByName(s.Schema.Subscription.Name)
- }
-
- if err := b.injectIntrospectionRoots(&s); err != nil {
- return nil, err
- }
-
- s.ReferencedTypes = b.buildTypes()
-
- sort.Slice(s.Objects, func(i, j int) bool {
- return s.Objects[i].Definition.Name < s.Objects[j].Definition.Name
- })
-
- sort.Slice(s.Inputs, func(i, j int) bool {
- return s.Inputs[i].Definition.Name < s.Inputs[j].Definition.Name
- })
-
- return &s, nil
-}
-
-func (b *builder) injectIntrospectionRoots(s *Data) error {
- obj := s.Objects.ByName(b.Schema.Query.Name)
- if obj == nil {
- return fmt.Errorf("root query type must be defined")
- }
-
- __type, err := b.buildField(obj, &ast.FieldDefinition{
- Name: "__type",
- Type: ast.NamedType("__Type", nil),
- Arguments: []*ast.ArgumentDefinition{
- {
- Name: "name",
- Type: ast.NonNullNamedType("String", nil),
- },
- },
- })
- if err != nil {
- return err
- }
-
- __schema, err := b.buildField(obj, &ast.FieldDefinition{
- Name: "__schema",
- Type: ast.NamedType("__Schema", nil),
- })
- if err != nil {
- return err
- }
-
- obj.Fields = append(obj.Fields, __type, __schema)
-
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/directive.go b/vendor/github.com/99designs/gqlgen/codegen/directive.go
deleted file mode 100644
index 491f92f43aca0738e9527b64e427728a9cacd974..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/directive.go
+++ /dev/null
@@ -1,175 +0,0 @@
-package codegen
-
-import (
- "fmt"
- "strconv"
- "strings"
-
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/pkg/errors"
- "github.com/vektah/gqlparser/ast"
-)
-
-type DirectiveList map[string]*Directive
-
-//LocationDirectives filter directives by location
-func (dl DirectiveList) LocationDirectives(location string) DirectiveList {
- return locationDirectives(dl, ast.DirectiveLocation(location))
-}
-
-type Directive struct {
- *ast.DirectiveDefinition
- Name string
- Args []*FieldArgument
- Builtin bool
-}
-
-//IsLocation check location directive
-func (d *Directive) IsLocation(location ...ast.DirectiveLocation) bool {
- for _, l := range d.Locations {
- for _, a := range location {
- if l == a {
- return true
- }
- }
- }
-
- return false
-}
-
-func locationDirectives(directives DirectiveList, location ...ast.DirectiveLocation) map[string]*Directive {
- mDirectives := make(map[string]*Directive)
- for name, d := range directives {
- if d.IsLocation(location...) {
- mDirectives[name] = d
- }
- }
- return mDirectives
-}
-
-func (b *builder) buildDirectives() (map[string]*Directive, error) {
- directives := make(map[string]*Directive, len(b.Schema.Directives))
-
- for name, dir := range b.Schema.Directives {
- if _, ok := directives[name]; ok {
- return nil, errors.Errorf("directive with name %s already exists", name)
- }
-
- var args []*FieldArgument
- for _, arg := range dir.Arguments {
- tr, err := b.Binder.TypeReference(arg.Type, nil)
- if err != nil {
- return nil, err
- }
-
- newArg := &FieldArgument{
- ArgumentDefinition: arg,
- TypeReference: tr,
- VarName: templates.ToGoPrivate(arg.Name),
- }
-
- if arg.DefaultValue != nil {
- var err error
- newArg.Default, err = arg.DefaultValue.Value(nil)
- if err != nil {
- return nil, errors.Errorf("default value for directive argument %s(%s) is not valid: %s", dir.Name, arg.Name, err.Error())
- }
- }
- args = append(args, newArg)
- }
-
- directives[name] = &Directive{
- DirectiveDefinition: dir,
- Name: name,
- Args: args,
- Builtin: b.Config.Directives[name].SkipRuntime,
- }
- }
-
- return directives, nil
-}
-
-func (b *builder) getDirectives(list ast.DirectiveList) ([]*Directive, error) {
- dirs := make([]*Directive, len(list))
- for i, d := range list {
- argValues := make(map[string]interface{}, len(d.Arguments))
- for _, da := range d.Arguments {
- val, err := da.Value.Value(nil)
- if err != nil {
- return nil, err
- }
- argValues[da.Name] = val
- }
- def, ok := b.Directives[d.Name]
- if !ok {
- return nil, fmt.Errorf("directive %s not found", d.Name)
- }
-
- var args []*FieldArgument
- for _, a := range def.Args {
- value := a.Default
- if argValue, ok := argValues[a.Name]; ok {
- value = argValue
- }
- args = append(args, &FieldArgument{
- ArgumentDefinition: a.ArgumentDefinition,
- Value: value,
- VarName: a.VarName,
- TypeReference: a.TypeReference,
- })
- }
- dirs[i] = &Directive{
- Name: d.Name,
- Args: args,
- DirectiveDefinition: list[i].Definition,
- Builtin: b.Config.Directives[d.Name].SkipRuntime,
- }
-
- }
-
- return dirs, nil
-}
-
-func (d *Directive) ArgsFunc() string {
- if len(d.Args) == 0 {
- return ""
- }
-
- return "dir_" + d.Name + "_args"
-}
-
-func (d *Directive) CallArgs() string {
- args := []string{"ctx", "obj", "n"}
-
- for _, arg := range d.Args {
- args = append(args, "args["+strconv.Quote(arg.Name)+"].("+templates.CurrentImports.LookupType(arg.TypeReference.GO)+")")
- }
-
- return strings.Join(args, ", ")
-}
-
-func (d *Directive) ResolveArgs(obj string, next int) string {
- args := []string{"ctx", obj, fmt.Sprintf("directive%d", next)}
-
- for _, arg := range d.Args {
- dArg := arg.VarName
- if arg.Value == nil && arg.Default == nil {
- dArg = "nil"
- }
-
- args = append(args, dArg)
- }
-
- return strings.Join(args, ", ")
-}
-
-func (d *Directive) Declaration() string {
- res := ucFirst(d.Name) + " func(ctx context.Context, obj interface{}, next graphql.Resolver"
-
- for _, arg := range d.Args {
- res += fmt.Sprintf(", %s %s", arg.Name, templates.CurrentImports.LookupType(arg.TypeReference.GO))
- }
-
- res += ") (res interface{}, err error)"
- return res
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/directives.gotpl b/vendor/github.com/99designs/gqlgen/codegen/directives.gotpl
deleted file mode 100644
index 67a0783e6500e2febe0013a02a20512d204eece8..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/directives.gotpl
+++ /dev/null
@@ -1,137 +0,0 @@
-{{ define "implDirectives" }}{{ $in := .DirectiveObjName }}
- {{- range $i, $directive := .ImplDirectives -}}
- directive{{add $i 1}} := func(ctx context.Context) (interface{}, error) {
- {{- range $arg := $directive.Args }}
- {{- if notNil "Value" $arg }}
- {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Value | dump }})
- if err != nil{
- return nil, err
- }
- {{- else if notNil "Default" $arg }}
- {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Default | dump }})
- if err != nil{
- return nil, err
- }
- {{- end }}
- {{- end }}
- return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs $in $i }})
- }
- {{- end -}}
-{{ end }}
-
-{{define "queryDirectives"}}
- for _, d := range obj.Directives {
- switch d.Name {
- {{- range $directive := . }}
- case "{{$directive.Name}}":
- {{- if $directive.Args }}
- rawArgs := d.ArgumentMap(ec.Variables)
- args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs)
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- {{- end }}
- n := next
- next = func(ctx context.Context) (interface{}, error) {
- return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}})
- }
- {{- end }}
- }
- }
- tmp, err := next(ctx)
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- if data, ok := tmp.(graphql.Marshaler); ok {
- return data
- }
- ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp)
- return graphql.Null
-{{end}}
-
-{{ if .Directives.LocationDirectives "QUERY" }}
-func (ec *executionContext) _queryMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler {
- {{ template "queryDirectives" .Directives.LocationDirectives "QUERY" }}
-}
-{{ end }}
-
-{{ if .Directives.LocationDirectives "MUTATION" }}
-func (ec *executionContext) _mutationMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler {
- {{ template "queryDirectives" .Directives.LocationDirectives "MUTATION" }}
-}
-{{ end }}
-
-{{ if .Directives.LocationDirectives "SUBSCRIPTION" }}
-func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) func() graphql.Marshaler {
- for _, d := range obj.Directives {
- switch d.Name {
- {{- range $directive := .Directives.LocationDirectives "SUBSCRIPTION" }}
- case "{{$directive.Name}}":
- {{- if $directive.Args }}
- rawArgs := d.ArgumentMap(ec.Variables)
- args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs)
- if err != nil {
- ec.Error(ctx, err)
- return func() graphql.Marshaler {
- return graphql.Null
- }
- }
- {{- end }}
- n := next
- next = func(ctx context.Context) (interface{}, error) {
- return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}})
- }
- {{- end }}
- }
- }
- tmp, err := next(ctx)
- if err != nil {
- ec.Error(ctx, err)
- return func() graphql.Marshaler {
- return graphql.Null
- }
- }
- if data, ok := tmp.(func() graphql.Marshaler); ok {
- return data
- }
- ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp)
- return func() graphql.Marshaler {
- return graphql.Null
- }
-}
-{{ end }}
-
-{{ if .Directives.LocationDirectives "FIELD" }}
- func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) interface{} {
- {{- if .Directives.LocationDirectives "FIELD" }}
- rctx := graphql.GetResolverContext(ctx)
- for _, d := range rctx.Field.Directives {
- switch d.Name {
- {{- range $directive := .Directives.LocationDirectives "FIELD" }}
- case "{{$directive.Name}}":
- {{- if $directive.Args }}
- rawArgs := d.ArgumentMap(ec.Variables)
- args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs)
- if err != nil {
- ec.Error(ctx, err)
- return nil
- }
- {{- end }}
- n := next
- next = func(ctx context.Context) (interface{}, error) {
- return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}})
- }
- {{- end }}
- }
- }
- {{- end }}
- res, err := ec.ResolverMiddleware(ctx, next)
- if err != nil {
- ec.Error(ctx, err)
- return nil
- }
- return res
- }
-{{ end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/field.go b/vendor/github.com/99designs/gqlgen/codegen/field.go
deleted file mode 100644
index fab26f2b9a9c2245682c8ff10bcc50369ad50df2..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/field.go
+++ /dev/null
@@ -1,413 +0,0 @@
-package codegen
-
-import (
- "fmt"
- "go/types"
- "log"
- "reflect"
- "strconv"
- "strings"
-
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/pkg/errors"
- "github.com/vektah/gqlparser/ast"
-)
-
-type Field struct {
- *ast.FieldDefinition
-
- TypeReference *config.TypeReference
- GoFieldType GoFieldType // The field type in go, if any
- GoReceiverName string // The name of method & var receiver in go, if any
- GoFieldName string // The name of the method or var in go, if any
- IsResolver bool // Does this field need a resolver
- Args []*FieldArgument // A list of arguments to be passed to this field
- MethodHasContext bool // If this is bound to a go method, does the method also take a context
- NoErr bool // If this is bound to a go method, does that method have an error as the second argument
- Object *Object // A link back to the parent object
- Default interface{} // The default value
- Directives []*Directive
-}
-
-func (b *builder) buildField(obj *Object, field *ast.FieldDefinition) (*Field, error) {
- dirs, err := b.getDirectives(field.Directives)
- if err != nil {
- return nil, err
- }
-
- f := Field{
- FieldDefinition: field,
- Object: obj,
- Directives: dirs,
- GoFieldName: templates.ToGo(field.Name),
- GoFieldType: GoFieldVariable,
- GoReceiverName: "obj",
- }
-
- if field.DefaultValue != nil {
- var err error
- f.Default, err = field.DefaultValue.Value(nil)
- if err != nil {
- return nil, errors.Errorf("default value %s is not valid: %s", field.Name, err.Error())
- }
- }
-
- for _, arg := range field.Arguments {
- newArg, err := b.buildArg(obj, arg)
- if err != nil {
- return nil, err
- }
- f.Args = append(f.Args, newArg)
- }
-
- if err = b.bindField(obj, &f); err != nil {
- f.IsResolver = true
- log.Println(err.Error())
- }
-
- if f.IsResolver && !f.TypeReference.IsPtr() && f.TypeReference.IsStruct() {
- f.TypeReference = b.Binder.PointerTo(f.TypeReference)
- }
-
- return &f, nil
-}
-
-func (b *builder) bindField(obj *Object, f *Field) error {
- defer func() {
- if f.TypeReference == nil {
- tr, err := b.Binder.TypeReference(f.Type, nil)
- if err != nil {
- panic(err)
- }
- f.TypeReference = tr
- }
- }()
-
- switch {
- case f.Name == "__schema":
- f.GoFieldType = GoFieldMethod
- f.GoReceiverName = "ec"
- f.GoFieldName = "introspectSchema"
- return nil
- case f.Name == "__type":
- f.GoFieldType = GoFieldMethod
- f.GoReceiverName = "ec"
- f.GoFieldName = "introspectType"
- return nil
- case obj.Root:
- f.IsResolver = true
- return nil
- case b.Config.Models[obj.Name].Fields[f.Name].Resolver:
- f.IsResolver = true
- return nil
- case obj.Type == config.MapType:
- f.GoFieldType = GoFieldMap
- return nil
- case b.Config.Models[obj.Name].Fields[f.Name].FieldName != "":
- f.GoFieldName = b.Config.Models[obj.Name].Fields[f.Name].FieldName
- }
-
- target, err := b.findBindTarget(obj.Type.(*types.Named), f.GoFieldName)
- if err != nil {
- return err
- }
-
- pos := b.Binder.ObjectPosition(target)
-
- switch target := target.(type) {
- case nil:
- objPos := b.Binder.TypePosition(obj.Type)
- return fmt.Errorf(
- "%s:%d adding resolver method for %s.%s, nothing matched",
- objPos.Filename,
- objPos.Line,
- obj.Name,
- f.Name,
- )
-
- case *types.Func:
- sig := target.Type().(*types.Signature)
- if sig.Results().Len() == 1 {
- f.NoErr = true
- } else if sig.Results().Len() != 2 {
- return fmt.Errorf("method has wrong number of args")
- }
- params := sig.Params()
- // If the first argument is the context, remove it from the comparison and set
- // the MethodHasContext flag so that the context will be passed to this model's method
- if params.Len() > 0 && params.At(0).Type().String() == "context.Context" {
- f.MethodHasContext = true
- vars := make([]*types.Var, params.Len()-1)
- for i := 1; i < params.Len(); i++ {
- vars[i-1] = params.At(i)
- }
- params = types.NewTuple(vars...)
- }
-
- if err = b.bindArgs(f, params); err != nil {
- return errors.Wrapf(err, "%s:%d", pos.Filename, pos.Line)
- }
-
- result := sig.Results().At(0)
- tr, err := b.Binder.TypeReference(f.Type, result.Type())
- if err != nil {
- return err
- }
-
- // success, args and return type match. Bind to method
- f.GoFieldType = GoFieldMethod
- f.GoReceiverName = "obj"
- f.GoFieldName = target.Name()
- f.TypeReference = tr
-
- return nil
-
- case *types.Var:
- tr, err := b.Binder.TypeReference(f.Type, target.Type())
- if err != nil {
- return err
- }
-
- // success, bind to var
- f.GoFieldType = GoFieldVariable
- f.GoReceiverName = "obj"
- f.GoFieldName = target.Name()
- f.TypeReference = tr
-
- return nil
- default:
- panic(fmt.Errorf("unknown bind target %T for %s", target, f.Name))
- }
-}
-
-// findField attempts to match the name to a struct field with the following
-// priorites:
-// 1. Any method with a matching name
-// 2. Any Fields with a struct tag (see config.StructTag)
-// 3. Any fields with a matching name
-// 4. Same logic again for embedded fields
-func (b *builder) findBindTarget(named *types.Named, name string) (types.Object, error) {
- for i := 0; i < named.NumMethods(); i++ {
- method := named.Method(i)
- if !method.Exported() {
- continue
- }
-
- if !strings.EqualFold(method.Name(), name) {
- continue
- }
-
- return method, nil
- }
-
- strukt, ok := named.Underlying().(*types.Struct)
- if !ok {
- return nil, fmt.Errorf("not a struct")
- }
- return b.findBindStructTarget(strukt, name)
-}
-
-func (b *builder) findBindStructTarget(strukt *types.Struct, name string) (types.Object, error) {
- // struct tags have the highest priority
- if b.Config.StructTag != "" {
- var foundField *types.Var
- for i := 0; i < strukt.NumFields(); i++ {
- field := strukt.Field(i)
- if !field.Exported() {
- continue
- }
- tags := reflect.StructTag(strukt.Tag(i))
- if val, ok := tags.Lookup(b.Config.StructTag); ok && equalFieldName(val, name) {
- if foundField != nil {
- return nil, errors.Errorf("tag %s is ambigious; multiple fields have the same tag value of %s", b.Config.StructTag, val)
- }
-
- foundField = field
- }
- }
- if foundField != nil {
- return foundField, nil
- }
- }
-
- // Then matching field names
- for i := 0; i < strukt.NumFields(); i++ {
- field := strukt.Field(i)
- if !field.Exported() {
- continue
- }
- if equalFieldName(field.Name(), name) { // aqui!
- return field, nil
- }
- }
-
- // Then look in embedded structs
- for i := 0; i < strukt.NumFields(); i++ {
- field := strukt.Field(i)
- if !field.Exported() {
- continue
- }
-
- if !field.Anonymous() {
- continue
- }
-
- fieldType := field.Type()
- if ptr, ok := fieldType.(*types.Pointer); ok {
- fieldType = ptr.Elem()
- }
-
- switch fieldType := fieldType.(type) {
- case *types.Named:
- f, err := b.findBindTarget(fieldType, name)
- if err != nil {
- return nil, err
- }
- if f != nil {
- return f, nil
- }
- case *types.Struct:
- f, err := b.findBindStructTarget(fieldType, name)
- if err != nil {
- return nil, err
- }
- if f != nil {
- return f, nil
- }
- default:
- panic(fmt.Errorf("unknown embedded field type %T", field.Type()))
- }
- }
-
- return nil, nil
-}
-
-func (f *Field) HasDirectives() bool {
- return len(f.ImplDirectives()) > 0
-}
-
-func (f *Field) DirectiveObjName() string {
- if f.Object.Root {
- return "nil"
- }
- return f.GoReceiverName
-}
-
-func (f *Field) ImplDirectives() []*Directive {
- var d []*Directive
- loc := ast.LocationFieldDefinition
- if f.Object.IsInputType() {
- loc = ast.LocationInputFieldDefinition
- }
- for i := range f.Directives {
- if !f.Directives[i].Builtin && f.Directives[i].IsLocation(loc) {
- d = append(d, f.Directives[i])
- }
- }
- return d
-}
-
-func (f *Field) IsReserved() bool {
- return strings.HasPrefix(f.Name, "__")
-}
-
-func (f *Field) IsMethod() bool {
- return f.GoFieldType == GoFieldMethod
-}
-
-func (f *Field) IsVariable() bool {
- return f.GoFieldType == GoFieldVariable
-}
-
-func (f *Field) IsMap() bool {
- return f.GoFieldType == GoFieldMap
-}
-
-func (f *Field) IsConcurrent() bool {
- if f.Object.DisableConcurrency {
- return false
- }
- return f.MethodHasContext || f.IsResolver
-}
-
-func (f *Field) GoNameUnexported() string {
- return templates.ToGoPrivate(f.Name)
-}
-
-func (f *Field) ShortInvocation() string {
- return fmt.Sprintf("%s().%s(%s)", f.Object.Definition.Name, f.GoFieldName, f.CallArgs())
-}
-
-func (f *Field) ArgsFunc() string {
- if len(f.Args) == 0 {
- return ""
- }
-
- return "field_" + f.Object.Definition.Name + "_" + f.Name + "_args"
-}
-
-func (f *Field) ResolverType() string {
- if !f.IsResolver {
- return ""
- }
-
- return fmt.Sprintf("%s().%s(%s)", f.Object.Definition.Name, f.GoFieldName, f.CallArgs())
-}
-
-func (f *Field) ShortResolverDeclaration() string {
- res := "(ctx context.Context"
-
- if !f.Object.Root {
- res += fmt.Sprintf(", obj *%s", templates.CurrentImports.LookupType(f.Object.Type))
- }
- for _, arg := range f.Args {
- res += fmt.Sprintf(", %s %s", arg.VarName, templates.CurrentImports.LookupType(arg.TypeReference.GO))
- }
-
- result := templates.CurrentImports.LookupType(f.TypeReference.GO)
- if f.Object.Stream {
- result = "<-chan " + result
- }
-
- res += fmt.Sprintf(") (%s, error)", result)
- return res
-}
-
-func (f *Field) ComplexitySignature() string {
- res := fmt.Sprintf("func(childComplexity int")
- for _, arg := range f.Args {
- res += fmt.Sprintf(", %s %s", arg.VarName, templates.CurrentImports.LookupType(arg.TypeReference.GO))
- }
- res += ") int"
- return res
-}
-
-func (f *Field) ComplexityArgs() string {
- args := make([]string, len(f.Args))
- for i, arg := range f.Args {
- args[i] = "args[" + strconv.Quote(arg.Name) + "].(" + templates.CurrentImports.LookupType(arg.TypeReference.GO) + ")"
- }
-
- return strings.Join(args, ", ")
-}
-
-func (f *Field) CallArgs() string {
- args := make([]string, 0, len(f.Args)+2)
-
- if f.IsResolver {
- args = append(args, "rctx")
-
- if !f.Object.Root {
- args = append(args, "obj")
- }
- } else if f.MethodHasContext {
- args = append(args, "ctx")
- }
-
- for _, arg := range f.Args {
- args = append(args, "args["+strconv.Quote(arg.Name)+"].("+templates.CurrentImports.LookupType(arg.TypeReference.GO)+")")
- }
-
- return strings.Join(args, ", ")
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/field.gotpl b/vendor/github.com/99designs/gqlgen/codegen/field.gotpl
deleted file mode 100644
index 1970614be279239942f7b4ad920378ec58dc8a49..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/field.gotpl
+++ /dev/null
@@ -1,145 +0,0 @@
-{{- range $object := .Objects }}{{- range $field := $object.Fields }}
-
-{{- if $object.Stream }}
- func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Context, field graphql.CollectedField) func() graphql.Marshaler {
- ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{
- Field: field,
- Args: nil,
- })
- {{- if $field.Args }}
- rawArgs := field.ArgumentMap(ec.Variables)
- args, err := ec.{{ $field.ArgsFunc }}(ctx,rawArgs)
- if err != nil {
- ec.Error(ctx, err)
- return nil
- }
- {{- end }}
- // FIXME: subscriptions are missing request middleware stack https://github.com/99designs/gqlgen/issues/259
- // and Tracer stack
- rctx := ctx
- results, err := ec.resolvers.{{ $field.ShortInvocation }}
- if err != nil {
- ec.Error(ctx, err)
- return nil
- }
- return func() graphql.Marshaler {
- res, ok := <-results
- if !ok {
- return nil
- }
- return graphql.WriterFunc(func(w io.Writer) {
- w.Write([]byte{'{'})
- graphql.MarshalString(field.Alias).MarshalGQL(w)
- w.Write([]byte{':'})
- ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res).MarshalGQL(w)
- w.Write([]byte{'}'})
- })
- }
- }
-{{ else }}
- func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Context, field graphql.CollectedField{{ if not $object.Root }}, obj {{$object.Reference | ref}}{{end}}) (ret graphql.Marshaler) {
- ctx = ec.Tracer.StartFieldExecution(ctx, field)
- defer func () {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = graphql.Null
- }
- ec.Tracer.EndFieldExecution(ctx)
- }()
- rctx := &graphql.ResolverContext{
- Object: {{$object.Name|quote}},
- Field: field,
- Args: nil,
- IsMethod: {{or $field.IsMethod $field.IsResolver}},
- }
- ctx = graphql.WithResolverContext(ctx, rctx)
- {{- if $field.Args }}
- rawArgs := field.ArgumentMap(ec.Variables)
- args, err := ec.{{ $field.ArgsFunc }}(ctx,rawArgs)
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- rctx.Args = args
- {{- end }}
- ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx)
- {{- if $.Directives.LocationDirectives "FIELD" }}
- resTmp := ec._fieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) {
- {{ template "field" $field }}
- })
- {{ else }}
- resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
- {{ template "field" $field }}
- })
- if err != nil {
- ec.Error(ctx, err)
- return graphql.Null
- }
- {{- end }}
- if resTmp == nil {
- {{- if $field.TypeReference.GQL.NonNull }}
- if !ec.HasError(rctx) {
- ec.Errorf(ctx, "must not be null")
- }
- {{- end }}
- return graphql.Null
- }
- res := resTmp.({{$field.TypeReference.GO | ref}})
- rctx.Result = res
- ctx = ec.Tracer.StartFieldChildExecution(ctx)
- return ec.{{ $field.TypeReference.MarshalFunc }}(ctx, field.Selections, res)
- }
-{{ end }}
-
-{{- end }}{{- end}}
-
-{{ define "field" }}
- {{- if .HasDirectives -}}
- directive0 := func(rctx context.Context) (interface{}, error) {
- ctx = rctx // use context from middleware stack in children
- {{ template "fieldDefinition" . }}
- }
- {{ template "implDirectives" . }}
- tmp, err := directive{{.ImplDirectives|len}}(rctx)
- if err != nil {
- return nil, err
- }
- if data, ok := tmp.({{ .TypeReference.GO | ref }}) ; ok {
- return data, nil
- }
- {{- if .TypeReference.IsNilable -}}
- else if tmp == nil {
- return nil, nil
- }
- {{- end }}
- return nil, fmt.Errorf(`unexpected type %T from directive, should be {{ .TypeReference.GO }}`, tmp)
- {{- else -}}
- ctx = rctx // use context from middleware stack in children
- {{ template "fieldDefinition" . }}
- {{- end -}}
-{{ end }}
-
-{{ define "fieldDefinition" }}
- {{- if .IsResolver -}}
- return ec.resolvers.{{ .ShortInvocation }}
- {{- else if .IsMap -}}
- switch v := {{.GoReceiverName}}[{{.Name|quote}}].(type) {
- case {{.TypeReference.GO | ref}}:
- return v, nil
- case {{.TypeReference.Elem.GO | ref}}:
- return &v, nil
- case nil:
- return ({{.TypeReference.GO | ref}})(nil), nil
- default:
- return nil, fmt.Errorf("unexpected type %T for field %s", v, {{ .Name | quote}})
- }
- {{- else if .IsMethod -}}
- {{- if .NoErr -}}
- return {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }}), nil
- {{- else -}}
- return {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }})
- {{- end -}}
- {{- else if .IsVariable -}}
- return {{.GoReceiverName}}.{{.GoFieldName}}, nil
- {{- end }}
-{{- end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/generate.go b/vendor/github.com/99designs/gqlgen/codegen/generate.go
deleted file mode 100644
index eafa3f87434573878137b46652a0a057ca7e2c6a..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/generate.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package codegen
-
-import (
- "github.com/99designs/gqlgen/codegen/templates"
-)
-
-func GenerateCode(data *Data) error {
- return templates.Render(templates.Options{
- PackageName: data.Config.Exec.Package,
- Filename: data.Config.Exec.Filename,
- Data: data,
- RegionTags: true,
- GeneratedHeader: true,
- })
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl b/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl
deleted file mode 100644
index a95e57b625c4e65515cf66fe082cc9b117c615ea..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl
+++ /dev/null
@@ -1,235 +0,0 @@
-{{ reserveImport "context" }}
-{{ reserveImport "fmt" }}
-{{ reserveImport "io" }}
-{{ reserveImport "strconv" }}
-{{ reserveImport "time" }}
-{{ reserveImport "sync" }}
-{{ reserveImport "sync/atomic" }}
-{{ reserveImport "errors" }}
-{{ reserveImport "bytes" }}
-
-{{ reserveImport "github.com/vektah/gqlparser" }}
-{{ reserveImport "github.com/vektah/gqlparser/ast" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }}
-
-
-// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
-func NewExecutableSchema(cfg Config) graphql.ExecutableSchema {
- return &executableSchema{
- resolvers: cfg.Resolvers,
- directives: cfg.Directives,
- complexity: cfg.Complexity,
- }
-}
-
-type Config struct {
- Resolvers ResolverRoot
- Directives DirectiveRoot
- Complexity ComplexityRoot
-}
-
-type ResolverRoot interface {
-{{- range $object := .Objects -}}
- {{ if $object.HasResolvers -}}
- {{$object.Name}}() {{$object.Name}}Resolver
- {{ end }}
-{{- end }}
-}
-
-type DirectiveRoot struct {
-{{ range $directive := .Directives }}
- {{ $directive.Declaration }}
-{{ end }}
-}
-
-type ComplexityRoot struct {
-{{ range $object := .Objects }}
- {{ if not $object.IsReserved -}}
- {{ $object.Name|go }} struct {
- {{ range $_, $fields := $object.UniqueFields }}
- {{- $field := index $fields 0 -}}
- {{ if not $field.IsReserved -}}
- {{ $field.GoFieldName }} {{ $field.ComplexitySignature }}
- {{ end }}
- {{- end }}
- }
- {{- end }}
-{{ end }}
-}
-
-{{ range $object := .Objects -}}
- {{ if $object.HasResolvers }}
- type {{$object.Name}}Resolver interface {
- {{ range $field := $object.Fields -}}
- {{- if $field.IsResolver }}
- {{- $field.GoFieldName}}{{ $field.ShortResolverDeclaration }}
- {{- end }}
- {{ end }}
- }
- {{- end }}
-{{- end }}
-
-type executableSchema struct {
- resolvers ResolverRoot
- directives DirectiveRoot
- complexity ComplexityRoot
-}
-
-func (e *executableSchema) Schema() *ast.Schema {
- return parsedSchema
-}
-
-func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) {
- ec := executionContext{nil, e}
- _ = ec
- switch typeName + "." + field {
- {{ range $object := .Objects }}
- {{ if not $object.IsReserved }}
- {{ range $_, $fields := $object.UniqueFields }}
- {{- $len := len $fields }}
- {{- range $i, $field := $fields }}
- {{- $last := eq (add $i 1) $len }}
- {{- if not $field.IsReserved }}
- {{- if eq $i 0 }}case {{ end }}"{{$object.Name}}.{{$field.Name}}"{{ if not $last }},{{ else }}:
- if e.complexity.{{$object.Name|go}}.{{$field.GoFieldName}} == nil {
- break
- }
- {{ if $field.Args }}
- args, err := ec.{{ $field.ArgsFunc }}(context.TODO(),rawArgs)
- if err != nil {
- return 0, false
- }
- {{ end }}
- return e.complexity.{{$object.Name|go}}.{{$field.GoFieldName}}(childComplexity{{if $field.Args}}, {{$field.ComplexityArgs}} {{ end }}), true
- {{ end }}
- {{- end }}
- {{- end }}
- {{ end }}
- {{ end }}
- {{ end }}
- }
- return 0, false
-}
-
-func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {
- {{- if .QueryRoot }}
- ec := executionContext{graphql.GetRequestContext(ctx), e}
-
- buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {
- {{ if .Directives.LocationDirectives "QUERY" -}}
- data := ec._queryMiddleware(ctx, op, func(ctx context.Context) (interface{}, error){
- return ec._{{.QueryRoot.Name}}(ctx, op.SelectionSet), nil
- })
- {{- else -}}
- data := ec._{{.QueryRoot.Name}}(ctx, op.SelectionSet)
- {{- end }}
- var buf bytes.Buffer
- data.MarshalGQL(&buf)
- return buf.Bytes()
- })
-
- return &graphql.Response{
- Data: buf,
- Errors: ec.Errors,
- Extensions: ec.Extensions,
- }
- {{- else }}
- return graphql.ErrorResponse(ctx, "queries are not supported")
- {{- end }}
-}
-
-func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {
- {{- if .MutationRoot }}
- ec := executionContext{graphql.GetRequestContext(ctx), e}
-
- buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {
- {{ if .Directives.LocationDirectives "MUTATION" -}}
- data := ec._mutationMiddleware(ctx, op, func(ctx context.Context) (interface{}, error){
- return ec._{{.MutationRoot.Name}}(ctx, op.SelectionSet), nil
- })
- {{- else -}}
- data := ec._{{.MutationRoot.Name}}(ctx, op.SelectionSet)
- {{- end }}
- var buf bytes.Buffer
- data.MarshalGQL(&buf)
- return buf.Bytes()
- })
-
- return &graphql.Response{
- Data: buf,
- Errors: ec.Errors,
- Extensions: ec.Extensions,
- }
- {{- else }}
- return graphql.ErrorResponse(ctx, "mutations are not supported")
- {{- end }}
-}
-
-func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response {
- {{- if .SubscriptionRoot }}
- ec := executionContext{graphql.GetRequestContext(ctx), e}
-
- {{ if .Directives.LocationDirectives "SUBSCRIPTION" -}}
- next := ec._subscriptionMiddleware(ctx, op, func(ctx context.Context) (interface{}, error){
- return ec._{{.SubscriptionRoot.Name}}(ctx, op.SelectionSet),nil
- })
- {{- else -}}
- next := ec._{{.SubscriptionRoot.Name}}(ctx, op.SelectionSet)
- {{- end }}
- if ec.Errors != nil {
- return graphql.OneShot(&graphql.Response{Data: []byte("null"), Errors: ec.Errors})
- }
-
- var buf bytes.Buffer
- return func() *graphql.Response {
- buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte {
- buf.Reset()
- data := next()
-
- if data == nil {
- return nil
- }
- data.MarshalGQL(&buf)
- return buf.Bytes()
- })
-
- if buf == nil {
- return nil
- }
-
- return &graphql.Response{
- Data: buf,
- Errors: ec.Errors,
- Extensions: ec.Extensions,
- }
- }
- {{- else }}
- return graphql.OneShot(graphql.ErrorResponse(ctx, "subscriptions are not supported"))
- {{- end }}
-}
-
-type executionContext struct {
- *graphql.RequestContext
- *executableSchema
-}
-
-func (ec *executionContext) introspectSchema() (*introspection.Schema, error) {
- if ec.DisableIntrospection {
- return nil, errors.New("introspection disabled")
- }
- return introspection.WrapSchema(parsedSchema), nil
-}
-
-func (ec *executionContext) introspectType(name string) (*introspection.Type, error) {
- if ec.DisableIntrospection {
- return nil, errors.New("introspection disabled")
- }
- return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil
-}
-
-var parsedSchema = gqlparser.MustLoadSchema(
- {{- range $filename, $schema := .SchemaStr }}
- &ast.Source{Name: {{$filename|quote}}, Input: {{$schema|rawQuote}}},
- {{- end }}
-)
diff --git a/vendor/github.com/99designs/gqlgen/codegen/input.gotpl b/vendor/github.com/99designs/gqlgen/codegen/input.gotpl
deleted file mode 100644
index bdf3622caf11069379dffc210a8751061d3c8dd5..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/input.gotpl
+++ /dev/null
@@ -1,48 +0,0 @@
-{{- range $input := .Inputs }}
- {{- if not .HasUnmarshal }}
- func (ec *executionContext) unmarshalInput{{ .Name }}(ctx context.Context, obj interface{}) ({{.Type | ref}}, error) {
- var it {{.Type | ref}}
- var asMap = obj.(map[string]interface{})
- {{ range $field := .Fields}}
- {{- if $field.Default}}
- if _, present := asMap[{{$field.Name|quote}}] ; !present {
- asMap[{{$field.Name|quote}}] = {{ $field.Default | dump }}
- }
- {{- end}}
- {{- end }}
-
- for k, v := range asMap {
- switch k {
- {{- range $field := .Fields }}
- case {{$field.Name|quote}}:
- var err error
- {{- if $field.ImplDirectives }}
- directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) }
- {{ template "implDirectives" $field }}
- tmp, err := directive{{$field.ImplDirectives|len}}(ctx)
- if err != nil {
- return it, err
- }
- if data, ok := tmp.({{ $field.TypeReference.GO | ref }}) ; ok {
- it.{{$field.GoFieldName}} = data
- {{- if $field.TypeReference.IsNilable }}
- } else if tmp == nil {
- it.{{$field.GoFieldName}} = nil
- {{- end }}
- } else {
- return it, fmt.Errorf(`unexpected type %T from directive, should be {{ $field.TypeReference.GO }}`, tmp)
- }
- {{- else }}
- it.{{$field.GoFieldName}}, err = ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v)
- if err != nil {
- return it, err
- }
- {{- end }}
- {{- end }}
- }
- }
-
- return it, nil
- }
- {{- end }}
-{{ end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/interface.go b/vendor/github.com/99designs/gqlgen/codegen/interface.go
deleted file mode 100644
index f59e8ed07154ec21afef1fe0ce613a759370bfc4..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/interface.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package codegen
-
-import (
- "go/types"
-
- "github.com/vektah/gqlparser/ast"
-)
-
-type Interface struct {
- *ast.Definition
- Type types.Type
- Implementors []InterfaceImplementor
- InTypemap bool
-}
-
-type InterfaceImplementor struct {
- *ast.Definition
-
- Interface *Interface
- Type types.Type
-}
-
-func (b *builder) buildInterface(typ *ast.Definition) *Interface {
- obj, err := b.Binder.DefaultUserObject(typ.Name)
- if err != nil {
- panic(err)
- }
-
- i := &Interface{
- Definition: typ,
- Type: obj,
- InTypemap: b.Config.Models.UserDefined(typ.Name),
- }
-
- for _, implementor := range b.Schema.GetPossibleTypes(typ) {
- obj, err := b.Binder.DefaultUserObject(implementor.Name)
- if err != nil {
- panic(err)
- }
-
- i.Implementors = append(i.Implementors, InterfaceImplementor{
- Definition: implementor,
- Type: obj,
- Interface: i,
- })
- }
-
- return i
-}
-
-func (i *InterfaceImplementor) ValueReceiver() bool {
- interfaceType, err := findGoInterface(i.Interface.Type)
- if interfaceType == nil || err != nil {
- return true
- }
-
- implementorType, err := findGoNamedType(i.Type)
- if implementorType == nil || err != nil {
- return true
- }
-
- return types.Implements(implementorType, interfaceType)
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl b/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl
deleted file mode 100644
index 81a5807653ca3a4a01843720b533d6e8a3cb36fd..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/interface.gotpl
+++ /dev/null
@@ -1,20 +0,0 @@
-{{- range $interface := .Interfaces }}
-
-func (ec *executionContext) _{{$interface.Name}}(ctx context.Context, sel ast.SelectionSet, obj *{{$interface.Type | ref}}) graphql.Marshaler {
- switch obj := (*obj).(type) {
- case nil:
- return graphql.Null
- {{- range $implementor := $interface.Implementors }}
- {{- if $implementor.ValueReceiver }}
- case {{$implementor.Type | ref}}:
- return ec._{{$implementor.Name}}(ctx, sel, &obj)
- {{- end}}
- case *{{$implementor.Type | ref}}:
- return ec._{{$implementor.Name}}(ctx, sel, obj)
- {{- end }}
- default:
- panic(fmt.Errorf("unexpected type %T", obj))
- }
-}
-
-{{- end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/object.go b/vendor/github.com/99designs/gqlgen/codegen/object.go
deleted file mode 100644
index 08ae09aa423bf40ef5e00712d57218986a855a6f..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/object.go
+++ /dev/null
@@ -1,171 +0,0 @@
-package codegen
-
-import (
- "go/types"
- "strconv"
- "strings"
- "unicode"
-
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/pkg/errors"
- "github.com/vektah/gqlparser/ast"
-)
-
-type GoFieldType int
-
-const (
- GoFieldUndefined GoFieldType = iota
- GoFieldMethod
- GoFieldVariable
- GoFieldMap
-)
-
-type Object struct {
- *ast.Definition
-
- Type types.Type
- ResolverInterface types.Type
- Root bool
- Fields []*Field
- Implements []*ast.Definition
- DisableConcurrency bool
- Stream bool
- Directives []*Directive
-}
-
-func (b *builder) buildObject(typ *ast.Definition) (*Object, error) {
- dirs, err := b.getDirectives(typ.Directives)
- if err != nil {
- return nil, errors.Wrap(err, typ.Name)
- }
-
- obj := &Object{
- Definition: typ,
- Root: b.Schema.Query == typ || b.Schema.Mutation == typ || b.Schema.Subscription == typ,
- DisableConcurrency: typ == b.Schema.Mutation,
- Stream: typ == b.Schema.Subscription,
- Directives: dirs,
- ResolverInterface: types.NewNamed(
- types.NewTypeName(0, b.Config.Exec.Pkg(), typ.Name+"Resolver", nil),
- nil,
- nil,
- ),
- }
-
- if !obj.Root {
- goObject, err := b.Binder.DefaultUserObject(typ.Name)
- if err != nil {
- return nil, err
- }
- obj.Type = goObject
- }
-
- for _, intf := range b.Schema.GetImplements(typ) {
- obj.Implements = append(obj.Implements, b.Schema.Types[intf.Name])
- }
-
- for _, field := range typ.Fields {
- if strings.HasPrefix(field.Name, "__") {
- continue
- }
-
- var f *Field
- f, err = b.buildField(obj, field)
- if err != nil {
- return nil, err
- }
-
- obj.Fields = append(obj.Fields, f)
- }
-
- return obj, nil
-}
-
-func (o *Object) Reference() types.Type {
- switch o.Type.(type) {
- case *types.Pointer, *types.Slice, *types.Map:
- return o.Type
- }
-
- return types.NewPointer(o.Type)
-}
-
-type Objects []*Object
-
-func (o *Object) Implementors() string {
- satisfiedBy := strconv.Quote(o.Name)
- for _, s := range o.Implements {
- satisfiedBy += ", " + strconv.Quote(s.Name)
- }
- return "[]string{" + satisfiedBy + "}"
-}
-
-func (o *Object) HasResolvers() bool {
- for _, f := range o.Fields {
- if f.IsResolver {
- return true
- }
- }
- return false
-}
-
-func (o *Object) HasUnmarshal() bool {
- if o.Type == config.MapType {
- return true
- }
- for i := 0; i < o.Type.(*types.Named).NumMethods(); i++ {
- if o.Type.(*types.Named).Method(i).Name() == "UnmarshalGQL" {
- return true
- }
- }
- return false
-}
-
-func (o *Object) HasDirectives() bool {
- if len(o.Directives) > 0 {
- return true
- }
- for _, f := range o.Fields {
- if f.HasDirectives() {
- return true
- }
- }
-
- return false
-}
-
-func (o *Object) IsConcurrent() bool {
- for _, f := range o.Fields {
- if f.IsConcurrent() {
- return true
- }
- }
- return false
-}
-
-func (o *Object) IsReserved() bool {
- return strings.HasPrefix(o.Definition.Name, "__")
-}
-
-func (o *Object) Description() string {
- return o.Definition.Description
-}
-
-func (os Objects) ByName(name string) *Object {
- for i, o := range os {
- if strings.EqualFold(o.Definition.Name, name) {
- return os[i]
- }
- }
- return nil
-}
-
-func ucFirst(s string) string {
- if s == "" {
- return ""
- }
-
- r := []rune(s)
- r[0] = unicode.ToUpper(r[0])
- return string(r)
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/object.gotpl b/vendor/github.com/99designs/gqlgen/codegen/object.gotpl
deleted file mode 100644
index 98a75740e66dd3b45d7877b218239c65993c0f69..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/object.gotpl
+++ /dev/null
@@ -1,85 +0,0 @@
-{{- range $object := .Objects }}
-
-var {{ $object.Name|lcFirst}}Implementors = {{$object.Implementors}}
-
-{{- if .Stream }}
-func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, {{$object.Name|lcFirst}}Implementors)
- ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{
- Object: {{$object.Name|quote}},
- })
- if len(fields) != 1 {
- ec.Errorf(ctx, "must subscribe to exactly one stream")
- return nil
- }
-
- switch fields[0].Name {
- {{- range $field := $object.Fields }}
- case "{{$field.Name}}":
- return ec._{{$object.Name}}_{{$field.Name}}(ctx, fields[0])
- {{- end }}
- default:
- panic("unknown field " + strconv.Quote(fields[0].Name))
- }
-}
-{{- else }}
-func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet{{ if not $object.Root }},obj {{$object.Reference | ref }}{{ end }}) graphql.Marshaler {
- fields := graphql.CollectFields(ec.RequestContext, sel, {{$object.Name|lcFirst}}Implementors)
- {{if $object.Root}}
- ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{
- Object: {{$object.Name|quote}},
- })
- {{end}}
-
- out := graphql.NewFieldSet(fields)
- var invalids uint32
- for i, field := range fields {
- switch field.Name {
- case "__typename":
- out.Values[i] = graphql.MarshalString({{$object.Name|quote}})
- {{- range $field := $object.Fields }}
- case "{{$field.Name}}":
- {{- if $field.IsConcurrent }}
- field := field
- out.Concurrently(i, func() (res graphql.Marshaler) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- }
- }()
- res = ec._{{$object.Name}}_{{$field.Name}}(ctx, field{{if not $object.Root}}, obj{{end}})
- {{- if $field.TypeReference.GQL.NonNull }}
- if res == graphql.Null {
- {{- if $object.IsConcurrent }}
- atomic.AddUint32(&invalids, 1)
- {{- else }}
- invalids++
- {{- end }}
- }
- {{- end }}
- return res
- })
- {{- else }}
- out.Values[i] = ec._{{$object.Name}}_{{$field.Name}}(ctx, field{{if not $object.Root}}, obj{{end}})
- {{- if $field.TypeReference.GQL.NonNull }}
- if out.Values[i] == graphql.Null {
- {{- if $object.IsConcurrent }}
- atomic.AddUint32(&invalids, 1)
- {{- else }}
- invalids++
- {{- end }}
- }
- {{- end }}
- {{- end }}
- {{- end }}
- default:
- panic("unknown field " + strconv.Quote(field.Name))
- }
- }
- out.Dispatch()
- if invalids > 0 { return graphql.Null }
- return out
-}
-{{- end }}
-
-{{- end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/import.go b/vendor/github.com/99designs/gqlgen/codegen/templates/import.go
deleted file mode 100644
index d5bd16a6a1eec44884afe2d64a29bc98935d0f53..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/templates/import.go
+++ /dev/null
@@ -1,138 +0,0 @@
-package templates
-
-import (
- "fmt"
- "go/types"
- "strconv"
- "strings"
-
- "github.com/99designs/gqlgen/internal/code"
-)
-
-type Import struct {
- Name string
- Path string
- Alias string
-}
-
-type Imports struct {
- imports []*Import
- destDir string
-}
-
-func (i *Import) String() string {
- if strings.HasSuffix(i.Path, i.Alias) {
- return strconv.Quote(i.Path)
- }
-
- return i.Alias + " " + strconv.Quote(i.Path)
-}
-
-func (s *Imports) String() string {
- res := ""
- for i, imp := range s.imports {
- if i != 0 {
- res += "\n"
- }
- res += imp.String()
- }
- return res
-}
-
-func (s *Imports) Reserve(path string, aliases ...string) (string, error) {
- if path == "" {
- panic("empty ambient import")
- }
-
- // if we are referencing our own package we dont need an import
- if code.ImportPathForDir(s.destDir) == path {
- return "", nil
- }
-
- name := code.NameForPackage(path)
- var alias string
- if len(aliases) != 1 {
- alias = name
- } else {
- alias = aliases[0]
- }
-
- if existing := s.findByPath(path); existing != nil {
- if existing.Alias == alias {
- return "", nil
- }
- return "", fmt.Errorf("ambient import already exists")
- }
-
- if alias := s.findByAlias(alias); alias != nil {
- return "", fmt.Errorf("ambient import collides on an alias")
- }
-
- s.imports = append(s.imports, &Import{
- Name: name,
- Path: path,
- Alias: alias,
- })
-
- return "", nil
-}
-
-func (s *Imports) Lookup(path string) string {
- if path == "" {
- return ""
- }
-
- path = code.NormalizeVendor(path)
-
- // if we are referencing our own package we dont need an import
- if code.ImportPathForDir(s.destDir) == path {
- return ""
- }
-
- if existing := s.findByPath(path); existing != nil {
- return existing.Alias
- }
-
- imp := &Import{
- Name: code.NameForPackage(path),
- Path: path,
- }
- s.imports = append(s.imports, imp)
-
- alias := imp.Name
- i := 1
- for s.findByAlias(alias) != nil {
- alias = imp.Name + strconv.Itoa(i)
- i++
- if i > 10 {
- panic(fmt.Errorf("too many collisions, last attempt was %s", alias))
- }
- }
- imp.Alias = alias
-
- return imp.Alias
-}
-
-func (s *Imports) LookupType(t types.Type) string {
- return types.TypeString(t, func(i *types.Package) string {
- return s.Lookup(i.Path())
- })
-}
-
-func (s Imports) findByPath(importPath string) *Import {
- for _, imp := range s.imports {
- if imp.Path == importPath {
- return imp
- }
- }
- return nil
-}
-
-func (s Imports) findByAlias(alias string) *Import {
- for _, imp := range s.imports {
- if imp.Alias == alias {
- return imp
- }
- }
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go b/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go
deleted file mode 100644
index 5d5f69bf88dff7ed9614c02d3bff811d858e05e0..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go
+++ /dev/null
@@ -1,572 +0,0 @@
-package templates
-
-import (
- "bytes"
- "fmt"
- "go/types"
- "io/ioutil"
- "os"
- "path/filepath"
- "reflect"
- "runtime"
- "sort"
- "strconv"
- "strings"
- "text/template"
- "unicode"
-
- "github.com/99designs/gqlgen/internal/imports"
- "github.com/pkg/errors"
-)
-
-// CurrentImports keeps track of all the import declarations that are needed during the execution of a plugin.
-// this is done with a global because subtemplates currently get called in functions. Lets aim to remove this eventually.
-var CurrentImports *Imports
-
-// Options specify various parameters to rendering a template.
-type Options struct {
- // PackageName is a helper that specifies the package header declaration.
- // In other words, when you write the template you don't need to specify `package X`
- // at the top of the file. By providing PackageName in the Options, the Render
- // function will do that for you.
- PackageName string
- // Template is a string of the entire template that
- // will be parsed and rendered. If it's empty,
- // the plugin processor will look for .gotpl files
- // in the same directory of where you wrote the plugin.
- Template string
- // Filename is the name of the file that will be
- // written to the system disk once the template is rendered.
- Filename string
- RegionTags bool
- GeneratedHeader bool
- // Data will be passed to the template execution.
- Data interface{}
- Funcs template.FuncMap
-}
-
-// Render renders a gql plugin template from the given Options. Render is an
-// abstraction of the text/template package that makes it easier to write gqlgen
-// plugins. If Options.Template is empty, the Render function will look for `.gotpl`
-// files inside the directory where you wrote the plugin.
-func Render(cfg Options) error {
- if CurrentImports != nil {
- panic(fmt.Errorf("recursive or concurrent call to RenderToFile detected"))
- }
- CurrentImports = &Imports{destDir: filepath.Dir(cfg.Filename)}
-
- // load path relative to calling source file
- _, callerFile, _, _ := runtime.Caller(1)
- rootDir := filepath.Dir(callerFile)
-
- funcs := Funcs()
- for n, f := range cfg.Funcs {
- funcs[n] = f
- }
- t := template.New("").Funcs(funcs)
-
- var roots []string
- if cfg.Template != "" {
- var err error
- t, err = t.New("template.gotpl").Parse(cfg.Template)
- if err != nil {
- return errors.Wrap(err, "error with provided template")
- }
- roots = append(roots, "template.gotpl")
- } else {
- // load all the templates in the directory
- err := filepath.Walk(rootDir, func(path string, info os.FileInfo, err error) error {
- if err != nil {
- return err
- }
- name := filepath.ToSlash(strings.TrimPrefix(path, rootDir+string(os.PathSeparator)))
- if !strings.HasSuffix(info.Name(), ".gotpl") {
- return nil
- }
- b, err := ioutil.ReadFile(path)
- if err != nil {
- return err
- }
-
- t, err = t.New(name).Parse(string(b))
- if err != nil {
- return errors.Wrap(err, cfg.Filename)
- }
-
- roots = append(roots, name)
-
- return nil
- })
- if err != nil {
- return errors.Wrap(err, "locating templates")
- }
- }
-
- // then execute all the important looking ones in order, adding them to the same file
- sort.Slice(roots, func(i, j int) bool {
- // important files go first
- if strings.HasSuffix(roots[i], "!.gotpl") {
- return true
- }
- if strings.HasSuffix(roots[j], "!.gotpl") {
- return false
- }
- return roots[i] < roots[j]
- })
- var buf bytes.Buffer
- for _, root := range roots {
- if cfg.RegionTags {
- buf.WriteString("\n// region " + center(70, "*", " "+root+" ") + "\n")
- }
- err := t.Lookup(root).Execute(&buf, cfg.Data)
- if err != nil {
- return errors.Wrap(err, root)
- }
- if cfg.RegionTags {
- buf.WriteString("\n// endregion " + center(70, "*", " "+root+" ") + "\n")
- }
- }
-
- var result bytes.Buffer
- if cfg.GeneratedHeader {
- result.WriteString("// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.\n\n")
- }
- result.WriteString("package ")
- result.WriteString(cfg.PackageName)
- result.WriteString("\n\n")
- result.WriteString("import (\n")
- result.WriteString(CurrentImports.String())
- result.WriteString(")\n")
- _, err := buf.WriteTo(&result)
- if err != nil {
- return err
- }
- CurrentImports = nil
-
- return write(cfg.Filename, result.Bytes())
-}
-
-func center(width int, pad string, s string) string {
- if len(s)+2 > width {
- return s
- }
- lpad := (width - len(s)) / 2
- rpad := width - (lpad + len(s))
- return strings.Repeat(pad, lpad) + s + strings.Repeat(pad, rpad)
-}
-
-func Funcs() template.FuncMap {
- return template.FuncMap{
- "ucFirst": ucFirst,
- "lcFirst": lcFirst,
- "quote": strconv.Quote,
- "rawQuote": rawQuote,
- "dump": Dump,
- "ref": ref,
- "ts": TypeIdentifier,
- "call": Call,
- "prefixLines": prefixLines,
- "notNil": notNil,
- "reserveImport": CurrentImports.Reserve,
- "lookupImport": CurrentImports.Lookup,
- "go": ToGo,
- "goPrivate": ToGoPrivate,
- "add": func(a, b int) int {
- return a + b
- },
- "render": func(filename string, tpldata interface{}) (*bytes.Buffer, error) {
- return render(resolveName(filename, 0), tpldata)
- },
- }
-}
-
-func ucFirst(s string) string {
- if s == "" {
- return ""
- }
- r := []rune(s)
- r[0] = unicode.ToUpper(r[0])
- return string(r)
-}
-
-func lcFirst(s string) string {
- if s == "" {
- return ""
- }
-
- r := []rune(s)
- r[0] = unicode.ToLower(r[0])
- return string(r)
-}
-
-func isDelimiter(c rune) bool {
- return c == '-' || c == '_' || unicode.IsSpace(c)
-}
-
-func ref(p types.Type) string {
- return CurrentImports.LookupType(p)
-}
-
-var pkgReplacer = strings.NewReplacer(
- "/", "ᚋ",
- ".", "ᚗ",
- "-", "ᚑ",
-)
-
-func TypeIdentifier(t types.Type) string {
- res := ""
- for {
- switch it := t.(type) {
- case *types.Pointer:
- t.Underlying()
- res += "ᚖ"
- t = it.Elem()
- case *types.Slice:
- res += "ᚕ"
- t = it.Elem()
- case *types.Named:
- res += pkgReplacer.Replace(it.Obj().Pkg().Path())
- res += "ᚐ"
- res += it.Obj().Name()
- return res
- case *types.Basic:
- res += it.Name()
- return res
- case *types.Map:
- res += "map"
- return res
- case *types.Interface:
- res += "interface"
- return res
- default:
- panic(fmt.Errorf("unexpected type %T", it))
- }
- }
-}
-
-func Call(p *types.Func) string {
- pkg := CurrentImports.Lookup(p.Pkg().Path())
-
- if pkg != "" {
- pkg += "."
- }
-
- if p.Type() != nil {
- // make sure the returned type is listed in our imports.
- ref(p.Type().(*types.Signature).Results().At(0).Type())
- }
-
- return pkg + p.Name()
-}
-
-func ToGo(name string) string {
- runes := make([]rune, 0, len(name))
-
- wordWalker(name, func(info *wordInfo) {
- word := info.Word
- if info.MatchCommonInitial {
- word = strings.ToUpper(word)
- } else if !info.HasCommonInitial {
- if strings.ToUpper(word) == word || strings.ToLower(word) == word {
- // FOO or foo → Foo
- // FOo → FOo
- word = ucFirst(strings.ToLower(word))
- }
- }
- runes = append(runes, []rune(word)...)
- })
-
- return string(runes)
-}
-
-func ToGoPrivate(name string) string {
- runes := make([]rune, 0, len(name))
-
- first := true
- wordWalker(name, func(info *wordInfo) {
- word := info.Word
- switch {
- case first:
- if strings.ToUpper(word) == word || strings.ToLower(word) == word {
- // ID → id, CAMEL → camel
- word = strings.ToLower(info.Word)
- } else {
- // ITicket → iTicket
- word = lcFirst(info.Word)
- }
- first = false
- case info.MatchCommonInitial:
- word = strings.ToUpper(word)
- case !info.HasCommonInitial:
- word = ucFirst(strings.ToLower(word))
- }
- runes = append(runes, []rune(word)...)
- })
-
- return sanitizeKeywords(string(runes))
-}
-
-type wordInfo struct {
- Word string
- MatchCommonInitial bool
- HasCommonInitial bool
-}
-
-// This function is based on the following code.
-// https://github.com/golang/lint/blob/06c8688daad7faa9da5a0c2f163a3d14aac986ca/lint.go#L679
-func wordWalker(str string, f func(*wordInfo)) {
- runes := []rune(str)
- w, i := 0, 0 // index of start of word, scan
- hasCommonInitial := false
- for i+1 <= len(runes) {
- eow := false // whether we hit the end of a word
- switch {
- case i+1 == len(runes):
- eow = true
- case isDelimiter(runes[i+1]):
- // underscore; shift the remainder forward over any run of underscores
- eow = true
- n := 1
- for i+n+1 < len(runes) && isDelimiter(runes[i+n+1]) {
- n++
- }
-
- // Leave at most one underscore if the underscore is between two digits
- if i+n+1 < len(runes) && unicode.IsDigit(runes[i]) && unicode.IsDigit(runes[i+n+1]) {
- n--
- }
-
- copy(runes[i+1:], runes[i+n+1:])
- runes = runes[:len(runes)-n]
- case unicode.IsLower(runes[i]) && !unicode.IsLower(runes[i+1]):
- // lower->non-lower
- eow = true
- }
- i++
-
- // [w,i) is a word.
- word := string(runes[w:i])
- if !eow && commonInitialisms[word] && !unicode.IsLower(runes[i]) {
- // through
- // split IDFoo → ID, Foo
- // but URLs → URLs
- } else if !eow {
- if commonInitialisms[word] {
- hasCommonInitial = true
- }
- continue
- }
-
- matchCommonInitial := false
- if commonInitialisms[strings.ToUpper(word)] {
- hasCommonInitial = true
- matchCommonInitial = true
- }
-
- f(&wordInfo{
- Word: word,
- MatchCommonInitial: matchCommonInitial,
- HasCommonInitial: hasCommonInitial,
- })
- hasCommonInitial = false
- w = i
- }
-}
-
-var keywords = []string{
- "break",
- "default",
- "func",
- "interface",
- "select",
- "case",
- "defer",
- "go",
- "map",
- "struct",
- "chan",
- "else",
- "goto",
- "package",
- "switch",
- "const",
- "fallthrough",
- "if",
- "range",
- "type",
- "continue",
- "for",
- "import",
- "return",
- "var",
- "_",
-}
-
-// sanitizeKeywords prevents collisions with go keywords for arguments to resolver functions
-func sanitizeKeywords(name string) string {
- for _, k := range keywords {
- if name == k {
- return name + "Arg"
- }
- }
- return name
-}
-
-// commonInitialisms is a set of common initialisms.
-// Only add entries that are highly unlikely to be non-initialisms.
-// For instance, "ID" is fine (Freudian code is rare), but "AND" is not.
-var commonInitialisms = map[string]bool{
- "ACL": true,
- "API": true,
- "ASCII": true,
- "CPU": true,
- "CSS": true,
- "DNS": true,
- "EOF": true,
- "GUID": true,
- "HTML": true,
- "HTTP": true,
- "HTTPS": true,
- "ID": true,
- "IP": true,
- "JSON": true,
- "LHS": true,
- "QPS": true,
- "RAM": true,
- "RHS": true,
- "RPC": true,
- "SLA": true,
- "SMTP": true,
- "SQL": true,
- "SSH": true,
- "TCP": true,
- "TLS": true,
- "TTL": true,
- "UDP": true,
- "UI": true,
- "UID": true,
- "UUID": true,
- "URI": true,
- "URL": true,
- "UTF8": true,
- "VM": true,
- "XML": true,
- "XMPP": true,
- "XSRF": true,
- "XSS": true,
-}
-
-func rawQuote(s string) string {
- return "`" + strings.Replace(s, "`", "`+\"`\"+`", -1) + "`"
-}
-
-func notNil(field string, data interface{}) bool {
- v := reflect.ValueOf(data)
-
- if v.Kind() == reflect.Ptr {
- v = v.Elem()
- }
- if v.Kind() != reflect.Struct {
- return false
- }
- val := v.FieldByName(field)
-
- return val.IsValid() && !val.IsNil()
-}
-
-func Dump(val interface{}) string {
- switch val := val.(type) {
- case int:
- return strconv.Itoa(val)
- case int64:
- return fmt.Sprintf("%d", val)
- case float64:
- return fmt.Sprintf("%f", val)
- case string:
- return strconv.Quote(val)
- case bool:
- return strconv.FormatBool(val)
- case nil:
- return "nil"
- case []interface{}:
- var parts []string
- for _, part := range val {
- parts = append(parts, Dump(part))
- }
- return "[]interface{}{" + strings.Join(parts, ",") + "}"
- case map[string]interface{}:
- buf := bytes.Buffer{}
- buf.WriteString("map[string]interface{}{")
- var keys []string
- for key := range val {
- keys = append(keys, key)
- }
- sort.Strings(keys)
-
- for _, key := range keys {
- data := val[key]
-
- buf.WriteString(strconv.Quote(key))
- buf.WriteString(":")
- buf.WriteString(Dump(data))
- buf.WriteString(",")
- }
- buf.WriteString("}")
- return buf.String()
- default:
- panic(fmt.Errorf("unsupported type %T", val))
- }
-}
-
-func prefixLines(prefix, s string) string {
- return prefix + strings.Replace(s, "\n", "\n"+prefix, -1)
-}
-
-func resolveName(name string, skip int) string {
- if name[0] == '.' {
- // load path relative to calling source file
- _, callerFile, _, _ := runtime.Caller(skip + 1)
- return filepath.Join(filepath.Dir(callerFile), name[1:])
- }
-
- // load path relative to this directory
- _, callerFile, _, _ := runtime.Caller(0)
- return filepath.Join(filepath.Dir(callerFile), name)
-}
-
-func render(filename string, tpldata interface{}) (*bytes.Buffer, error) {
- t := template.New("").Funcs(Funcs())
-
- b, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
-
- t, err = t.New(filepath.Base(filename)).Parse(string(b))
- if err != nil {
- panic(err)
- }
-
- buf := &bytes.Buffer{}
- return buf, t.Execute(buf, tpldata)
-}
-
-func write(filename string, b []byte) error {
- err := os.MkdirAll(filepath.Dir(filename), 0755)
- if err != nil {
- return errors.Wrap(err, "failed to create directory")
- }
-
- formatted, err := imports.Prune(filename, b)
- if err != nil {
- fmt.Fprintf(os.Stderr, "gofmt failed on %s: %s\n", filepath.Base(filename), err.Error())
- formatted = b
- }
-
- err = ioutil.WriteFile(filename, formatted, 0644)
- if err != nil {
- return errors.Wrapf(err, "failed to write %s", filename)
- }
-
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/type.go b/vendor/github.com/99designs/gqlgen/codegen/type.go
deleted file mode 100644
index 4a14454cf581222828c5b8e62989115ad18db51d..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/type.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package codegen
-
-import (
- "github.com/99designs/gqlgen/codegen/config"
-)
-
-func (b *builder) buildTypes() map[string]*config.TypeReference {
- ret := map[string]*config.TypeReference{}
-
- for _, ref := range b.Binder.References {
- for ref != nil {
- ret[ref.UniquenessKey()] = ref
-
- ref = ref.Elem()
- }
- }
- return ret
-}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/type.gotpl b/vendor/github.com/99designs/gqlgen/codegen/type.gotpl
deleted file mode 100644
index cb2782c39edf9ecb0c9f066139e73c28292162ca..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/type.gotpl
+++ /dev/null
@@ -1,130 +0,0 @@
-{{- range $type := .ReferencedTypes }}
- {{ with $type.UnmarshalFunc }}
- func (ec *executionContext) {{ . }}(ctx context.Context, v interface{}) ({{ $type.GO | ref }}, error) {
- {{- if $type.IsNilable }}
- if v == nil { return nil, nil }
- {{- end }}
- {{- if $type.IsPtr }}
- res, err := ec.{{ $type.Elem.UnmarshalFunc }}(ctx, v)
- return &res, err
- {{- else if $type.IsSlice }}
- var vSlice []interface{}
- if v != nil {
- if tmp1, ok := v.([]interface{}); ok {
- vSlice = tmp1
- } else {
- vSlice = []interface{}{ v }
- }
- }
- var err error
- res := make([]{{$type.GO.Elem | ref}}, len(vSlice))
- for i := range vSlice {
- res[i], err = ec.{{ $type.Elem.UnmarshalFunc }}(ctx, vSlice[i])
- if err != nil {
- return nil, err
- }
- }
- return res, nil
- {{- else }}
- {{- if $type.Unmarshaler }}
- {{- if $type.CastType }}
- tmp, err := {{ $type.Unmarshaler | call }}(v)
- return {{ $type.GO | ref }}(tmp), err
- {{- else}}
- return {{ $type.Unmarshaler | call }}(v)
- {{- end }}
- {{- else if eq ($type.GO | ref) "map[string]interface{}" }}
- return v.(map[string]interface{}), nil
- {{- else if $type.IsMarshaler -}}
- var res {{ $type.GO | ref }}
- return res, res.UnmarshalGQL(v)
- {{- else }}
- return ec.unmarshalInput{{ $type.GQL.Name }}(ctx, v)
- {{- end }}
- {{- end }}
- }
- {{- end }}
-
- {{ with $type.MarshalFunc }}
- func (ec *executionContext) {{ . }}(ctx context.Context, sel ast.SelectionSet, v {{ $type.GO | ref }}) graphql.Marshaler {
- {{- if $type.IsNilable }}
- if v == nil {
- {{- if $type.GQL.NonNull }}
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
- ec.Errorf(ctx, "must not be null")
- }
- {{- end }}
- return graphql.Null
- }
- {{- end }}
-
- {{- if $type.IsSlice }}
- {{- if not $type.GQL.NonNull }}
- if v == nil {
- return graphql.Null
- }
- {{- end }}
- ret := make(graphql.Array, len(v))
- {{- if not $type.IsScalar }}
- var wg sync.WaitGroup
- isLen1 := len(v) == 1
- if !isLen1 {
- wg.Add(len(v))
- }
- {{- end }}
- for i := range v {
- {{- if not $type.IsScalar }}
- i := i
- rctx := &graphql.ResolverContext{
- Index: &i,
- Result: &v[i],
- }
- ctx := graphql.WithResolverContext(ctx, rctx)
- f := func(i int) {
- defer func() {
- if r := recover(); r != nil {
- ec.Error(ctx, ec.Recover(ctx, r))
- ret = nil
- }
- }()
- if !isLen1 {
- defer wg.Done()
- }
- ret[i] = ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, v[i])
- }
- if isLen1 {
- f(i)
- } else {
- go f(i)
- }
- {{ else }}
- ret[i] = ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, v[i])
- {{- end}}
- }
- {{ if not $type.IsScalar }} wg.Wait() {{ end }}
- return ret
- {{- else }}
-
- {{- if $type.IsMarshaler }}
- return v
- {{- else if $type.Marshaler }}
- {{- if $type.IsPtr }}
- return ec.{{ $type.Elem.MarshalFunc }}(ctx, sel, *v)
- {{- else if $type.GQL.NonNull }}
- res := {{ $type.Marshaler | call }}({{- if $type.CastType }}{{ $type.CastType | ref }}(v){{else}}v{{- end }})
- if res == graphql.Null {
- if !ec.HasError(graphql.GetResolverContext(ctx)) {
- ec.Errorf(ctx, "must not be null")
- }
- }
- return res
- {{- else }}
- return {{ $type.Marshaler | call }}({{- if $type.CastType }}{{ $type.CastType | ref }}(v){{else}}v{{- end }})
- {{- end }}
- {{- else }}
- return ec._{{$type.Definition.Name}}(ctx, sel, {{ if not $type.IsNilable}}&{{end}} v)
- {{- end }}
- {{- end }}
- }
- {{- end }}
-{{- end }}
diff --git a/vendor/github.com/99designs/gqlgen/codegen/util.go b/vendor/github.com/99designs/gqlgen/codegen/util.go
deleted file mode 100644
index 59dfde08cdc16ff46898aeed9744740b04efc977..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/codegen/util.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package codegen
-
-import (
- "go/types"
- "strings"
-
- "github.com/pkg/errors"
-)
-
-func findGoNamedType(def types.Type) (*types.Named, error) {
- if def == nil {
- return nil, nil
- }
-
- namedType, ok := def.(*types.Named)
- if !ok {
- return nil, errors.Errorf("expected %s to be a named type, instead found %T\n", def.String(), def)
- }
-
- return namedType, nil
-}
-
-func findGoInterface(def types.Type) (*types.Interface, error) {
- if def == nil {
- return nil, nil
- }
- namedType, err := findGoNamedType(def)
- if err != nil {
- return nil, err
- }
- if namedType == nil {
- return nil, nil
- }
-
- underlying, ok := namedType.Underlying().(*types.Interface)
- if !ok {
- return nil, errors.Errorf("expected %s to be a named interface, instead found %s", def.String(), namedType.String())
- }
-
- return underlying, nil
-}
-
-func equalFieldName(source, target string) bool {
- source = strings.Replace(source, "_", "", -1)
- target = strings.Replace(target, "_", "", -1)
- return strings.EqualFold(source, target)
-}
diff --git a/vendor/github.com/99designs/gqlgen/complexity/complexity.go b/vendor/github.com/99designs/gqlgen/complexity/complexity.go
deleted file mode 100644
index d5b46bf451a4c4811c65b6825a981a508b1beef4..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/complexity/complexity.go
+++ /dev/null
@@ -1,104 +0,0 @@
-package complexity
-
-import (
- "github.com/99designs/gqlgen/graphql"
- "github.com/vektah/gqlparser/ast"
-)
-
-func Calculate(es graphql.ExecutableSchema, op *ast.OperationDefinition, vars map[string]interface{}) int {
- walker := complexityWalker{
- es: es,
- schema: es.Schema(),
- vars: vars,
- }
- return walker.selectionSetComplexity(op.SelectionSet)
-}
-
-type complexityWalker struct {
- es graphql.ExecutableSchema
- schema *ast.Schema
- vars map[string]interface{}
-}
-
-func (cw complexityWalker) selectionSetComplexity(selectionSet ast.SelectionSet) int {
- var complexity int
- for _, selection := range selectionSet {
- switch s := selection.(type) {
- case *ast.Field:
- fieldDefinition := cw.schema.Types[s.Definition.Type.Name()]
- var childComplexity int
- switch fieldDefinition.Kind {
- case ast.Object, ast.Interface, ast.Union:
- childComplexity = cw.selectionSetComplexity(s.SelectionSet)
- }
-
- args := s.ArgumentMap(cw.vars)
- var fieldComplexity int
- if s.ObjectDefinition.Kind == ast.Interface {
- fieldComplexity = cw.interfaceFieldComplexity(s.ObjectDefinition, s.Name, childComplexity, args)
- } else {
- fieldComplexity = cw.fieldComplexity(s.ObjectDefinition.Name, s.Name, childComplexity, args)
- }
- complexity = safeAdd(complexity, fieldComplexity)
-
- case *ast.FragmentSpread:
- complexity = safeAdd(complexity, cw.selectionSetComplexity(s.Definition.SelectionSet))
-
- case *ast.InlineFragment:
- complexity = safeAdd(complexity, cw.selectionSetComplexity(s.SelectionSet))
- }
- }
- return complexity
-}
-
-func (cw complexityWalker) interfaceFieldComplexity(def *ast.Definition, field string, childComplexity int, args map[string]interface{}) int {
- // Interfaces don't have their own separate field costs, so they have to assume the worst case.
- // We iterate over all implementors and choose the most expensive one.
- maxComplexity := 0
- implementors := cw.schema.GetPossibleTypes(def)
- for _, t := range implementors {
- fieldComplexity := cw.fieldComplexity(t.Name, field, childComplexity, args)
- if fieldComplexity > maxComplexity {
- maxComplexity = fieldComplexity
- }
- }
- return maxComplexity
-}
-
-func (cw complexityWalker) fieldComplexity(object, field string, childComplexity int, args map[string]interface{}) int {
- if customComplexity, ok := cw.es.Complexity(object, field, childComplexity, args); ok && customComplexity >= childComplexity {
- return customComplexity
- }
- // default complexity calculation
- return safeAdd(1, childComplexity)
-}
-
-const maxInt = int(^uint(0) >> 1)
-
-// safeAdd is a saturating add of a and b that ignores negative operands.
-// If a + b would overflow through normal Go addition,
-// it returns the maximum integer value instead.
-//
-// Adding complexities with this function prevents attackers from intentionally
-// overflowing the complexity calculation to allow overly-complex queries.
-//
-// It also helps mitigate the impact of custom complexities that accidentally
-// return negative values.
-func safeAdd(a, b int) int {
- // Ignore negative operands.
- if a < 0 {
- if b < 0 {
- return 1
- }
- return b
- } else if b < 0 {
- return a
- }
-
- c := a + b
- if c < a {
- // Set c to maximum integer instead of overflowing.
- c = maxInt
- }
- return c
-}
diff --git a/vendor/github.com/99designs/gqlgen/docs/content/_introduction.md b/vendor/github.com/99designs/gqlgen/docs/content/_introduction.md
deleted file mode 120000
index fe840054137e2ccda075344f21e728249a60a2fc..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/docs/content/_introduction.md
+++ /dev/null
@@ -1 +0,0 @@
-../../README.md
\ No newline at end of file
diff --git a/vendor/github.com/99designs/gqlgen/graphql/any.go b/vendor/github.com/99designs/gqlgen/graphql/any.go
deleted file mode 100644
index 6ea8bf2eaeb5fa8af76b9f4ed4ec1030ceb47298..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/any.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package graphql
-
-import (
- "encoding/json"
- "io"
-)
-
-func MarshalAny(v interface{}) Marshaler {
- return WriterFunc(func(w io.Writer) {
- err := json.NewEncoder(w).Encode(v)
- if err != nil {
- panic(err)
- }
- })
-}
-
-func UnmarshalAny(v interface{}) (interface{}, error) {
- return v, nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/bool.go b/vendor/github.com/99designs/gqlgen/graphql/bool.go
deleted file mode 100644
index b175ca98628e3ff4101c62104beff88be3bd57ce..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/bool.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package graphql
-
-import (
- "fmt"
- "io"
- "strings"
-)
-
-func MarshalBoolean(b bool) Marshaler {
- return WriterFunc(func(w io.Writer) {
- if b {
- w.Write(trueLit)
- } else {
- w.Write(falseLit)
- }
- })
-}
-
-func UnmarshalBoolean(v interface{}) (bool, error) {
- switch v := v.(type) {
- case string:
- return strings.ToLower(v) == "true", nil
- case int:
- return v != 0, nil
- case bool:
- return v, nil
- default:
- return false, fmt.Errorf("%T is not a bool", v)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/context.go b/vendor/github.com/99designs/gqlgen/graphql/context.go
deleted file mode 100644
index 356f5175b39b84b57bb0c5830bbc1d010c986e7d..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/context.go
+++ /dev/null
@@ -1,274 +0,0 @@
-package graphql
-
-import (
- "context"
- "fmt"
- "sync"
-
- "github.com/vektah/gqlparser/ast"
- "github.com/vektah/gqlparser/gqlerror"
-)
-
-type Resolver func(ctx context.Context) (res interface{}, err error)
-type FieldMiddleware func(ctx context.Context, next Resolver) (res interface{}, err error)
-type RequestMiddleware func(ctx context.Context, next func(ctx context.Context) []byte) []byte
-type ComplexityLimitFunc func(ctx context.Context) int
-
-type RequestContext struct {
- RawQuery string
- Variables map[string]interface{}
- Doc *ast.QueryDocument
-
- ComplexityLimit int
- OperationComplexity int
- DisableIntrospection bool
-
- // ErrorPresenter will be used to generate the error
- // message from errors given to Error().
- ErrorPresenter ErrorPresenterFunc
- Recover RecoverFunc
- ResolverMiddleware FieldMiddleware
- DirectiveMiddleware FieldMiddleware
- RequestMiddleware RequestMiddleware
- Tracer Tracer
-
- errorsMu sync.Mutex
- Errors gqlerror.List
- extensionsMu sync.Mutex
- Extensions map[string]interface{}
-}
-
-func DefaultResolverMiddleware(ctx context.Context, next Resolver) (res interface{}, err error) {
- return next(ctx)
-}
-
-func DefaultDirectiveMiddleware(ctx context.Context, next Resolver) (res interface{}, err error) {
- return next(ctx)
-}
-
-func DefaultRequestMiddleware(ctx context.Context, next func(ctx context.Context) []byte) []byte {
- return next(ctx)
-}
-
-func NewRequestContext(doc *ast.QueryDocument, query string, variables map[string]interface{}) *RequestContext {
- return &RequestContext{
- Doc: doc,
- RawQuery: query,
- Variables: variables,
- ResolverMiddleware: DefaultResolverMiddleware,
- DirectiveMiddleware: DefaultDirectiveMiddleware,
- RequestMiddleware: DefaultRequestMiddleware,
- Recover: DefaultRecover,
- ErrorPresenter: DefaultErrorPresenter,
- Tracer: &NopTracer{},
- }
-}
-
-type key string
-
-const (
- request key = "request_context"
- resolver key = "resolver_context"
-)
-
-func GetRequestContext(ctx context.Context) *RequestContext {
- if val, ok := ctx.Value(request).(*RequestContext); ok {
- return val
- }
- return nil
-}
-
-func WithRequestContext(ctx context.Context, rc *RequestContext) context.Context {
- return context.WithValue(ctx, request, rc)
-}
-
-type ResolverContext struct {
- Parent *ResolverContext
- // The name of the type this field belongs to
- Object string
- // These are the args after processing, they can be mutated in middleware to change what the resolver will get.
- Args map[string]interface{}
- // The raw field
- Field CollectedField
- // The index of array in path.
- Index *int
- // The result object of resolver
- Result interface{}
- // IsMethod indicates if the resolver is a method
- IsMethod bool
-}
-
-func (r *ResolverContext) Path() []interface{} {
- var path []interface{}
- for it := r; it != nil; it = it.Parent {
- if it.Index != nil {
- path = append(path, *it.Index)
- } else if it.Field.Field != nil {
- path = append(path, it.Field.Alias)
- }
- }
-
- // because we are walking up the chain, all the elements are backwards, do an inplace flip.
- for i := len(path)/2 - 1; i >= 0; i-- {
- opp := len(path) - 1 - i
- path[i], path[opp] = path[opp], path[i]
- }
-
- return path
-}
-
-func GetResolverContext(ctx context.Context) *ResolverContext {
- if val, ok := ctx.Value(resolver).(*ResolverContext); ok {
- return val
- }
- return nil
-}
-
-func WithResolverContext(ctx context.Context, rc *ResolverContext) context.Context {
- rc.Parent = GetResolverContext(ctx)
- return context.WithValue(ctx, resolver, rc)
-}
-
-// This is just a convenient wrapper method for CollectFields
-func CollectFieldsCtx(ctx context.Context, satisfies []string) []CollectedField {
- resctx := GetResolverContext(ctx)
- return CollectFields(GetRequestContext(ctx), resctx.Field.Selections, satisfies)
-}
-
-// CollectAllFields returns a slice of all GraphQL field names that were selected for the current resolver context.
-// The slice will contain the unique set of all field names requested regardless of fragment type conditions.
-func CollectAllFields(ctx context.Context) []string {
- resctx := GetResolverContext(ctx)
- collected := CollectFields(GetRequestContext(ctx), resctx.Field.Selections, nil)
- uniq := make([]string, 0, len(collected))
-Next:
- for _, f := range collected {
- for _, name := range uniq {
- if name == f.Name {
- continue Next
- }
- }
- uniq = append(uniq, f.Name)
- }
- return uniq
-}
-
-// Errorf sends an error string to the client, passing it through the formatter.
-func (c *RequestContext) Errorf(ctx context.Context, format string, args ...interface{}) {
- c.errorsMu.Lock()
- defer c.errorsMu.Unlock()
-
- c.Errors = append(c.Errors, c.ErrorPresenter(ctx, fmt.Errorf(format, args...)))
-}
-
-// Error sends an error to the client, passing it through the formatter.
-func (c *RequestContext) Error(ctx context.Context, err error) {
- c.errorsMu.Lock()
- defer c.errorsMu.Unlock()
-
- c.Errors = append(c.Errors, c.ErrorPresenter(ctx, err))
-}
-
-// HasError returns true if the current field has already errored
-func (c *RequestContext) HasError(rctx *ResolverContext) bool {
- c.errorsMu.Lock()
- defer c.errorsMu.Unlock()
- path := rctx.Path()
-
- for _, err := range c.Errors {
- if equalPath(err.Path, path) {
- return true
- }
- }
- return false
-}
-
-// GetErrors returns a list of errors that occurred in the current field
-func (c *RequestContext) GetErrors(rctx *ResolverContext) gqlerror.List {
- c.errorsMu.Lock()
- defer c.errorsMu.Unlock()
- path := rctx.Path()
-
- var errs gqlerror.List
- for _, err := range c.Errors {
- if equalPath(err.Path, path) {
- errs = append(errs, err)
- }
- }
- return errs
-}
-
-func equalPath(a []interface{}, b []interface{}) bool {
- if len(a) != len(b) {
- return false
- }
-
- for i := 0; i < len(a); i++ {
- if a[i] != b[i] {
- return false
- }
- }
-
- return true
-}
-
-// AddError is a convenience method for adding an error to the current response
-func AddError(ctx context.Context, err error) {
- GetRequestContext(ctx).Error(ctx, err)
-}
-
-// AddErrorf is a convenience method for adding an error to the current response
-func AddErrorf(ctx context.Context, format string, args ...interface{}) {
- GetRequestContext(ctx).Errorf(ctx, format, args...)
-}
-
-// RegisterExtension registers an extension, returns error if extension has already been registered
-func (c *RequestContext) RegisterExtension(key string, value interface{}) error {
- c.extensionsMu.Lock()
- defer c.extensionsMu.Unlock()
-
- if c.Extensions == nil {
- c.Extensions = make(map[string]interface{})
- }
-
- if _, ok := c.Extensions[key]; ok {
- return fmt.Errorf("extension already registered for key %s", key)
- }
-
- c.Extensions[key] = value
- return nil
-}
-
-// ChainFieldMiddleware add chain by FieldMiddleware
-func ChainFieldMiddleware(handleFunc ...FieldMiddleware) FieldMiddleware {
- n := len(handleFunc)
-
- if n > 1 {
- lastI := n - 1
- return func(ctx context.Context, next Resolver) (interface{}, error) {
- var (
- chainHandler Resolver
- curI int
- )
- chainHandler = func(currentCtx context.Context) (interface{}, error) {
- if curI == lastI {
- return next(currentCtx)
- }
- curI++
- res, err := handleFunc[curI](currentCtx, chainHandler)
- curI--
- return res, err
-
- }
- return handleFunc[0](ctx, chainHandler)
- }
- }
-
- if n == 1 {
- return handleFunc[0]
- }
-
- return func(ctx context.Context, next Resolver) (interface{}, error) {
- return next(ctx)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/error.go b/vendor/github.com/99designs/gqlgen/graphql/error.go
deleted file mode 100644
index af8b4ce4088107d6aafb5366cec71fc54bc8a57c..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/error.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package graphql
-
-import (
- "context"
-
- "github.com/vektah/gqlparser/gqlerror"
-)
-
-type ErrorPresenterFunc func(context.Context, error) *gqlerror.Error
-
-type ExtendedError interface {
- Extensions() map[string]interface{}
-}
-
-func DefaultErrorPresenter(ctx context.Context, err error) *gqlerror.Error {
- if gqlerr, ok := err.(*gqlerror.Error); ok {
- if gqlerr.Path == nil {
- gqlerr.Path = GetResolverContext(ctx).Path()
- }
- return gqlerr
- }
-
- var extensions map[string]interface{}
- if ee, ok := err.(ExtendedError); ok {
- extensions = ee.Extensions()
- }
-
- return &gqlerror.Error{
- Message: err.Error(),
- Path: GetResolverContext(ctx).Path(),
- Extensions: extensions,
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/exec.go b/vendor/github.com/99designs/gqlgen/graphql/exec.go
deleted file mode 100644
index 3e00a4d57b1b470d627cae6c30dbc5a8e25c33b4..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/exec.go
+++ /dev/null
@@ -1,144 +0,0 @@
-package graphql
-
-import (
- "context"
- "fmt"
-
- "github.com/vektah/gqlparser/ast"
-)
-
-type ExecutableSchema interface {
- Schema() *ast.Schema
-
- Complexity(typeName, fieldName string, childComplexity int, args map[string]interface{}) (int, bool)
- Query(ctx context.Context, op *ast.OperationDefinition) *Response
- Mutation(ctx context.Context, op *ast.OperationDefinition) *Response
- Subscription(ctx context.Context, op *ast.OperationDefinition) func() *Response
-}
-
-// CollectFields returns the set of fields from an ast.SelectionSet where all collected fields satisfy at least one of the GraphQL types
-// passed through satisfies. Providing an empty or nil slice for satisfies will return collect all fields regardless of fragment
-// type conditions.
-func CollectFields(reqCtx *RequestContext, selSet ast.SelectionSet, satisfies []string) []CollectedField {
- return collectFields(reqCtx, selSet, satisfies, map[string]bool{})
-}
-
-func collectFields(reqCtx *RequestContext, selSet ast.SelectionSet, satisfies []string, visited map[string]bool) []CollectedField {
- groupedFields := make([]CollectedField, 0, len(selSet))
-
- for _, sel := range selSet {
- switch sel := sel.(type) {
- case *ast.Field:
- if !shouldIncludeNode(sel.Directives, reqCtx.Variables) {
- continue
- }
- f := getOrCreateAndAppendField(&groupedFields, sel.Alias, func() CollectedField {
- return CollectedField{Field: sel}
- })
-
- f.Selections = append(f.Selections, sel.SelectionSet...)
- case *ast.InlineFragment:
- if !shouldIncludeNode(sel.Directives, reqCtx.Variables) {
- continue
- }
- if len(satisfies) > 0 && !instanceOf(sel.TypeCondition, satisfies) {
- continue
- }
- for _, childField := range collectFields(reqCtx, sel.SelectionSet, satisfies, visited) {
- f := getOrCreateAndAppendField(&groupedFields, childField.Name, func() CollectedField { return childField })
- f.Selections = append(f.Selections, childField.Selections...)
- }
-
- case *ast.FragmentSpread:
- if !shouldIncludeNode(sel.Directives, reqCtx.Variables) {
- continue
- }
- fragmentName := sel.Name
- if _, seen := visited[fragmentName]; seen {
- continue
- }
- visited[fragmentName] = true
-
- fragment := reqCtx.Doc.Fragments.ForName(fragmentName)
- if fragment == nil {
- // should never happen, validator has already run
- panic(fmt.Errorf("missing fragment %s", fragmentName))
- }
-
- if len(satisfies) > 0 && !instanceOf(fragment.TypeCondition, satisfies) {
- continue
- }
-
- for _, childField := range collectFields(reqCtx, fragment.SelectionSet, satisfies, visited) {
- f := getOrCreateAndAppendField(&groupedFields, childField.Name, func() CollectedField { return childField })
- f.Selections = append(f.Selections, childField.Selections...)
- }
- default:
- panic(fmt.Errorf("unsupported %T", sel))
- }
- }
-
- return groupedFields
-}
-
-type CollectedField struct {
- *ast.Field
-
- Selections ast.SelectionSet
-}
-
-func instanceOf(val string, satisfies []string) bool {
- for _, s := range satisfies {
- if val == s {
- return true
- }
- }
- return false
-}
-
-func getOrCreateAndAppendField(c *[]CollectedField, name string, creator func() CollectedField) *CollectedField {
- for i, cf := range *c {
- if cf.Alias == name {
- return &(*c)[i]
- }
- }
-
- f := creator()
-
- *c = append(*c, f)
- return &(*c)[len(*c)-1]
-}
-
-func shouldIncludeNode(directives ast.DirectiveList, variables map[string]interface{}) bool {
- if len(directives) == 0 {
- return true
- }
-
- skip, include := false, true
-
- if d := directives.ForName("skip"); d != nil {
- skip = resolveIfArgument(d, variables)
- }
-
- if d := directives.ForName("include"); d != nil {
- include = resolveIfArgument(d, variables)
- }
-
- return !skip && include
-}
-
-func resolveIfArgument(d *ast.Directive, variables map[string]interface{}) bool {
- arg := d.Arguments.ForName("if")
- if arg == nil {
- panic(fmt.Sprintf("%s: argument 'if' not defined", d.Name))
- }
- value, err := arg.Value.Value(variables)
- if err != nil {
- panic(err)
- }
- ret, ok := value.(bool)
- if !ok {
- panic(fmt.Sprintf("%s: argument 'if' is not a boolean", d.Name))
- }
- return ret
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/fieldset.go b/vendor/github.com/99designs/gqlgen/graphql/fieldset.go
deleted file mode 100644
index 351e266fdb30bbb9c4165f72d2e76ea1014da3b3..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/fieldset.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package graphql
-
-import (
- "io"
- "sync"
-)
-
-type FieldSet struct {
- fields []CollectedField
- Values []Marshaler
- delayed []delayedResult
-}
-
-type delayedResult struct {
- i int
- f func() Marshaler
-}
-
-func NewFieldSet(fields []CollectedField) *FieldSet {
- return &FieldSet{
- fields: fields,
- Values: make([]Marshaler, len(fields)),
- }
-}
-
-func (m *FieldSet) Concurrently(i int, f func() Marshaler) {
- m.delayed = append(m.delayed, delayedResult{i: i, f: f})
-}
-
-func (m *FieldSet) Dispatch() {
- if len(m.delayed) == 1 {
- // only one concurrent task, no need to spawn a goroutine or deal create waitgroups
- d := m.delayed[0]
- m.Values[d.i] = d.f()
- } else if len(m.delayed) > 1 {
- // more than one concurrent task, use the main goroutine to do one, only spawn goroutines for the others
-
- var wg sync.WaitGroup
- for _, d := range m.delayed[1:] {
- wg.Add(1)
- go func(d delayedResult) {
- m.Values[d.i] = d.f()
- wg.Done()
- }(d)
- }
-
- m.Values[m.delayed[0].i] = m.delayed[0].f()
- wg.Wait()
- }
-}
-
-func (m *FieldSet) MarshalGQL(writer io.Writer) {
- writer.Write(openBrace)
- for i, field := range m.fields {
- if i != 0 {
- writer.Write(comma)
- }
- writeQuotedString(writer, field.Alias)
- writer.Write(colon)
- m.Values[i].MarshalGQL(writer)
- }
- writer.Write(closeBrace)
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/float.go b/vendor/github.com/99designs/gqlgen/graphql/float.go
deleted file mode 100644
index fabbad04687db26651dffe2351cdb39d35c62d89..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/float.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package graphql
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "strconv"
-)
-
-func MarshalFloat(f float64) Marshaler {
- return WriterFunc(func(w io.Writer) {
- io.WriteString(w, fmt.Sprintf("%g", f))
- })
-}
-
-func UnmarshalFloat(v interface{}) (float64, error) {
- switch v := v.(type) {
- case string:
- return strconv.ParseFloat(v, 64)
- case int:
- return float64(v), nil
- case int64:
- return float64(v), nil
- case float64:
- return v, nil
- case json.Number:
- return strconv.ParseFloat(string(v), 64)
- default:
- return 0, fmt.Errorf("%T is not an float", v)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/id.go b/vendor/github.com/99designs/gqlgen/graphql/id.go
deleted file mode 100644
index 4f532037d0842c86ebacab24756f54c2d6df5989..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/id.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package graphql
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "strconv"
-)
-
-func MarshalID(s string) Marshaler {
- return WriterFunc(func(w io.Writer) {
- io.WriteString(w, strconv.Quote(s))
- })
-}
-func UnmarshalID(v interface{}) (string, error) {
- switch v := v.(type) {
- case string:
- return v, nil
- case json.Number:
- return string(v), nil
- case int:
- return strconv.Itoa(v), nil
- case float64:
- return fmt.Sprintf("%f", v), nil
- case bool:
- if v {
- return "true", nil
- } else {
- return "false", nil
- }
- case nil:
- return "null", nil
- default:
- return "", fmt.Errorf("%T is not a string", v)
- }
-}
-
-func MarshalIntID(i int) Marshaler {
- return WriterFunc(func(w io.Writer) {
- writeQuotedString(w, strconv.Itoa(i))
- })
-}
-
-func UnmarshalIntID(v interface{}) (int, error) {
- switch v := v.(type) {
- case string:
- return strconv.Atoi(v)
- case int:
- return v, nil
- case int64:
- return int(v), nil
- case json.Number:
- return strconv.Atoi(string(v))
- default:
- return 0, fmt.Errorf("%T is not an int", v)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/int.go b/vendor/github.com/99designs/gqlgen/graphql/int.go
deleted file mode 100644
index 57d0d589baefea7120b798212bf1bf63c4739d09..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/int.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package graphql
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "strconv"
-)
-
-func MarshalInt(i int) Marshaler {
- return WriterFunc(func(w io.Writer) {
- io.WriteString(w, strconv.Itoa(i))
- })
-}
-
-func UnmarshalInt(v interface{}) (int, error) {
- switch v := v.(type) {
- case string:
- return strconv.Atoi(v)
- case int:
- return v, nil
- case int64:
- return int(v), nil
- case json.Number:
- return strconv.Atoi(string(v))
- default:
- return 0, fmt.Errorf("%T is not an int", v)
- }
-}
-
-func MarshalInt64(i int64) Marshaler {
- return WriterFunc(func(w io.Writer) {
- io.WriteString(w, strconv.FormatInt(i, 10))
- })
-}
-
-func UnmarshalInt64(v interface{}) (int64, error) {
- switch v := v.(type) {
- case string:
- return strconv.ParseInt(v, 10, 64)
- case int:
- return int64(v), nil
- case int64:
- return v, nil
- case json.Number:
- return strconv.ParseInt(string(v), 10, 64)
- default:
- return 0, fmt.Errorf("%T is not an int", v)
- }
-}
-
-func MarshalInt32(i int32) Marshaler {
- return WriterFunc(func(w io.Writer) {
- io.WriteString(w, strconv.FormatInt(int64(i), 10))
- })
-}
-
-func UnmarshalInt32(v interface{}) (int32, error) {
- switch v := v.(type) {
- case string:
- iv, err := strconv.ParseInt(v, 10, 32)
- if err != nil {
- return 0, err
- }
- return int32(iv), nil
- case int:
- return int32(v), nil
- case int64:
- return int32(v), nil
- case json.Number:
- iv, err := strconv.ParseInt(string(v), 10, 32)
- if err != nil {
- return 0, err
- }
- return int32(iv), nil
- default:
- return 0, fmt.Errorf("%T is not an int", v)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go
deleted file mode 100644
index ca0b065f83ec0fb2f89aba0930b6b27cdd55e9d4..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// introspection implements the spec defined in https://github.com/facebook/graphql/blob/master/spec/Section%204%20--%20Introspection.md#schema-introspection
-package introspection
-
-import "github.com/vektah/gqlparser/ast"
-
-type (
- Directive struct {
- Name string
- Description string
- Locations []string
- Args []InputValue
- }
-
- EnumValue struct {
- Name string
- Description string
- deprecation *ast.Directive
- }
-
- Field struct {
- Name string
- Description string
- Type *Type
- Args []InputValue
- deprecation *ast.Directive
- }
-
- InputValue struct {
- Name string
- Description string
- DefaultValue *string
- Type *Type
- }
-)
-
-func WrapSchema(schema *ast.Schema) *Schema {
- return &Schema{schema: schema}
-}
-
-func (f *EnumValue) IsDeprecated() bool {
- return f.deprecation != nil
-}
-
-func (f *EnumValue) DeprecationReason() *string {
- if f.deprecation == nil {
- return nil
- }
-
- reason := f.deprecation.Arguments.ForName("reason")
- if reason == nil {
- return nil
- }
-
- return &reason.Value.Raw
-}
-
-func (f *Field) IsDeprecated() bool {
- return f.deprecation != nil
-}
-
-func (f *Field) DeprecationReason() *string {
- if f.deprecation == nil {
- return nil
- }
-
- reason := f.deprecation.Arguments.ForName("reason")
- if reason == nil {
- return nil
- }
-
- return &reason.Value.Raw
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/query.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/query.go
deleted file mode 100644
index b1e4fbc6e0fbc44b29c375b110586429455e79fa..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/introspection/query.go
+++ /dev/null
@@ -1,104 +0,0 @@
-package introspection
-
-// Query is the query generated by graphiql to determine type information
-const Query = `
-query IntrospectionQuery {
- __schema {
- queryType {
- name
- }
- mutationType {
- name
- }
- subscriptionType {
- name
- }
- types {
- ...FullType
- }
- directives {
- name
- description
- locations
- args {
- ...InputValue
- }
- }
- }
-}
-
-fragment FullType on __Type {
- kind
- name
- description
- fields(includeDeprecated: true) {
- name
- description
- args {
- ...InputValue
- }
- type {
- ...TypeRef
- }
- isDeprecated
- deprecationReason
- }
- inputFields {
- ...InputValue
- }
- interfaces {
- ...TypeRef
- }
- enumValues(includeDeprecated: true) {
- name
- description
- isDeprecated
- deprecationReason
- }
- possibleTypes {
- ...TypeRef
- }
-}
-
-fragment InputValue on __InputValue {
- name
- description
- type {
- ...TypeRef
- }
- defaultValue
-}
-
-fragment TypeRef on __Type {
- kind
- name
- ofType {
- kind
- name
- ofType {
- kind
- name
- ofType {
- kind
- name
- ofType {
- kind
- name
- ofType {
- kind
- name
- ofType {
- kind
- name
- ofType {
- kind
- name
- }
- }
- }
- }
- }
- }
- }
-}
-`
diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/schema.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/schema.go
deleted file mode 100644
index a57272d525a8a9c14b8cac4ea2294f5be46875a5..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/introspection/schema.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package introspection
-
-import (
- "strings"
-
- "github.com/vektah/gqlparser/ast"
-)
-
-type Schema struct {
- schema *ast.Schema
-}
-
-func (s *Schema) Types() []Type {
- types := make([]Type, 0, len(s.schema.Types))
- for _, typ := range s.schema.Types {
- if strings.HasPrefix(typ.Name, "__") {
- continue
- }
- types = append(types, *WrapTypeFromDef(s.schema, typ))
- }
- return types
-}
-
-func (s *Schema) QueryType() *Type {
- return WrapTypeFromDef(s.schema, s.schema.Query)
-}
-
-func (s *Schema) MutationType() *Type {
- return WrapTypeFromDef(s.schema, s.schema.Mutation)
-}
-
-func (s *Schema) SubscriptionType() *Type {
- return WrapTypeFromDef(s.schema, s.schema.Subscription)
-}
-
-func (s *Schema) Directives() []Directive {
- res := make([]Directive, 0, len(s.schema.Directives))
-
- for _, d := range s.schema.Directives {
- res = append(res, s.directiveFromDef(d))
- }
-
- return res
-}
-
-func (s *Schema) directiveFromDef(d *ast.DirectiveDefinition) Directive {
- locs := make([]string, len(d.Locations))
- for i, loc := range d.Locations {
- locs[i] = string(loc)
- }
-
- args := make([]InputValue, len(d.Arguments))
- for i, arg := range d.Arguments {
- args[i] = InputValue{
- Name: arg.Name,
- Description: arg.Description,
- DefaultValue: defaultValue(arg.DefaultValue),
- Type: WrapTypeFromType(s.schema, arg.Type),
- }
- }
-
- return Directive{
- Name: d.Name,
- Description: d.Description,
- Locations: locs,
- Args: args,
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go b/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go
deleted file mode 100644
index 9aceebdc954f2a6f2c2411baaf0d802d2435d5e1..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/introspection/type.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package introspection
-
-import (
- "strings"
-
- "github.com/vektah/gqlparser/ast"
-)
-
-type Type struct {
- schema *ast.Schema
- def *ast.Definition
- typ *ast.Type
-}
-
-func WrapTypeFromDef(s *ast.Schema, def *ast.Definition) *Type {
- if def == nil {
- return nil
- }
- return &Type{schema: s, def: def}
-}
-
-func WrapTypeFromType(s *ast.Schema, typ *ast.Type) *Type {
- if typ == nil {
- return nil
- }
-
- if !typ.NonNull && typ.NamedType != "" {
- return &Type{schema: s, def: s.Types[typ.NamedType]}
- }
- return &Type{schema: s, typ: typ}
-}
-
-func (t *Type) Kind() string {
- if t.typ != nil {
- if t.typ.NonNull {
- return "NON_NULL"
- }
-
- if t.typ.Elem != nil {
- return "LIST"
- }
- } else {
- return string(t.def.Kind)
- }
-
- panic("UNKNOWN")
-}
-
-func (t *Type) Name() *string {
- if t.def == nil {
- return nil
- }
- return &t.def.Name
-}
-
-func (t *Type) Description() string {
- if t.def == nil {
- return ""
- }
- return t.def.Description
-}
-
-func (t *Type) Fields(includeDeprecated bool) []Field {
- if t.def == nil || (t.def.Kind != ast.Object && t.def.Kind != ast.Interface) {
- return []Field{}
- }
- fields := []Field{}
- for _, f := range t.def.Fields {
- if strings.HasPrefix(f.Name, "__") {
- continue
- }
-
- if !includeDeprecated && f.Directives.ForName("deprecated") != nil {
- continue
- }
-
- var args []InputValue
- for _, arg := range f.Arguments {
- args = append(args, InputValue{
- Type: WrapTypeFromType(t.schema, arg.Type),
- Name: arg.Name,
- Description: arg.Description,
- DefaultValue: defaultValue(arg.DefaultValue),
- })
- }
-
- fields = append(fields, Field{
- Name: f.Name,
- Description: f.Description,
- Args: args,
- Type: WrapTypeFromType(t.schema, f.Type),
- deprecation: f.Directives.ForName("deprecated"),
- })
- }
- return fields
-}
-
-func (t *Type) InputFields() []InputValue {
- if t.def == nil || t.def.Kind != ast.InputObject {
- return []InputValue{}
- }
-
- res := []InputValue{}
- for _, f := range t.def.Fields {
- res = append(res, InputValue{
- Name: f.Name,
- Description: f.Description,
- Type: WrapTypeFromType(t.schema, f.Type),
- DefaultValue: defaultValue(f.DefaultValue),
- })
- }
- return res
-}
-
-func defaultValue(value *ast.Value) *string {
- if value == nil {
- return nil
- }
- val := value.String()
- return &val
-}
-
-func (t *Type) Interfaces() []Type {
- if t.def == nil || t.def.Kind != ast.Object {
- return []Type{}
- }
-
- res := []Type{}
- for _, intf := range t.def.Interfaces {
- res = append(res, *WrapTypeFromDef(t.schema, t.schema.Types[intf]))
- }
-
- return res
-}
-
-func (t *Type) PossibleTypes() []Type {
- if t.def == nil || (t.def.Kind != ast.Interface && t.def.Kind != ast.Union) {
- return []Type{}
- }
-
- res := []Type{}
- for _, pt := range t.schema.GetPossibleTypes(t.def) {
- res = append(res, *WrapTypeFromDef(t.schema, pt))
- }
- return res
-}
-
-func (t *Type) EnumValues(includeDeprecated bool) []EnumValue {
- if t.def == nil || t.def.Kind != ast.Enum {
- return []EnumValue{}
- }
-
- res := []EnumValue{}
- for _, val := range t.def.EnumValues {
- res = append(res, EnumValue{
- Name: val.Name,
- Description: val.Description,
- deprecation: val.Directives.ForName("deprecated"),
- })
- }
- return res
-}
-
-func (t *Type) OfType() *Type {
- if t.typ == nil {
- return nil
- }
- if t.typ.NonNull {
- // fake non null nodes
- cpy := *t.typ
- cpy.NonNull = false
-
- return WrapTypeFromType(t.schema, &cpy)
- }
- return WrapTypeFromType(t.schema, t.typ.Elem)
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/jsonw.go b/vendor/github.com/99designs/gqlgen/graphql/jsonw.go
deleted file mode 100644
index db95d8e441967e7480d83747036c73fae38e20a3..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/jsonw.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package graphql
-
-import (
- "io"
-)
-
-var nullLit = []byte(`null`)
-var trueLit = []byte(`true`)
-var falseLit = []byte(`false`)
-var openBrace = []byte(`{`)
-var closeBrace = []byte(`}`)
-var openBracket = []byte(`[`)
-var closeBracket = []byte(`]`)
-var colon = []byte(`:`)
-var comma = []byte(`,`)
-
-var Null = &lit{nullLit}
-var True = &lit{trueLit}
-var False = &lit{falseLit}
-
-type Marshaler interface {
- MarshalGQL(w io.Writer)
-}
-
-type Unmarshaler interface {
- UnmarshalGQL(v interface{}) error
-}
-
-type WriterFunc func(writer io.Writer)
-
-func (f WriterFunc) MarshalGQL(w io.Writer) {
- f(w)
-}
-
-type Array []Marshaler
-
-func (a Array) MarshalGQL(writer io.Writer) {
- writer.Write(openBracket)
- for i, val := range a {
- if i != 0 {
- writer.Write(comma)
- }
- val.MarshalGQL(writer)
- }
- writer.Write(closeBracket)
-}
-
-type lit struct{ b []byte }
-
-func (l lit) MarshalGQL(w io.Writer) {
- w.Write(l.b)
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/map.go b/vendor/github.com/99designs/gqlgen/graphql/map.go
deleted file mode 100644
index 1e91d1d98c1e839401260b34692bb9c858a43ef2..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/map.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package graphql
-
-import (
- "encoding/json"
- "fmt"
- "io"
-)
-
-func MarshalMap(val map[string]interface{}) Marshaler {
- return WriterFunc(func(w io.Writer) {
- err := json.NewEncoder(w).Encode(val)
- if err != nil {
- panic(err)
- }
- })
-}
-
-func UnmarshalMap(v interface{}) (map[string]interface{}, error) {
- if m, ok := v.(map[string]interface{}); ok {
- return m, nil
- }
-
- return nil, fmt.Errorf("%T is not a map", v)
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/oneshot.go b/vendor/github.com/99designs/gqlgen/graphql/oneshot.go
deleted file mode 100644
index dd31f5baa7961acec4cd01089d60fb5f932fb232..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/oneshot.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package graphql
-
-func OneShot(resp *Response) func() *Response {
- var oneshot bool
-
- return func() *Response {
- if oneshot {
- return nil
- }
- oneshot = true
-
- return resp
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/recovery.go b/vendor/github.com/99designs/gqlgen/graphql/recovery.go
deleted file mode 100644
index 3aa032dc5aa8cc2c27f21d7a7aaff8687f55f346..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/recovery.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package graphql
-
-import (
- "context"
- "errors"
- "fmt"
- "os"
- "runtime/debug"
-)
-
-type RecoverFunc func(ctx context.Context, err interface{}) (userMessage error)
-
-func DefaultRecover(ctx context.Context, err interface{}) error {
- fmt.Fprintln(os.Stderr, err)
- fmt.Fprintln(os.Stderr)
- debug.PrintStack()
-
- return errors.New("internal system error")
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/response.go b/vendor/github.com/99designs/gqlgen/graphql/response.go
deleted file mode 100644
index 6fe55d56dc4fe088f65d9005a31d89817f7c75e2..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/response.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package graphql
-
-import (
- "context"
- "encoding/json"
- "fmt"
-
- "github.com/vektah/gqlparser/gqlerror"
-)
-
-// Errors are intentionally serialized first based on the advice in
-// https://github.com/facebook/graphql/commit/7b40390d48680b15cb93e02d46ac5eb249689876#diff-757cea6edf0288677a9eea4cfc801d87R107
-// and https://github.com/facebook/graphql/pull/384
-type Response struct {
- Errors gqlerror.List `json:"errors,omitempty"`
- Data json.RawMessage `json:"data"`
- Extensions map[string]interface{} `json:"extensions,omitempty"`
-}
-
-func ErrorResponse(ctx context.Context, messagef string, args ...interface{}) *Response {
- return &Response{
- Errors: gqlerror.List{{Message: fmt.Sprintf(messagef, args...)}},
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/root.go b/vendor/github.com/99designs/gqlgen/graphql/root.go
deleted file mode 100644
index 3405d18054dc419bc9999120fe3af569320b5e44..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/root.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package graphql
-
-type Query struct{}
-
-type Mutation struct{}
-
-type Subscription struct{}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/string.go b/vendor/github.com/99designs/gqlgen/graphql/string.go
deleted file mode 100644
index 7c1b7d95775250acf84695b438d40f97711253ec..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/string.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package graphql
-
-import (
- "fmt"
- "io"
- "strconv"
-)
-
-const encodeHex = "0123456789ABCDEF"
-
-func MarshalString(s string) Marshaler {
- return WriterFunc(func(w io.Writer) {
- writeQuotedString(w, s)
- })
-}
-
-func writeQuotedString(w io.Writer, s string) {
- start := 0
- io.WriteString(w, `"`)
-
- for i, c := range s {
- if c < 0x20 || c == '\\' || c == '"' {
- io.WriteString(w, s[start:i])
-
- switch c {
- case '\t':
- io.WriteString(w, `\t`)
- case '\r':
- io.WriteString(w, `\r`)
- case '\n':
- io.WriteString(w, `\n`)
- case '\\':
- io.WriteString(w, `\\`)
- case '"':
- io.WriteString(w, `\"`)
- default:
- io.WriteString(w, `\u00`)
- w.Write([]byte{encodeHex[c>>4], encodeHex[c&0xf]})
- }
-
- start = i + 1
- }
- }
-
- io.WriteString(w, s[start:])
- io.WriteString(w, `"`)
-}
-
-func UnmarshalString(v interface{}) (string, error) {
- switch v := v.(type) {
- case string:
- return v, nil
- case int:
- return strconv.Itoa(v), nil
- case float64:
- return fmt.Sprintf("%f", v), nil
- case bool:
- if v {
- return "true", nil
- } else {
- return "false", nil
- }
- case nil:
- return "null", nil
- default:
- return "", fmt.Errorf("%T is not a string", v)
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/time.go b/vendor/github.com/99designs/gqlgen/graphql/time.go
deleted file mode 100644
index 9945f3fbfdaca439aa4054480a60352e35d48547..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/time.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package graphql
-
-import (
- "errors"
- "io"
- "strconv"
- "time"
-)
-
-func MarshalTime(t time.Time) Marshaler {
- if t.IsZero() {
- return Null
- }
-
- return WriterFunc(func(w io.Writer) {
- io.WriteString(w, strconv.Quote(t.Format(time.RFC3339)))
- })
-}
-
-func UnmarshalTime(v interface{}) (time.Time, error) {
- if tmpStr, ok := v.(string); ok {
- return time.Parse(time.RFC3339, tmpStr)
- }
- return time.Time{}, errors.New("time should be RFC3339 formatted string")
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/tracer.go b/vendor/github.com/99designs/gqlgen/graphql/tracer.go
deleted file mode 100644
index 0597ce8cc8a1889683ca85ebff6b363848af8f14..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/tracer.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package graphql
-
-import (
- "context"
-)
-
-var _ Tracer = (*NopTracer)(nil)
-
-type Tracer interface {
- StartOperationParsing(ctx context.Context) context.Context
- EndOperationParsing(ctx context.Context)
- StartOperationValidation(ctx context.Context) context.Context
- EndOperationValidation(ctx context.Context)
- StartOperationExecution(ctx context.Context) context.Context
- StartFieldExecution(ctx context.Context, field CollectedField) context.Context
- StartFieldResolverExecution(ctx context.Context, rc *ResolverContext) context.Context
- StartFieldChildExecution(ctx context.Context) context.Context
- EndFieldExecution(ctx context.Context)
- EndOperationExecution(ctx context.Context)
-}
-
-type NopTracer struct{}
-
-func (NopTracer) StartOperationParsing(ctx context.Context) context.Context {
- return ctx
-}
-
-func (NopTracer) EndOperationParsing(ctx context.Context) {
-}
-
-func (NopTracer) StartOperationValidation(ctx context.Context) context.Context {
- return ctx
-}
-
-func (NopTracer) EndOperationValidation(ctx context.Context) {
-}
-
-func (NopTracer) StartOperationExecution(ctx context.Context) context.Context {
- return ctx
-}
-
-func (NopTracer) StartFieldExecution(ctx context.Context, field CollectedField) context.Context {
- return ctx
-}
-
-func (NopTracer) StartFieldResolverExecution(ctx context.Context, rc *ResolverContext) context.Context {
- return ctx
-}
-
-func (NopTracer) StartFieldChildExecution(ctx context.Context) context.Context {
- return ctx
-}
-
-func (NopTracer) EndFieldExecution(ctx context.Context) {
-}
-
-func (NopTracer) EndOperationExecution(ctx context.Context) {
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/upload.go b/vendor/github.com/99designs/gqlgen/graphql/upload.go
deleted file mode 100644
index 22d61031495322761db4187c998506ac09ed609b..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/upload.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package graphql
-
-import (
- "fmt"
- "io"
-)
-
-type Upload struct {
- File io.Reader
- Filename string
- Size int64
-}
-
-func MarshalUpload(f Upload) Marshaler {
- return WriterFunc(func(w io.Writer) {
- io.Copy(w, f.File)
- })
-}
-
-func UnmarshalUpload(v interface{}) (Upload, error) {
- upload, ok := v.(Upload)
- if !ok {
- return Upload{}, fmt.Errorf("%T is not an Upload", v)
- }
- return upload, nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/graphql/version.go b/vendor/github.com/99designs/gqlgen/graphql/version.go
deleted file mode 100644
index ea211574739d568ea7840d6bc9919d05097bdf5a..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/graphql/version.go
+++ /dev/null
@@ -1,3 +0,0 @@
-package graphql
-
-const Version = "v0.9.2"
diff --git a/vendor/github.com/99designs/gqlgen/handler/context.go b/vendor/github.com/99designs/gqlgen/handler/context.go
deleted file mode 100644
index 2992aa3d4fe15fa1a367d26ef0016127bae5c21c..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/handler/context.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package handler
-
-import "context"
-
-type key string
-
-const (
- initpayload key = "ws_initpayload_context"
-)
-
-// InitPayload is a structure that is parsed from the websocket init message payload. TO use
-// request headers for non-websocket, instead wrap the graphql handler in a middleware.
-type InitPayload map[string]interface{}
-
-// GetString safely gets a string value from the payload. It returns an empty string if the
-// payload is nil or the value isn't set.
-func (payload InitPayload) GetString(key string) string {
- if payload == nil {
- return ""
- }
-
- if value, ok := payload[key]; ok {
- res, _ := value.(string)
- return res
- }
-
- return ""
-}
-
-// Authorization is a short hand for getting the Authorization header from the
-// payload.
-func (payload InitPayload) Authorization() string {
- if value := payload.GetString("Authorization"); value != "" {
- return value
- }
-
- if value := payload.GetString("authorization"); value != "" {
- return value
- }
-
- return ""
-}
-
-func withInitPayload(ctx context.Context, payload InitPayload) context.Context {
- return context.WithValue(ctx, initpayload, payload)
-}
-
-// GetInitPayload gets a map of the data sent with the connection_init message, which is used by
-// graphql clients as a stand-in for HTTP headers.
-func GetInitPayload(ctx context.Context) InitPayload {
- payload, ok := ctx.Value(initpayload).(InitPayload)
- if !ok {
- return nil
- }
-
- return payload
-}
diff --git a/vendor/github.com/99designs/gqlgen/handler/graphql.go b/vendor/github.com/99designs/gqlgen/handler/graphql.go
deleted file mode 100644
index 289901f0f0f1eb28838093f2e5daa8616fa57ac9..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/handler/graphql.go
+++ /dev/null
@@ -1,802 +0,0 @@
-package handler
-
-import (
- "context"
- "crypto/sha256"
- "encoding/hex"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "mime"
- "net/http"
- "os"
- "strconv"
- "strings"
- "time"
-
- "github.com/99designs/gqlgen/complexity"
- "github.com/99designs/gqlgen/graphql"
- "github.com/gorilla/websocket"
- lru "github.com/hashicorp/golang-lru"
- "github.com/vektah/gqlparser/ast"
- "github.com/vektah/gqlparser/gqlerror"
- "github.com/vektah/gqlparser/parser"
- "github.com/vektah/gqlparser/validator"
-)
-
-type params struct {
- Query string `json:"query"`
- OperationName string `json:"operationName"`
- Variables map[string]interface{} `json:"variables"`
- Extensions *extensions `json:"extensions"`
-}
-
-type extensions struct {
- PersistedQuery *persistedQuery `json:"persistedQuery"`
-}
-
-type persistedQuery struct {
- Sha256 string `json:"sha256Hash"`
- Version int64 `json:"version"`
-}
-
-const (
- errPersistedQueryNotSupported = "PersistedQueryNotSupported"
- errPersistedQueryNotFound = "PersistedQueryNotFound"
-)
-
-type PersistedQueryCache interface {
- Add(ctx context.Context, hash string, query string)
- Get(ctx context.Context, hash string) (string, bool)
-}
-
-type websocketInitFunc func(ctx context.Context, initPayload InitPayload) error
-
-type Config struct {
- cacheSize int
- upgrader websocket.Upgrader
- recover graphql.RecoverFunc
- errorPresenter graphql.ErrorPresenterFunc
- resolverHook graphql.FieldMiddleware
- requestHook graphql.RequestMiddleware
- tracer graphql.Tracer
- complexityLimit int
- complexityLimitFunc graphql.ComplexityLimitFunc
- websocketInitFunc websocketInitFunc
- disableIntrospection bool
- connectionKeepAlivePingInterval time.Duration
- uploadMaxMemory int64
- uploadMaxSize int64
- apqCache PersistedQueryCache
-}
-
-func (c *Config) newRequestContext(es graphql.ExecutableSchema, doc *ast.QueryDocument, op *ast.OperationDefinition, query string, variables map[string]interface{}) *graphql.RequestContext {
- reqCtx := graphql.NewRequestContext(doc, query, variables)
- reqCtx.DisableIntrospection = c.disableIntrospection
-
- if hook := c.recover; hook != nil {
- reqCtx.Recover = hook
- }
-
- if hook := c.errorPresenter; hook != nil {
- reqCtx.ErrorPresenter = hook
- }
-
- if hook := c.resolverHook; hook != nil {
- reqCtx.ResolverMiddleware = hook
- }
-
- if hook := c.requestHook; hook != nil {
- reqCtx.RequestMiddleware = hook
- }
-
- if hook := c.tracer; hook != nil {
- reqCtx.Tracer = hook
- }
-
- if c.complexityLimit > 0 || c.complexityLimitFunc != nil {
- reqCtx.ComplexityLimit = c.complexityLimit
- operationComplexity := complexity.Calculate(es, op, variables)
- reqCtx.OperationComplexity = operationComplexity
- }
-
- return reqCtx
-}
-
-type Option func(cfg *Config)
-
-func WebsocketUpgrader(upgrader websocket.Upgrader) Option {
- return func(cfg *Config) {
- cfg.upgrader = upgrader
- }
-}
-
-func RecoverFunc(recover graphql.RecoverFunc) Option {
- return func(cfg *Config) {
- cfg.recover = recover
- }
-}
-
-// ErrorPresenter transforms errors found while resolving into errors that will be returned to the user. It provides
-// a good place to add any extra fields, like error.type, that might be desired by your frontend. Check the default
-// implementation in graphql.DefaultErrorPresenter for an example.
-func ErrorPresenter(f graphql.ErrorPresenterFunc) Option {
- return func(cfg *Config) {
- cfg.errorPresenter = f
- }
-}
-
-// IntrospectionEnabled = false will forbid clients from calling introspection endpoints. Can be useful in prod when you dont
-// want clients introspecting the full schema.
-func IntrospectionEnabled(enabled bool) Option {
- return func(cfg *Config) {
- cfg.disableIntrospection = !enabled
- }
-}
-
-// ComplexityLimit sets a maximum query complexity that is allowed to be executed.
-// If a query is submitted that exceeds the limit, a 422 status code will be returned.
-func ComplexityLimit(limit int) Option {
- return func(cfg *Config) {
- cfg.complexityLimit = limit
- }
-}
-
-// ComplexityLimitFunc allows you to define a function to dynamically set the maximum query complexity that is allowed
-// to be executed.
-// If a query is submitted that exceeds the limit, a 422 status code will be returned.
-func ComplexityLimitFunc(complexityLimitFunc graphql.ComplexityLimitFunc) Option {
- return func(cfg *Config) {
- cfg.complexityLimitFunc = complexityLimitFunc
- }
-}
-
-// ResolverMiddleware allows you to define a function that will be called around every resolver,
-// useful for logging.
-func ResolverMiddleware(middleware graphql.FieldMiddleware) Option {
- return func(cfg *Config) {
- if cfg.resolverHook == nil {
- cfg.resolverHook = middleware
- return
- }
-
- lastResolve := cfg.resolverHook
- cfg.resolverHook = func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) {
- return lastResolve(ctx, func(ctx context.Context) (res interface{}, err error) {
- return middleware(ctx, next)
- })
- }
- }
-}
-
-// RequestMiddleware allows you to define a function that will be called around the root request,
-// after the query has been parsed. This is useful for logging
-func RequestMiddleware(middleware graphql.RequestMiddleware) Option {
- return func(cfg *Config) {
- if cfg.requestHook == nil {
- cfg.requestHook = middleware
- return
- }
-
- lastResolve := cfg.requestHook
- cfg.requestHook = func(ctx context.Context, next func(ctx context.Context) []byte) []byte {
- return lastResolve(ctx, func(ctx context.Context) []byte {
- return middleware(ctx, next)
- })
- }
- }
-}
-
-// Tracer allows you to add a request/resolver tracer that will be called around the root request,
-// calling resolver. This is useful for tracing
-func Tracer(tracer graphql.Tracer) Option {
- return func(cfg *Config) {
- if cfg.tracer == nil {
- cfg.tracer = tracer
-
- } else {
- lastResolve := cfg.tracer
- cfg.tracer = &tracerWrapper{
- tracer1: lastResolve,
- tracer2: tracer,
- }
- }
-
- opt := RequestMiddleware(func(ctx context.Context, next func(ctx context.Context) []byte) []byte {
- ctx = tracer.StartOperationExecution(ctx)
- resp := next(ctx)
- tracer.EndOperationExecution(ctx)
-
- return resp
- })
- opt(cfg)
- }
-}
-
-type tracerWrapper struct {
- tracer1 graphql.Tracer
- tracer2 graphql.Tracer
-}
-
-func (tw *tracerWrapper) StartOperationParsing(ctx context.Context) context.Context {
- ctx = tw.tracer1.StartOperationParsing(ctx)
- ctx = tw.tracer2.StartOperationParsing(ctx)
- return ctx
-}
-
-func (tw *tracerWrapper) EndOperationParsing(ctx context.Context) {
- tw.tracer2.EndOperationParsing(ctx)
- tw.tracer1.EndOperationParsing(ctx)
-}
-
-func (tw *tracerWrapper) StartOperationValidation(ctx context.Context) context.Context {
- ctx = tw.tracer1.StartOperationValidation(ctx)
- ctx = tw.tracer2.StartOperationValidation(ctx)
- return ctx
-}
-
-func (tw *tracerWrapper) EndOperationValidation(ctx context.Context) {
- tw.tracer2.EndOperationValidation(ctx)
- tw.tracer1.EndOperationValidation(ctx)
-}
-
-func (tw *tracerWrapper) StartOperationExecution(ctx context.Context) context.Context {
- ctx = tw.tracer1.StartOperationExecution(ctx)
- ctx = tw.tracer2.StartOperationExecution(ctx)
- return ctx
-}
-
-func (tw *tracerWrapper) StartFieldExecution(ctx context.Context, field graphql.CollectedField) context.Context {
- ctx = tw.tracer1.StartFieldExecution(ctx, field)
- ctx = tw.tracer2.StartFieldExecution(ctx, field)
- return ctx
-}
-
-func (tw *tracerWrapper) StartFieldResolverExecution(ctx context.Context, rc *graphql.ResolverContext) context.Context {
- ctx = tw.tracer1.StartFieldResolverExecution(ctx, rc)
- ctx = tw.tracer2.StartFieldResolverExecution(ctx, rc)
- return ctx
-}
-
-func (tw *tracerWrapper) StartFieldChildExecution(ctx context.Context) context.Context {
- ctx = tw.tracer1.StartFieldChildExecution(ctx)
- ctx = tw.tracer2.StartFieldChildExecution(ctx)
- return ctx
-}
-
-func (tw *tracerWrapper) EndFieldExecution(ctx context.Context) {
- tw.tracer2.EndFieldExecution(ctx)
- tw.tracer1.EndFieldExecution(ctx)
-}
-
-func (tw *tracerWrapper) EndOperationExecution(ctx context.Context) {
- tw.tracer2.EndOperationExecution(ctx)
- tw.tracer1.EndOperationExecution(ctx)
-}
-
-// WebsocketInitFunc is called when the server receives connection init message from the client.
-// This can be used to check initial payload to see whether to accept the websocket connection.
-func WebsocketInitFunc(websocketInitFunc func(ctx context.Context, initPayload InitPayload) error) Option {
- return func(cfg *Config) {
- cfg.websocketInitFunc = websocketInitFunc
- }
-}
-
-// CacheSize sets the maximum size of the query cache.
-// If size is less than or equal to 0, the cache is disabled.
-func CacheSize(size int) Option {
- return func(cfg *Config) {
- cfg.cacheSize = size
- }
-}
-
-// UploadMaxSize sets the maximum number of bytes used to parse a request body
-// as multipart/form-data.
-func UploadMaxSize(size int64) Option {
- return func(cfg *Config) {
- cfg.uploadMaxSize = size
- }
-}
-
-// UploadMaxMemory sets the maximum number of bytes used to parse a request body
-// as multipart/form-data in memory, with the remainder stored on disk in
-// temporary files.
-func UploadMaxMemory(size int64) Option {
- return func(cfg *Config) {
- cfg.uploadMaxMemory = size
- }
-}
-
-// WebsocketKeepAliveDuration allows you to reconfigure the keepalive behavior.
-// By default, keepalive is enabled with a DefaultConnectionKeepAlivePingInterval
-// duration. Set handler.connectionKeepAlivePingInterval = 0 to disable keepalive
-// altogether.
-func WebsocketKeepAliveDuration(duration time.Duration) Option {
- return func(cfg *Config) {
- cfg.connectionKeepAlivePingInterval = duration
- }
-}
-
-// Add cache that will hold queries for automatic persisted queries (APQ)
-func EnablePersistedQueryCache(cache PersistedQueryCache) Option {
- return func(cfg *Config) {
- cfg.apqCache = cache
- }
-}
-
-const DefaultCacheSize = 1000
-const DefaultConnectionKeepAlivePingInterval = 25 * time.Second
-
-// DefaultUploadMaxMemory is the maximum number of bytes used to parse a request body
-// as multipart/form-data in memory, with the remainder stored on disk in
-// temporary files.
-const DefaultUploadMaxMemory = 32 << 20
-
-// DefaultUploadMaxSize is maximum number of bytes used to parse a request body
-// as multipart/form-data.
-const DefaultUploadMaxSize = 32 << 20
-
-func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc {
- cfg := &Config{
- cacheSize: DefaultCacheSize,
- uploadMaxMemory: DefaultUploadMaxMemory,
- uploadMaxSize: DefaultUploadMaxSize,
- connectionKeepAlivePingInterval: DefaultConnectionKeepAlivePingInterval,
- upgrader: websocket.Upgrader{
- ReadBufferSize: 1024,
- WriteBufferSize: 1024,
- },
- }
-
- for _, option := range options {
- option(cfg)
- }
-
- var cache *lru.Cache
- if cfg.cacheSize > 0 {
- var err error
- cache, err = lru.New(cfg.cacheSize)
- if err != nil {
- // An error is only returned for non-positive cache size
- // and we already checked for that.
- panic("unexpected error creating cache: " + err.Error())
- }
- }
- if cfg.tracer == nil {
- cfg.tracer = &graphql.NopTracer{}
- }
-
- handler := &graphqlHandler{
- cfg: cfg,
- cache: cache,
- exec: exec,
- }
-
- return handler.ServeHTTP
-}
-
-var _ http.Handler = (*graphqlHandler)(nil)
-
-type graphqlHandler struct {
- cfg *Config
- cache *lru.Cache
- exec graphql.ExecutableSchema
-}
-
-func computeQueryHash(query string) string {
- b := sha256.Sum256([]byte(query))
- return hex.EncodeToString(b[:])
-}
-
-func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- if r.Method == http.MethodOptions {
- w.Header().Set("Allow", "OPTIONS, GET, POST")
- w.WriteHeader(http.StatusOK)
- return
- }
-
- if strings.Contains(r.Header.Get("Upgrade"), "websocket") {
- connectWs(gh.exec, w, r, gh.cfg, gh.cache)
- return
- }
-
- w.Header().Set("Content-Type", "application/json")
- var reqParams params
- switch r.Method {
- case http.MethodGet:
- reqParams.Query = r.URL.Query().Get("query")
- reqParams.OperationName = r.URL.Query().Get("operationName")
-
- if variables := r.URL.Query().Get("variables"); variables != "" {
- if err := jsonDecode(strings.NewReader(variables), &reqParams.Variables); err != nil {
- sendErrorf(w, http.StatusBadRequest, "variables could not be decoded")
- return
- }
- }
-
- if extensions := r.URL.Query().Get("extensions"); extensions != "" {
- if err := jsonDecode(strings.NewReader(extensions), &reqParams.Extensions); err != nil {
- sendErrorf(w, http.StatusBadRequest, "extensions could not be decoded")
- return
- }
- }
- case http.MethodPost:
- mediaType, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
- if err != nil {
- sendErrorf(w, http.StatusBadRequest, "error parsing request Content-Type")
- return
- }
-
- switch mediaType {
- case "application/json":
- if err := jsonDecode(r.Body, &reqParams); err != nil {
- sendErrorf(w, http.StatusBadRequest, "json body could not be decoded: "+err.Error())
- return
- }
-
- case "multipart/form-data":
- var closers []io.Closer
- var tmpFiles []string
- defer func() {
- for i := len(closers) - 1; 0 <= i; i-- {
- _ = closers[i].Close()
- }
- for _, tmpFile := range tmpFiles {
- _ = os.Remove(tmpFile)
- }
- }()
- if err := processMultipart(w, r, &reqParams, &closers, &tmpFiles, gh.cfg.uploadMaxSize, gh.cfg.uploadMaxMemory); err != nil {
- sendErrorf(w, http.StatusBadRequest, "multipart body could not be decoded: "+err.Error())
- return
- }
- default:
- sendErrorf(w, http.StatusBadRequest, "unsupported Content-Type: "+mediaType)
- return
- }
- default:
- w.WriteHeader(http.StatusMethodNotAllowed)
- return
- }
-
- ctx := r.Context()
-
- var queryHash string
- apqRegister := false
- apq := reqParams.Extensions != nil && reqParams.Extensions.PersistedQuery != nil
- if apq {
- // client has enabled apq
- queryHash = reqParams.Extensions.PersistedQuery.Sha256
- if gh.cfg.apqCache == nil {
- // server has disabled apq
- sendErrorf(w, http.StatusOK, errPersistedQueryNotSupported)
- return
- }
- if reqParams.Extensions.PersistedQuery.Version != 1 {
- sendErrorf(w, http.StatusOK, "Unsupported persisted query version")
- return
- }
- if reqParams.Query == "" {
- // client sent optimistic query hash without query string
- query, ok := gh.cfg.apqCache.Get(ctx, queryHash)
- if !ok {
- sendErrorf(w, http.StatusOK, errPersistedQueryNotFound)
- return
- }
- reqParams.Query = query
- } else {
- if computeQueryHash(reqParams.Query) != queryHash {
- sendErrorf(w, http.StatusOK, "provided sha does not match query")
- return
- }
- apqRegister = true
- }
- } else if reqParams.Query == "" {
- sendErrorf(w, http.StatusUnprocessableEntity, "Must provide query string")
- return
- }
-
- var doc *ast.QueryDocument
- var cacheHit bool
- if gh.cache != nil {
- val, ok := gh.cache.Get(reqParams.Query)
- if ok {
- doc = val.(*ast.QueryDocument)
- cacheHit = true
- }
- }
-
- ctx, doc, gqlErr := gh.parseOperation(ctx, &parseOperationArgs{
- Query: reqParams.Query,
- CachedDoc: doc,
- })
- if gqlErr != nil {
- sendError(w, http.StatusUnprocessableEntity, gqlErr)
- return
- }
-
- ctx, op, vars, listErr := gh.validateOperation(ctx, &validateOperationArgs{
- Doc: doc,
- OperationName: reqParams.OperationName,
- CacheHit: cacheHit,
- R: r,
- Variables: reqParams.Variables,
- })
- if len(listErr) != 0 {
- sendError(w, http.StatusUnprocessableEntity, listErr...)
- return
- }
-
- if gh.cache != nil && !cacheHit {
- gh.cache.Add(reqParams.Query, doc)
- }
-
- reqCtx := gh.cfg.newRequestContext(gh.exec, doc, op, reqParams.Query, vars)
- ctx = graphql.WithRequestContext(ctx, reqCtx)
-
- defer func() {
- if err := recover(); err != nil {
- userErr := reqCtx.Recover(ctx, err)
- sendErrorf(w, http.StatusUnprocessableEntity, userErr.Error())
- }
- }()
-
- if gh.cfg.complexityLimitFunc != nil {
- reqCtx.ComplexityLimit = gh.cfg.complexityLimitFunc(ctx)
- }
-
- if reqCtx.ComplexityLimit > 0 && reqCtx.OperationComplexity > reqCtx.ComplexityLimit {
- sendErrorf(w, http.StatusUnprocessableEntity, "operation has complexity %d, which exceeds the limit of %d", reqCtx.OperationComplexity, reqCtx.ComplexityLimit)
- return
- }
-
- if apqRegister && gh.cfg.apqCache != nil {
- // Add to persisted query cache
- gh.cfg.apqCache.Add(ctx, queryHash, reqParams.Query)
- }
-
- switch op.Operation {
- case ast.Query:
- b, err := json.Marshal(gh.exec.Query(ctx, op))
- if err != nil {
- panic(err)
- }
- w.Write(b)
- case ast.Mutation:
- b, err := json.Marshal(gh.exec.Mutation(ctx, op))
- if err != nil {
- panic(err)
- }
- w.Write(b)
- default:
- sendErrorf(w, http.StatusBadRequest, "unsupported operation type")
- }
-}
-
-type parseOperationArgs struct {
- Query string
- CachedDoc *ast.QueryDocument
-}
-
-func (gh *graphqlHandler) parseOperation(ctx context.Context, args *parseOperationArgs) (context.Context, *ast.QueryDocument, *gqlerror.Error) {
- ctx = gh.cfg.tracer.StartOperationParsing(ctx)
- defer func() { gh.cfg.tracer.EndOperationParsing(ctx) }()
-
- if args.CachedDoc != nil {
- return ctx, args.CachedDoc, nil
- }
-
- doc, gqlErr := parser.ParseQuery(&ast.Source{Input: args.Query})
- if gqlErr != nil {
- return ctx, nil, gqlErr
- }
-
- return ctx, doc, nil
-}
-
-type validateOperationArgs struct {
- Doc *ast.QueryDocument
- OperationName string
- CacheHit bool
- R *http.Request
- Variables map[string]interface{}
-}
-
-func (gh *graphqlHandler) validateOperation(ctx context.Context, args *validateOperationArgs) (context.Context, *ast.OperationDefinition, map[string]interface{}, gqlerror.List) {
- ctx = gh.cfg.tracer.StartOperationValidation(ctx)
- defer func() { gh.cfg.tracer.EndOperationValidation(ctx) }()
-
- if !args.CacheHit {
- listErr := validator.Validate(gh.exec.Schema(), args.Doc)
- if len(listErr) != 0 {
- return ctx, nil, nil, listErr
- }
- }
-
- op := args.Doc.Operations.ForName(args.OperationName)
- if op == nil {
- return ctx, nil, nil, gqlerror.List{gqlerror.Errorf("operation %s not found", args.OperationName)}
- }
-
- if op.Operation != ast.Query && args.R.Method == http.MethodGet {
- return ctx, nil, nil, gqlerror.List{gqlerror.Errorf("GET requests only allow query operations")}
- }
-
- vars, err := validator.VariableValues(gh.exec.Schema(), op, args.Variables)
- if err != nil {
- return ctx, nil, nil, gqlerror.List{err}
- }
-
- return ctx, op, vars, nil
-}
-
-func jsonDecode(r io.Reader, val interface{}) error {
- dec := json.NewDecoder(r)
- dec.UseNumber()
- return dec.Decode(val)
-}
-
-func sendError(w http.ResponseWriter, code int, errors ...*gqlerror.Error) {
- w.WriteHeader(code)
- b, err := json.Marshal(&graphql.Response{Errors: errors})
- if err != nil {
- panic(err)
- }
- w.Write(b)
-}
-
-func sendErrorf(w http.ResponseWriter, code int, format string, args ...interface{}) {
- sendError(w, code, &gqlerror.Error{Message: fmt.Sprintf(format, args...)})
-}
-
-type bytesReader struct {
- s *[]byte
- i int64 // current reading index
- prevRune int // index of previous rune; or < 0
-}
-
-func (r *bytesReader) Read(b []byte) (n int, err error) {
- if r.s == nil {
- return 0, errors.New("byte slice pointer is nil")
- }
- if r.i >= int64(len(*r.s)) {
- return 0, io.EOF
- }
- r.prevRune = -1
- n = copy(b, (*r.s)[r.i:])
- r.i += int64(n)
- return
-}
-
-func processMultipart(w http.ResponseWriter, r *http.Request, request *params, closers *[]io.Closer, tmpFiles *[]string, uploadMaxSize, uploadMaxMemory int64) error {
- var err error
- if r.ContentLength > uploadMaxSize {
- return errors.New("failed to parse multipart form, request body too large")
- }
- r.Body = http.MaxBytesReader(w, r.Body, uploadMaxSize)
- if err = r.ParseMultipartForm(uploadMaxMemory); err != nil {
- if strings.Contains(err.Error(), "request body too large") {
- return errors.New("failed to parse multipart form, request body too large")
- }
- return errors.New("failed to parse multipart form")
- }
- *closers = append(*closers, r.Body)
-
- if err = jsonDecode(strings.NewReader(r.Form.Get("operations")), &request); err != nil {
- return errors.New("operations form field could not be decoded")
- }
-
- var uploadsMap = map[string][]string{}
- if err = json.Unmarshal([]byte(r.Form.Get("map")), &uploadsMap); err != nil {
- return errors.New("map form field could not be decoded")
- }
-
- var upload graphql.Upload
- for key, paths := range uploadsMap {
- if len(paths) == 0 {
- return fmt.Errorf("invalid empty operations paths list for key %s", key)
- }
- file, header, err := r.FormFile(key)
- if err != nil {
- return fmt.Errorf("failed to get key %s from form", key)
- }
- *closers = append(*closers, file)
-
- if len(paths) == 1 {
- upload = graphql.Upload{
- File: file,
- Size: header.Size,
- Filename: header.Filename,
- }
- err = addUploadToOperations(request, upload, key, paths[0])
- if err != nil {
- return err
- }
- } else {
- if r.ContentLength < uploadMaxMemory {
- fileBytes, err := ioutil.ReadAll(file)
- if err != nil {
- return fmt.Errorf("failed to read file for key %s", key)
- }
- for _, path := range paths {
- upload = graphql.Upload{
- File: &bytesReader{s: &fileBytes, i: 0, prevRune: -1},
- Size: header.Size,
- Filename: header.Filename,
- }
- err = addUploadToOperations(request, upload, key, path)
- if err != nil {
- return err
- }
- }
- } else {
- tmpFile, err := ioutil.TempFile(os.TempDir(), "gqlgen-")
- if err != nil {
- return fmt.Errorf("failed to create temp file for key %s", key)
- }
- tmpName := tmpFile.Name()
- *tmpFiles = append(*tmpFiles, tmpName)
- _, err = io.Copy(tmpFile, file)
- if err != nil {
- if err := tmpFile.Close(); err != nil {
- return fmt.Errorf("failed to copy to temp file and close temp file for key %s", key)
- }
- return fmt.Errorf("failed to copy to temp file for key %s", key)
- }
- if err := tmpFile.Close(); err != nil {
- return fmt.Errorf("failed to close temp file for key %s", key)
- }
- for _, path := range paths {
- pathTmpFile, err := os.Open(tmpName)
- if err != nil {
- return fmt.Errorf("failed to open temp file for key %s", key)
- }
- *closers = append(*closers, pathTmpFile)
- upload = graphql.Upload{
- File: pathTmpFile,
- Size: header.Size,
- Filename: header.Filename,
- }
- err = addUploadToOperations(request, upload, key, path)
- if err != nil {
- return err
- }
- }
- }
- }
- }
- return nil
-}
-
-func addUploadToOperations(request *params, upload graphql.Upload, key, path string) error {
- if !strings.HasPrefix(path, "variables.") {
- return fmt.Errorf("invalid operations paths for key %s", key)
- }
-
- var ptr interface{} = request.Variables
- parts := strings.Split(path, ".")
-
- // skip the first part (variables) because we started there
- for i, p := range parts[1:] {
- last := i == len(parts)-2
- if ptr == nil {
- return fmt.Errorf("path is missing \"variables.\" prefix, key: %s, path: %s", key, path)
- }
- if index, parseNbrErr := strconv.Atoi(p); parseNbrErr == nil {
- if last {
- ptr.([]interface{})[index] = upload
- } else {
- ptr = ptr.([]interface{})[index]
- }
- } else {
- if last {
- ptr.(map[string]interface{})[p] = upload
- } else {
- ptr = ptr.(map[string]interface{})[p]
- }
- }
- }
-
- return nil
-}
diff --git a/vendor/github.com/99designs/gqlgen/handler/mock.go b/vendor/github.com/99designs/gqlgen/handler/mock.go
deleted file mode 100644
index 3e70cf036bfb854cbedb89fff1b219204d5072aa..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/handler/mock.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package handler
-
-import (
- "context"
-
- "github.com/99designs/gqlgen/graphql"
- "github.com/vektah/gqlparser"
- "github.com/vektah/gqlparser/ast"
-)
-
-type executableSchemaMock struct {
- MutationFunc func(ctx context.Context, op *ast.OperationDefinition) *graphql.Response
-}
-
-var _ graphql.ExecutableSchema = &executableSchemaMock{}
-
-func (e *executableSchemaMock) Schema() *ast.Schema {
- return gqlparser.MustLoadSchema(&ast.Source{Input: `
- schema { query: Query, mutation: Mutation }
- type Query {
- empty: String!
- }
- scalar Upload
- type File {
- id: Int!
- }
- input UploadFile {
- id: Int!
- file: Upload!
- }
- type Mutation {
- singleUpload(file: Upload!): File!
- singleUploadWithPayload(req: UploadFile!): File!
- multipleUpload(files: [Upload!]!): [File!]!
- multipleUploadWithPayload(req: [UploadFile!]!): [File!]!
- }
- `})
-}
-
-func (e *executableSchemaMock) Complexity(typeName, field string, childComplexity int, args map[string]interface{}) (int, bool) {
- return 0, false
-}
-
-func (e *executableSchemaMock) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {
- return graphql.ErrorResponse(ctx, "queries are not supported")
-}
-
-func (e *executableSchemaMock) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {
- return e.MutationFunc(ctx, op)
-}
-
-func (e *executableSchemaMock) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response {
- return func() *graphql.Response {
- <-ctx.Done()
- return nil
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/handler/playground.go b/vendor/github.com/99designs/gqlgen/handler/playground.go
deleted file mode 100644
index 0e1ca76863bdb38c7f053b7fa9f3511e83394604..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/handler/playground.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package handler
-
-import (
- "html/template"
- "net/http"
-)
-
-var page = template.Must(template.New("graphiql").Parse(`
-
-
-
-
-
-
-
-
- {{.title}}
-
-
-
-
-
-
-
-`))
-
-func Playground(title string, endpoint string) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- w.Header().Add("Content-Type", "text/html")
- err := page.Execute(w, map[string]string{
- "title": title,
- "endpoint": endpoint,
- "version": "1.7.20",
- "cssSRI": "sha256-cS9Vc2OBt9eUf4sykRWukeFYaInL29+myBmFDSa7F/U=",
- "faviconSRI": "sha256-GhTyE+McTU79R4+pRO6ih+4TfsTOrpPwD8ReKFzb3PM=",
- "jsSRI": "sha256-4QG1Uza2GgGdlBL3RCBCGtGeZB6bDbsw8OltCMGeJsA=",
- })
- if err != nil {
- panic(err)
- }
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/handler/stub.go b/vendor/github.com/99designs/gqlgen/handler/stub.go
deleted file mode 100644
index d237e188921489bbf7bb528341c2ed4be68300f6..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/handler/stub.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package handler
-
-import (
- "context"
-
- "github.com/99designs/gqlgen/graphql"
- "github.com/vektah/gqlparser"
- "github.com/vektah/gqlparser/ast"
-)
-
-type executableSchemaStub struct {
- NextResp chan struct{}
-}
-
-var _ graphql.ExecutableSchema = &executableSchemaStub{}
-
-func (e *executableSchemaStub) Schema() *ast.Schema {
- return gqlparser.MustLoadSchema(&ast.Source{Input: `
- schema { query: Query }
- type Query {
- me: User!
- user(id: Int): User!
- }
- type User { name: String! }
- `})
-}
-
-func (e *executableSchemaStub) Complexity(typeName, field string, childComplexity int, args map[string]interface{}) (int, bool) {
- return 0, false
-}
-
-func (e *executableSchemaStub) Query(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {
- return &graphql.Response{Data: []byte(`{"name":"test"}`)}
-}
-
-func (e *executableSchemaStub) Mutation(ctx context.Context, op *ast.OperationDefinition) *graphql.Response {
- return graphql.ErrorResponse(ctx, "mutations are not supported")
-}
-
-func (e *executableSchemaStub) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response {
- return func() *graphql.Response {
- select {
- case <-ctx.Done():
- return nil
- case <-e.NextResp:
- return &graphql.Response{
- Data: []byte(`{"name":"test"}`),
- }
- }
- }
-}
diff --git a/vendor/github.com/99designs/gqlgen/handler/websocket.go b/vendor/github.com/99designs/gqlgen/handler/websocket.go
deleted file mode 100644
index 0637cfb19e6db9564f72d0ce10abab2e4092bf12..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/handler/websocket.go
+++ /dev/null
@@ -1,323 +0,0 @@
-package handler
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "fmt"
- "log"
- "net/http"
- "sync"
- "time"
-
- "github.com/99designs/gqlgen/graphql"
- "github.com/gorilla/websocket"
- lru "github.com/hashicorp/golang-lru"
- "github.com/vektah/gqlparser"
- "github.com/vektah/gqlparser/ast"
- "github.com/vektah/gqlparser/gqlerror"
- "github.com/vektah/gqlparser/validator"
-)
-
-const (
- connectionInitMsg = "connection_init" // Client -> Server
- connectionTerminateMsg = "connection_terminate" // Client -> Server
- startMsg = "start" // Client -> Server
- stopMsg = "stop" // Client -> Server
- connectionAckMsg = "connection_ack" // Server -> Client
- connectionErrorMsg = "connection_error" // Server -> Client
- dataMsg = "data" // Server -> Client
- errorMsg = "error" // Server -> Client
- completeMsg = "complete" // Server -> Client
- connectionKeepAliveMsg = "ka" // Server -> Client
-)
-
-type operationMessage struct {
- Payload json.RawMessage `json:"payload,omitempty"`
- ID string `json:"id,omitempty"`
- Type string `json:"type"`
-}
-
-type wsConnection struct {
- ctx context.Context
- conn *websocket.Conn
- exec graphql.ExecutableSchema
- active map[string]context.CancelFunc
- mu sync.Mutex
- cfg *Config
- cache *lru.Cache
- keepAliveTicker *time.Ticker
-
- initPayload InitPayload
-}
-
-func connectWs(exec graphql.ExecutableSchema, w http.ResponseWriter, r *http.Request, cfg *Config, cache *lru.Cache) {
- ws, err := cfg.upgrader.Upgrade(w, r, http.Header{
- "Sec-Websocket-Protocol": []string{"graphql-ws"},
- })
- if err != nil {
- log.Printf("unable to upgrade %T to websocket %s: ", w, err.Error())
- sendErrorf(w, http.StatusBadRequest, "unable to upgrade")
- return
- }
-
- conn := wsConnection{
- active: map[string]context.CancelFunc{},
- exec: exec,
- conn: ws,
- ctx: r.Context(),
- cfg: cfg,
- cache: cache,
- }
-
- if !conn.init() {
- return
- }
-
- conn.run()
-}
-
-func (c *wsConnection) init() bool {
- message := c.readOp()
- if message == nil {
- c.close(websocket.CloseProtocolError, "decoding error")
- return false
- }
-
- switch message.Type {
- case connectionInitMsg:
- if len(message.Payload) > 0 {
- c.initPayload = make(InitPayload)
- err := json.Unmarshal(message.Payload, &c.initPayload)
- if err != nil {
- return false
- }
- }
-
- if c.cfg.websocketInitFunc != nil {
- if err := c.cfg.websocketInitFunc(c.ctx, c.initPayload); err != nil {
- c.sendConnectionError(err.Error())
- c.close(websocket.CloseNormalClosure, "terminated")
- return false
- }
- }
-
- c.write(&operationMessage{Type: connectionAckMsg})
- c.write(&operationMessage{Type: connectionKeepAliveMsg})
- case connectionTerminateMsg:
- c.close(websocket.CloseNormalClosure, "terminated")
- return false
- default:
- c.sendConnectionError("unexpected message %s", message.Type)
- c.close(websocket.CloseProtocolError, "unexpected message")
- return false
- }
-
- return true
-}
-
-func (c *wsConnection) write(msg *operationMessage) {
- c.mu.Lock()
- c.conn.WriteJSON(msg)
- c.mu.Unlock()
-}
-
-func (c *wsConnection) run() {
- // We create a cancellation that will shutdown the keep-alive when we leave
- // this function.
- ctx, cancel := context.WithCancel(c.ctx)
- defer cancel()
-
- // Create a timer that will fire every interval to keep the connection alive.
- if c.cfg.connectionKeepAlivePingInterval != 0 {
- c.mu.Lock()
- c.keepAliveTicker = time.NewTicker(c.cfg.connectionKeepAlivePingInterval)
- c.mu.Unlock()
-
- go c.keepAlive(ctx)
- }
-
- for {
- message := c.readOp()
- if message == nil {
- return
- }
-
- switch message.Type {
- case startMsg:
- if !c.subscribe(message) {
- return
- }
- case stopMsg:
- c.mu.Lock()
- closer := c.active[message.ID]
- c.mu.Unlock()
- if closer == nil {
- c.sendError(message.ID, gqlerror.Errorf("%s is not running, cannot stop", message.ID))
- continue
- }
-
- closer()
- case connectionTerminateMsg:
- c.close(websocket.CloseNormalClosure, "terminated")
- return
- default:
- c.sendConnectionError("unexpected message %s", message.Type)
- c.close(websocket.CloseProtocolError, "unexpected message")
- return
- }
- }
-}
-
-func (c *wsConnection) keepAlive(ctx context.Context) {
- for {
- select {
- case <-ctx.Done():
- c.keepAliveTicker.Stop()
- return
- case <-c.keepAliveTicker.C:
- c.write(&operationMessage{Type: connectionKeepAliveMsg})
- }
- }
-}
-
-func (c *wsConnection) subscribe(message *operationMessage) bool {
- var reqParams params
- if err := jsonDecode(bytes.NewReader(message.Payload), &reqParams); err != nil {
- c.sendConnectionError("invalid json")
- return false
- }
-
- var (
- doc *ast.QueryDocument
- cacheHit bool
- )
- if c.cache != nil {
- val, ok := c.cache.Get(reqParams.Query)
- if ok {
- doc = val.(*ast.QueryDocument)
- cacheHit = true
- }
- }
- if !cacheHit {
- var qErr gqlerror.List
- doc, qErr = gqlparser.LoadQuery(c.exec.Schema(), reqParams.Query)
- if qErr != nil {
- c.sendError(message.ID, qErr...)
- return true
- }
- if c.cache != nil {
- c.cache.Add(reqParams.Query, doc)
- }
- }
-
- op := doc.Operations.ForName(reqParams.OperationName)
- if op == nil {
- c.sendError(message.ID, gqlerror.Errorf("operation %s not found", reqParams.OperationName))
- return true
- }
-
- vars, err := validator.VariableValues(c.exec.Schema(), op, reqParams.Variables)
- if err != nil {
- c.sendError(message.ID, err)
- return true
- }
- reqCtx := c.cfg.newRequestContext(c.exec, doc, op, reqParams.Query, vars)
- ctx := graphql.WithRequestContext(c.ctx, reqCtx)
-
- if c.initPayload != nil {
- ctx = withInitPayload(ctx, c.initPayload)
- }
-
- if op.Operation != ast.Subscription {
- var result *graphql.Response
- if op.Operation == ast.Query {
- result = c.exec.Query(ctx, op)
- } else {
- result = c.exec.Mutation(ctx, op)
- }
-
- c.sendData(message.ID, result)
- c.write(&operationMessage{ID: message.ID, Type: completeMsg})
- return true
- }
-
- ctx, cancel := context.WithCancel(ctx)
- c.mu.Lock()
- c.active[message.ID] = cancel
- c.mu.Unlock()
- go func() {
- defer func() {
- if r := recover(); r != nil {
- userErr := reqCtx.Recover(ctx, r)
- c.sendError(message.ID, &gqlerror.Error{Message: userErr.Error()})
- }
- }()
- next := c.exec.Subscription(ctx, op)
- for result := next(); result != nil; result = next() {
- c.sendData(message.ID, result)
- }
-
- c.write(&operationMessage{ID: message.ID, Type: completeMsg})
-
- c.mu.Lock()
- delete(c.active, message.ID)
- c.mu.Unlock()
- cancel()
- }()
-
- return true
-}
-
-func (c *wsConnection) sendData(id string, response *graphql.Response) {
- b, err := json.Marshal(response)
- if err != nil {
- c.sendError(id, gqlerror.Errorf("unable to encode json response: %s", err.Error()))
- return
- }
-
- c.write(&operationMessage{Type: dataMsg, ID: id, Payload: b})
-}
-
-func (c *wsConnection) sendError(id string, errors ...*gqlerror.Error) {
- errs := make([]error, len(errors))
- for i, err := range errors {
- errs[i] = err
- }
- b, err := json.Marshal(errs)
- if err != nil {
- panic(err)
- }
- c.write(&operationMessage{Type: errorMsg, ID: id, Payload: b})
-}
-
-func (c *wsConnection) sendConnectionError(format string, args ...interface{}) {
- b, err := json.Marshal(&gqlerror.Error{Message: fmt.Sprintf(format, args...)})
- if err != nil {
- panic(err)
- }
-
- c.write(&operationMessage{Type: connectionErrorMsg, Payload: b})
-}
-
-func (c *wsConnection) readOp() *operationMessage {
- _, r, err := c.conn.NextReader()
- if err != nil {
- c.sendConnectionError("invalid json")
- return nil
- }
- message := operationMessage{}
- if err := jsonDecode(r, &message); err != nil {
- c.sendConnectionError("invalid json")
- return nil
- }
-
- return &message
-}
-
-func (c *wsConnection) close(closeCode int, message string) {
- c.mu.Lock()
- _ = c.conn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(closeCode, message))
- c.mu.Unlock()
- _ = c.conn.Close()
-}
diff --git a/vendor/github.com/99designs/gqlgen/internal/code/compare.go b/vendor/github.com/99designs/gqlgen/internal/code/compare.go
deleted file mode 100644
index dce9aea558f14ea036bbe9455a1d5818a32d0379..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/internal/code/compare.go
+++ /dev/null
@@ -1,163 +0,0 @@
-package code
-
-import (
- "fmt"
- "go/types"
-)
-
-// CompatibleTypes isnt a strict comparison, it allows for pointer differences
-func CompatibleTypes(expected types.Type, actual types.Type) error {
- //fmt.Println("Comparing ", expected.String(), actual.String())
-
- // Special case to deal with pointer mismatches
- {
- expectedPtr, expectedIsPtr := expected.(*types.Pointer)
- actualPtr, actualIsPtr := actual.(*types.Pointer)
-
- if expectedIsPtr && actualIsPtr {
- return CompatibleTypes(expectedPtr.Elem(), actualPtr.Elem())
- }
- if expectedIsPtr && !actualIsPtr {
- return CompatibleTypes(expectedPtr.Elem(), actual)
- }
- if !expectedIsPtr && actualIsPtr {
- return CompatibleTypes(expected, actualPtr.Elem())
- }
- }
-
- switch expected := expected.(type) {
- case *types.Slice:
- if actual, ok := actual.(*types.Slice); ok {
- return CompatibleTypes(expected.Elem(), actual.Elem())
- }
-
- case *types.Array:
- if actual, ok := actual.(*types.Array); ok {
- if expected.Len() != actual.Len() {
- return fmt.Errorf("array length differs")
- }
-
- return CompatibleTypes(expected.Elem(), actual.Elem())
- }
-
- case *types.Basic:
- if actual, ok := actual.(*types.Basic); ok {
- if actual.Kind() != expected.Kind() {
- return fmt.Errorf("basic kind differs, %s != %s", expected.Name(), actual.Name())
- }
-
- return nil
- }
-
- case *types.Struct:
- if actual, ok := actual.(*types.Struct); ok {
- if expected.NumFields() != actual.NumFields() {
- return fmt.Errorf("number of struct fields differ")
- }
-
- for i := 0; i < expected.NumFields(); i++ {
- if expected.Field(i).Name() != actual.Field(i).Name() {
- return fmt.Errorf("struct field %d name differs, %s != %s", i, expected.Field(i).Name(), actual.Field(i).Name())
- }
- if err := CompatibleTypes(expected.Field(i).Type(), actual.Field(i).Type()); err != nil {
- return err
- }
- }
- return nil
- }
-
- case *types.Tuple:
- if actual, ok := actual.(*types.Tuple); ok {
- if expected.Len() != actual.Len() {
- return fmt.Errorf("tuple length differs, %d != %d", expected.Len(), actual.Len())
- }
-
- for i := 0; i < expected.Len(); i++ {
- if err := CompatibleTypes(expected.At(i).Type(), actual.At(i).Type()); err != nil {
- return err
- }
- }
-
- return nil
- }
-
- case *types.Signature:
- if actual, ok := actual.(*types.Signature); ok {
- if err := CompatibleTypes(expected.Params(), actual.Params()); err != nil {
- return err
- }
- if err := CompatibleTypes(expected.Results(), actual.Results()); err != nil {
- return err
- }
-
- return nil
- }
- case *types.Interface:
- if actual, ok := actual.(*types.Interface); ok {
- if expected.NumMethods() != actual.NumMethods() {
- return fmt.Errorf("interface method count differs, %d != %d", expected.NumMethods(), actual.NumMethods())
- }
-
- for i := 0; i < expected.NumMethods(); i++ {
- if expected.Method(i).Name() != actual.Method(i).Name() {
- return fmt.Errorf("interface method %d name differs, %s != %s", i, expected.Method(i).Name(), actual.Method(i).Name())
- }
- if err := CompatibleTypes(expected.Method(i).Type(), actual.Method(i).Type()); err != nil {
- return err
- }
- }
-
- return nil
- }
-
- case *types.Map:
- if actual, ok := actual.(*types.Map); ok {
- if err := CompatibleTypes(expected.Key(), actual.Key()); err != nil {
- return err
- }
-
- if err := CompatibleTypes(expected.Elem(), actual.Elem()); err != nil {
- return err
- }
-
- return nil
- }
-
- case *types.Chan:
- if actual, ok := actual.(*types.Chan); ok {
- return CompatibleTypes(expected.Elem(), actual.Elem())
- }
-
- case *types.Named:
- if actual, ok := actual.(*types.Named); ok {
- if NormalizeVendor(expected.Obj().Pkg().Path()) != NormalizeVendor(actual.Obj().Pkg().Path()) {
- return fmt.Errorf(
- "package name of named type differs, %s != %s",
- NormalizeVendor(expected.Obj().Pkg().Path()),
- NormalizeVendor(actual.Obj().Pkg().Path()),
- )
- }
-
- if expected.Obj().Name() != actual.Obj().Name() {
- return fmt.Errorf(
- "named type name differs, %s != %s",
- NormalizeVendor(expected.Obj().Name()),
- NormalizeVendor(actual.Obj().Name()),
- )
- }
-
- return nil
- }
-
- // Before models are generated all missing references will be Invalid Basic references.
- // lets assume these are valid too.
- if actual, ok := actual.(*types.Basic); ok && actual.Kind() == types.Invalid {
- return nil
- }
-
- default:
- return fmt.Errorf("missing support for %T", expected)
- }
-
- return fmt.Errorf("type mismatch %T != %T", expected, actual)
-}
diff --git a/vendor/github.com/99designs/gqlgen/internal/code/imports.go b/vendor/github.com/99designs/gqlgen/internal/code/imports.go
deleted file mode 100644
index ad62f7c56b11363fcd36e99d83156ee34f990770..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/internal/code/imports.go
+++ /dev/null
@@ -1,115 +0,0 @@
-package code
-
-import (
- "errors"
- "go/build"
- "go/parser"
- "go/token"
- "io/ioutil"
- "path/filepath"
- "regexp"
- "strings"
- "sync"
-
- "golang.org/x/tools/go/packages"
-)
-
-var nameForPackageCache = sync.Map{}
-
-var gopaths []string
-
-func init() {
- gopaths = filepath.SplitList(build.Default.GOPATH)
- for i, p := range gopaths {
- gopaths[i] = filepath.ToSlash(filepath.Join(p, "src"))
- }
-}
-
-// NameForDir manually looks for package stanzas in files located in the given directory. This can be
-// much faster than having to consult go list, because we already know exactly where to look.
-func NameForDir(dir string) string {
- dir, err := filepath.Abs(dir)
- if err != nil {
- return SanitizePackageName(filepath.Base(dir))
- }
- files, err := ioutil.ReadDir(dir)
- if err != nil {
- return SanitizePackageName(filepath.Base(dir))
- }
- fset := token.NewFileSet()
- for _, file := range files {
- if !strings.HasSuffix(strings.ToLower(file.Name()), ".go") {
- continue
- }
-
- filename := filepath.Join(dir, file.Name())
- if src, err := parser.ParseFile(fset, filename, nil, parser.PackageClauseOnly); err == nil {
- return src.Name.Name
- }
- }
-
- return SanitizePackageName(filepath.Base(dir))
-}
-
-// ImportPathForDir takes a path and returns a golang import path for the package
-func ImportPathForDir(dir string) (res string) {
- dir, err := filepath.Abs(dir)
- if err != nil {
- panic(err)
- }
- dir = filepath.ToSlash(dir)
-
- modDir := dir
- assumedPart := ""
- for {
- f, err := ioutil.ReadFile(filepath.Join(modDir, "go.mod"))
- if err == nil {
- // found it, stop searching
- return string(modregex.FindSubmatch(f)[1]) + assumedPart
- }
-
- assumedPart = "/" + filepath.Base(modDir) + assumedPart
- parentDir, err := filepath.Abs(filepath.Join(modDir, ".."))
- if err != nil {
- panic(err)
- }
-
- if parentDir == modDir {
- // Walked all the way to the root and didnt find anything :'(
- break
- }
- modDir = parentDir
- }
-
- for _, gopath := range gopaths {
- if len(gopath) < len(dir) && strings.EqualFold(gopath, dir[0:len(gopath)]) {
- return dir[len(gopath)+1:]
- }
- }
-
- return ""
-}
-
-var modregex = regexp.MustCompile("module (.*)\n")
-
-// NameForPackage returns the package name for a given import path. This can be really slow.
-func NameForPackage(importPath string) string {
- if importPath == "" {
- panic(errors.New("import path can not be empty"))
- }
- if v, ok := nameForPackageCache.Load(importPath); ok {
- return v.(string)
- }
- importPath = QualifyPackagePath(importPath)
- p, _ := packages.Load(&packages.Config{
- Mode: packages.NeedName,
- }, importPath)
-
- if len(p) != 1 || p[0].Name == "" {
- return SanitizePackageName(filepath.Base(importPath))
- }
-
- nameForPackageCache.Store(importPath, p[0].Name)
-
- return p[0].Name
-}
diff --git a/vendor/github.com/99designs/gqlgen/internal/code/util.go b/vendor/github.com/99designs/gqlgen/internal/code/util.go
deleted file mode 100644
index 2be83a23cea586ebd1bd534d1cde8db2f2e7d5cf..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/internal/code/util.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package code
-
-import (
- "go/build"
- "os"
- "path/filepath"
- "regexp"
- "strings"
-)
-
-// take a string in the form github.com/package/blah.Type and split it into package and type
-func PkgAndType(name string) (string, string) {
- parts := strings.Split(name, ".")
- if len(parts) == 1 {
- return "", name
- }
-
- return strings.Join(parts[:len(parts)-1], "."), parts[len(parts)-1]
-}
-
-var modsRegex = regexp.MustCompile(`^(\*|\[\])*`)
-
-// NormalizeVendor takes a qualified package path and turns it into normal one.
-// eg .
-// github.com/foo/vendor/github.com/99designs/gqlgen/graphql becomes
-// github.com/99designs/gqlgen/graphql
-func NormalizeVendor(pkg string) string {
- modifiers := modsRegex.FindAllString(pkg, 1)[0]
- pkg = strings.TrimPrefix(pkg, modifiers)
- parts := strings.Split(pkg, "/vendor/")
- return modifiers + parts[len(parts)-1]
-}
-
-// QualifyPackagePath takes an import and fully qualifies it with a vendor dir, if one is required.
-// eg .
-// github.com/99designs/gqlgen/graphql becomes
-// github.com/foo/vendor/github.com/99designs/gqlgen/graphql
-//
-// x/tools/packages only supports 'qualified package paths' so this will need to be done prior to calling it
-// See https://github.com/golang/go/issues/30289
-func QualifyPackagePath(importPath string) string {
- wd, _ := os.Getwd()
-
- pkg, err := build.Import(importPath, wd, 0)
- if err != nil {
- return importPath
- }
-
- return pkg.ImportPath
-}
-
-var invalidPackageNameChar = regexp.MustCompile(`[^\w]`)
-
-func SanitizePackageName(pkg string) string {
- return invalidPackageNameChar.ReplaceAllLiteralString(filepath.Base(pkg), "_")
-}
diff --git a/vendor/github.com/99designs/gqlgen/internal/imports/prune.go b/vendor/github.com/99designs/gqlgen/internal/imports/prune.go
deleted file mode 100644
index 27ac94ac0f04c868c8a2903da64f82d4b2163551..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/internal/imports/prune.go
+++ /dev/null
@@ -1,100 +0,0 @@
-// Wrapper around x/tools/imports that only removes imports, never adds new ones.
-
-package imports
-
-import (
- "bytes"
- "go/ast"
- "go/parser"
- "go/printer"
- "go/token"
- "strings"
-
- "github.com/99designs/gqlgen/internal/code"
-
- "golang.org/x/tools/go/ast/astutil"
- "golang.org/x/tools/imports"
-)
-
-type visitFn func(node ast.Node)
-
-func (fn visitFn) Visit(node ast.Node) ast.Visitor {
- fn(node)
- return fn
-}
-
-// Prune removes any unused imports
-func Prune(filename string, src []byte) ([]byte, error) {
- fset := token.NewFileSet()
-
- file, err := parser.ParseFile(fset, filename, src, parser.ParseComments|parser.AllErrors)
- if err != nil {
- return nil, err
- }
-
- unused := getUnusedImports(file)
- for ipath, name := range unused {
- astutil.DeleteNamedImport(fset, file, name, ipath)
- }
- printConfig := &printer.Config{Mode: printer.TabIndent, Tabwidth: 8}
-
- var buf bytes.Buffer
- if err := printConfig.Fprint(&buf, fset, file); err != nil {
- return nil, err
- }
-
- return imports.Process(filename, buf.Bytes(), &imports.Options{FormatOnly: true, Comments: true, TabIndent: true, TabWidth: 8})
-}
-
-func getUnusedImports(file ast.Node) map[string]string {
- imported := map[string]*ast.ImportSpec{}
- used := map[string]bool{}
-
- ast.Walk(visitFn(func(node ast.Node) {
- if node == nil {
- return
- }
- switch v := node.(type) {
- case *ast.ImportSpec:
- if v.Name != nil {
- imported[v.Name.Name] = v
- break
- }
- ipath := strings.Trim(v.Path.Value, `"`)
- if ipath == "C" {
- break
- }
-
- local := code.NameForPackage(ipath)
-
- imported[local] = v
- case *ast.SelectorExpr:
- xident, ok := v.X.(*ast.Ident)
- if !ok {
- break
- }
- if xident.Obj != nil {
- // if the parser can resolve it, it's not a package ref
- break
- }
- used[xident.Name] = true
- }
- }), file)
-
- for pkg := range used {
- delete(imported, pkg)
- }
-
- unusedImport := map[string]string{}
- for pkg, is := range imported {
- if !used[pkg] && pkg != "_" && pkg != "." {
- name := ""
- if is.Name != nil {
- name = is.Name.Name
- }
- unusedImport[strings.Trim(is.Path.Value, `"`)] = name
- }
- }
-
- return unusedImport
-}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.go b/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.go
deleted file mode 100644
index 376499ae218a89da3182e615c5fbb1ad56bd3ba1..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.go
+++ /dev/null
@@ -1,237 +0,0 @@
-package modelgen
-
-import (
- "fmt"
- "go/types"
- "sort"
-
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/99designs/gqlgen/internal/code"
- "github.com/99designs/gqlgen/plugin"
- "github.com/vektah/gqlparser/ast"
-)
-
-type ModelBuild struct {
- PackageName string
- Interfaces []*Interface
- Models []*Object
- Enums []*Enum
- Scalars []string
-}
-
-type Interface struct {
- Description string
- Name string
-}
-
-type Object struct {
- Description string
- Name string
- Fields []*Field
- Implements []string
-}
-
-type Field struct {
- Description string
- Name string
- Type types.Type
- Tag string
-}
-
-type Enum struct {
- Description string
- Name string
- Values []*EnumValue
-}
-
-type EnumValue struct {
- Description string
- Name string
-}
-
-func New() plugin.Plugin {
- return &Plugin{}
-}
-
-type Plugin struct{}
-
-var _ plugin.ConfigMutator = &Plugin{}
-
-func (m *Plugin) Name() string {
- return "modelgen"
-}
-
-func (m *Plugin) MutateConfig(cfg *config.Config) error {
- if err := cfg.Check(); err != nil {
- return err
- }
-
- schema, _, err := cfg.LoadSchema()
- if err != nil {
- return err
- }
-
- err = cfg.Autobind(schema)
- if err != nil {
- return err
- }
-
- cfg.InjectBuiltins(schema)
-
- binder, err := cfg.NewBinder(schema)
- if err != nil {
- return err
- }
-
- b := &ModelBuild{
- PackageName: cfg.Model.Package,
- }
-
- for _, schemaType := range schema.Types {
- if cfg.Models.UserDefined(schemaType.Name) {
- continue
- }
-
- switch schemaType.Kind {
- case ast.Interface, ast.Union:
- it := &Interface{
- Description: schemaType.Description,
- Name: schemaType.Name,
- }
-
- b.Interfaces = append(b.Interfaces, it)
- case ast.Object, ast.InputObject:
- if schemaType == schema.Query || schemaType == schema.Mutation || schemaType == schema.Subscription {
- continue
- }
- it := &Object{
- Description: schemaType.Description,
- Name: schemaType.Name,
- }
-
- for _, implementor := range schema.GetImplements(schemaType) {
- it.Implements = append(it.Implements, implementor.Name)
- }
-
- for _, field := range schemaType.Fields {
- var typ types.Type
- fieldDef := schema.Types[field.Type.Name()]
-
- if cfg.Models.UserDefined(field.Type.Name()) {
- pkg, typeName := code.PkgAndType(cfg.Models[field.Type.Name()].Model[0])
- typ, err = binder.FindType(pkg, typeName)
- if err != nil {
- return err
- }
- } else {
- switch fieldDef.Kind {
- case ast.Scalar:
- // no user defined model, referencing a default scalar
- typ = types.NewNamed(
- types.NewTypeName(0, cfg.Model.Pkg(), "string", nil),
- nil,
- nil,
- )
-
- case ast.Interface, ast.Union:
- // no user defined model, referencing a generated interface type
- typ = types.NewNamed(
- types.NewTypeName(0, cfg.Model.Pkg(), templates.ToGo(field.Type.Name()), nil),
- types.NewInterfaceType([]*types.Func{}, []types.Type{}),
- nil,
- )
-
- case ast.Enum:
- // no user defined model, must reference a generated enum
- typ = types.NewNamed(
- types.NewTypeName(0, cfg.Model.Pkg(), templates.ToGo(field.Type.Name()), nil),
- nil,
- nil,
- )
-
- case ast.Object, ast.InputObject:
- // no user defined model, must reference a generated struct
- typ = types.NewNamed(
- types.NewTypeName(0, cfg.Model.Pkg(), templates.ToGo(field.Type.Name()), nil),
- types.NewStruct(nil, nil),
- nil,
- )
-
- default:
- panic(fmt.Errorf("unknown ast type %s", fieldDef.Kind))
- }
- }
-
- name := field.Name
- if nameOveride := cfg.Models[schemaType.Name].Fields[field.Name].FieldName; nameOveride != "" {
- name = nameOveride
- }
-
- typ = binder.CopyModifiersFromAst(field.Type, typ)
-
- if isStruct(typ) && (fieldDef.Kind == ast.Object || fieldDef.Kind == ast.InputObject) {
- typ = types.NewPointer(typ)
- }
-
- it.Fields = append(it.Fields, &Field{
- Name: name,
- Type: typ,
- Description: field.Description,
- Tag: `json:"` + field.Name + `"`,
- })
- }
-
- b.Models = append(b.Models, it)
- case ast.Enum:
- it := &Enum{
- Name: schemaType.Name,
- Description: schemaType.Description,
- }
-
- for _, v := range schemaType.EnumValues {
- it.Values = append(it.Values, &EnumValue{
- Name: v.Name,
- Description: v.Description,
- })
- }
-
- b.Enums = append(b.Enums, it)
- case ast.Scalar:
- b.Scalars = append(b.Scalars, schemaType.Name)
- }
- }
-
- sort.Slice(b.Enums, func(i, j int) bool { return b.Enums[i].Name < b.Enums[j].Name })
- sort.Slice(b.Models, func(i, j int) bool { return b.Models[i].Name < b.Models[j].Name })
- sort.Slice(b.Interfaces, func(i, j int) bool { return b.Interfaces[i].Name < b.Interfaces[j].Name })
-
- for _, it := range b.Enums {
- cfg.Models.Add(it.Name, cfg.Model.ImportPath()+"."+templates.ToGo(it.Name))
- }
- for _, it := range b.Models {
- cfg.Models.Add(it.Name, cfg.Model.ImportPath()+"."+templates.ToGo(it.Name))
- }
- for _, it := range b.Interfaces {
- cfg.Models.Add(it.Name, cfg.Model.ImportPath()+"."+templates.ToGo(it.Name))
- }
- for _, it := range b.Scalars {
- cfg.Models.Add(it, "github.com/99designs/gqlgen/graphql.String")
- }
-
- if len(b.Models) == 0 && len(b.Enums) == 0 {
- return nil
- }
-
- return templates.Render(templates.Options{
- PackageName: cfg.Model.Package,
- Filename: cfg.Model.Filename,
- Data: b,
- GeneratedHeader: true,
- })
-}
-
-func isStruct(t types.Type) bool {
- _, is := t.Underlying().(*types.Struct)
- return is
-}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.gotpl b/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.gotpl
deleted file mode 100644
index a4579f87612ece0e0c8ad186a1f247b9aec8d038..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/modelgen/models.gotpl
+++ /dev/null
@@ -1,85 +0,0 @@
-{{ reserveImport "context" }}
-{{ reserveImport "fmt" }}
-{{ reserveImport "io" }}
-{{ reserveImport "strconv" }}
-{{ reserveImport "time" }}
-{{ reserveImport "sync" }}
-{{ reserveImport "errors" }}
-{{ reserveImport "bytes" }}
-
-{{ reserveImport "github.com/vektah/gqlparser" }}
-{{ reserveImport "github.com/vektah/gqlparser/ast" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }}
-
-{{- range $model := .Interfaces }}
- {{ with .Description }} {{.|prefixLines "// "}} {{ end }}
- type {{.Name|go }} interface {
- Is{{.Name|go }}()
- }
-{{- end }}
-
-{{ range $model := .Models }}
- {{with .Description }} {{.|prefixLines "// "}} {{end}}
- type {{ .Name|go }} struct {
- {{- range $field := .Fields }}
- {{- with .Description }}
- {{.|prefixLines "// "}}
- {{- end}}
- {{ $field.Name|go }} {{$field.Type | ref}} `{{$field.Tag}}`
- {{- end }}
- }
-
- {{- range $iface := .Implements }}
- func ({{ $model.Name|go }}) Is{{ $iface|go }}() {}
- {{- end }}
-{{- end}}
-
-{{ range $enum := .Enums }}
- {{ with .Description }} {{.|prefixLines "// "}} {{end}}
- type {{.Name|go }} string
- const (
- {{- range $value := .Values}}
- {{- with .Description}}
- {{.|prefixLines "// "}}
- {{- end}}
- {{ $enum.Name|go }}{{ .Name|go }} {{$enum.Name|go }} = {{.Name|quote}}
- {{- end }}
- )
-
- var All{{.Name|go }} = []{{ .Name|go }}{
- {{- range $value := .Values}}
- {{$enum.Name|go }}{{ .Name|go }},
- {{- end }}
- }
-
- func (e {{.Name|go }}) IsValid() bool {
- switch e {
- case {{ range $index, $element := .Values}}{{if $index}},{{end}}{{ $enum.Name|go }}{{ $element.Name|go }}{{end}}:
- return true
- }
- return false
- }
-
- func (e {{.Name|go }}) String() string {
- return string(e)
- }
-
- func (e *{{.Name|go }}) UnmarshalGQL(v interface{}) error {
- str, ok := v.(string)
- if !ok {
- return fmt.Errorf("enums must be strings")
- }
-
- *e = {{ .Name|go }}(str)
- if !e.IsValid() {
- return fmt.Errorf("%s is not a valid {{ .Name }}", str)
- }
- return nil
- }
-
- func (e {{.Name|go }}) MarshalGQL(w io.Writer) {
- fmt.Fprint(w, strconv.Quote(e.String()))
- }
-
-{{- end }}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/plugin.go b/vendor/github.com/99designs/gqlgen/plugin/plugin.go
deleted file mode 100644
index a84bfd3273d96464ced143b9ef6b9f2598ae9921..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/plugin.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// plugin package interfaces are EXPERIMENTAL.
-
-package plugin
-
-import (
- "github.com/99designs/gqlgen/codegen"
- "github.com/99designs/gqlgen/codegen/config"
-)
-
-type Plugin interface {
- Name() string
-}
-
-type ConfigMutator interface {
- MutateConfig(cfg *config.Config) error
-}
-
-type CodeGenerator interface {
- GenerateCode(cfg *codegen.Data) error
-}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.go b/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.go
deleted file mode 100644
index 6785c77c45fa3086e12a71c6608e6c6d7de0fbe4..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package resolvergen
-
-import (
- "log"
- "os"
-
- "github.com/99designs/gqlgen/codegen"
- "github.com/99designs/gqlgen/codegen/templates"
- "github.com/99designs/gqlgen/plugin"
- "github.com/pkg/errors"
-)
-
-func New() plugin.Plugin {
- return &Plugin{}
-}
-
-type Plugin struct{}
-
-var _ plugin.CodeGenerator = &Plugin{}
-
-func (m *Plugin) Name() string {
- // TODO: typo, should be resolvergen
- return "resovlergen"
-}
-func (m *Plugin) GenerateCode(data *codegen.Data) error {
- if !data.Config.Resolver.IsDefined() {
- return nil
- }
-
- resolverBuild := &ResolverBuild{
- Data: data,
- PackageName: data.Config.Resolver.Package,
- ResolverType: data.Config.Resolver.Type,
- }
- filename := data.Config.Resolver.Filename
-
- if _, err := os.Stat(filename); os.IsNotExist(errors.Cause(err)) {
- return templates.Render(templates.Options{
- PackageName: data.Config.Resolver.Package,
- Filename: data.Config.Resolver.Filename,
- Data: resolverBuild,
- })
- }
-
- log.Printf("Skipped resolver: %s already exists\n", filename)
- return nil
-}
-
-type ResolverBuild struct {
- *codegen.Data
-
- PackageName string
- ResolverType string
-}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.gotpl b/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.gotpl
deleted file mode 100644
index 66d6efac25ea1b3aa796fc9139317bb737baeb60..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.gotpl
+++ /dev/null
@@ -1,40 +0,0 @@
-// THIS CODE IS A STARTING POINT ONLY. IT WILL NOT BE UPDATED WITH SCHEMA CHANGES.
-
-{{ reserveImport "context" }}
-{{ reserveImport "fmt" }}
-{{ reserveImport "io" }}
-{{ reserveImport "strconv" }}
-{{ reserveImport "time" }}
-{{ reserveImport "sync" }}
-{{ reserveImport "errors" }}
-{{ reserveImport "bytes" }}
-
-{{ reserveImport "github.com/99designs/gqlgen/handler" }}
-{{ reserveImport "github.com/vektah/gqlparser" }}
-{{ reserveImport "github.com/vektah/gqlparser/ast" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql" }}
-{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }}
-
-type {{.ResolverType}} struct {}
-
-{{ range $object := .Objects -}}
- {{- if $object.HasResolvers -}}
- func (r *{{$.ResolverType}}) {{$object.Name}}() {{ $object.ResolverInterface | ref }} {
- return &{{lcFirst $object.Name}}{{ucFirst $.ResolverType}}{r}
- }
- {{ end -}}
-{{ end }}
-
-{{ range $object := .Objects -}}
- {{- if $object.HasResolvers -}}
- type {{lcFirst $object.Name}}{{ucFirst $.ResolverType}} struct { *{{$.ResolverType}} }
-
- {{ range $field := $object.Fields -}}
- {{- if $field.IsResolver -}}
- func (r *{{lcFirst $object.Name}}{{ucFirst $.ResolverType}}) {{$field.GoFieldName}}{{ $field.ShortResolverDeclaration }} {
- panic("not implemented")
- }
- {{ end -}}
- {{ end -}}
- {{ end -}}
-{{ end }}
diff --git a/vendor/github.com/99designs/gqlgen/plugin/schemaconfig/schemaconfig.go b/vendor/github.com/99designs/gqlgen/plugin/schemaconfig/schemaconfig.go
deleted file mode 100644
index 1fcf41050492f3aac3e5af5ed163a5a62ab514ce..0000000000000000000000000000000000000000
--- a/vendor/github.com/99designs/gqlgen/plugin/schemaconfig/schemaconfig.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package schemaconfig
-
-import (
- "github.com/99designs/gqlgen/codegen/config"
- "github.com/99designs/gqlgen/plugin"
- "github.com/vektah/gqlparser/ast"
-)
-
-func New() plugin.Plugin {
- return &Plugin{}
-}
-
-type Plugin struct{}
-
-var _ plugin.ConfigMutator = &Plugin{}
-
-func (m *Plugin) Name() string {
- return "schemaconfig"
-}
-
-func (m *Plugin) MutateConfig(cfg *config.Config) error {
- if err := cfg.Check(); err != nil {
- return err
- }
-
- schema, _, err := cfg.LoadSchema()
- if err != nil {
- return err
- }
-
- cfg.Directives["goModel"] = config.DirectiveConfig{
- SkipRuntime: true,
- }
-
- cfg.Directives["goField"] = config.DirectiveConfig{
- SkipRuntime: true,
- }
-
- for _, schemaType := range schema.Types {
- if schemaType == schema.Query || schemaType == schema.Mutation || schemaType == schema.Subscription {
- continue
- }
-
- if bd := schemaType.Directives.ForName("goModel"); bd != nil {
- if ma := bd.Arguments.ForName("model"); ma != nil {
- if mv, err := ma.Value.Value(nil); err == nil {
- cfg.Models.Add(schemaType.Name, mv.(string))
- }
- }
- if ma := bd.Arguments.ForName("models"); ma != nil {
- if mvs, err := ma.Value.Value(nil); err == nil {
- for _, mv := range mvs.([]interface{}) {
- cfg.Models.Add(schemaType.Name, mv.(string))
- }
- }
- }
- }
-
- if schemaType.Kind == ast.Object || schemaType.Kind == ast.InputObject {
- for _, field := range schemaType.Fields {
- if fd := field.Directives.ForName("goField"); fd != nil {
- forceResolver := cfg.Models[schemaType.Name].Fields[field.Name].Resolver
- fieldName := cfg.Models[schemaType.Name].Fields[field.Name].FieldName
-
- if ra := fd.Arguments.ForName("forceResolver"); ra != nil {
- if fr, err := ra.Value.Value(nil); err == nil {
- forceResolver = fr.(bool)
- }
- }
-
- if na := fd.Arguments.ForName("name"); na != nil {
- if fr, err := na.Value.Value(nil); err == nil {
- fieldName = fr.(string)
- }
- }
-
- if cfg.Models[schemaType.Name].Fields == nil {
- cfg.Models[schemaType.Name] = config.TypeMapEntry{
- Model: cfg.Models[schemaType.Name].Model,
- Fields: map[string]config.TypeMapField{},
- }
- }
-
- cfg.Models[schemaType.Name].Fields[field.Name] = config.TypeMapField{
- FieldName: fieldName,
- Resolver: forceResolver,
- }
- }
- }
- }
- }
- return nil
-}
diff --git a/vendor/github.com/MichaelMure/go-term-text/.gitignore b/vendor/github.com/MichaelMure/go-term-text/.gitignore
deleted file mode 100644
index 9f11b755a17d8192c60f61cb17b8902dffbd9f23..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-.idea/
diff --git a/vendor/github.com/MichaelMure/go-term-text/.travis.yml b/vendor/github.com/MichaelMure/go-term-text/.travis.yml
deleted file mode 100644
index c5db9518a7cc5ecce9aa847194f2ae3bf34663df..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/.travis.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-language: go
-
-go:
- - 1.11.x
- - 1.12.x
- - 1.13.x
-
-env:
- - GO111MODULE=on
-
-script:
- - go build
- - go test -v -bench=. -race -coverprofile=coverage.txt -covermode=atomic ./...
-
-after_success:
- - bash <(curl -s https://codecov.io/bash)
diff --git a/vendor/github.com/MichaelMure/go-term-text/LICENSE b/vendor/github.com/MichaelMure/go-term-text/LICENSE
deleted file mode 100644
index 5ba12bf4c57df74e3ce495aa1de20c69df86419a..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2019 Michael Muré
-
-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/MichaelMure/go-term-text/Readme.md b/vendor/github.com/MichaelMure/go-term-text/Readme.md
deleted file mode 100644
index 25722ee9028c7ce0fdc082a12bf8f9f4227ebfb1..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/Readme.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# go-term-text
-
-[](https://travis-ci.org/MichaelMure/go-term-text)
-[](https://godoc.org/github.com/MichaelMure/go-term-text)
-[](https://goreportcard.com/report/github.com/MichaelMure/go-term-text)
-[](https://codecov.io/gh/MichaelMure/go-term-text)
-[](https://github.com/MichaelMure/go-term-text/blob/master/LICENSE)
-[](https://gitter.im/the-git-bug/Lobby)
-
-`go-term-text` is a go package implementing a collection of algorithms to help format and manipulate text for the terminal.
-
-In particular, `go-term-text`:
-- support wide characters (chinese, japanese ...) and emoji
-- handle properly ANSI escape sequences
-
-Included algorithms cover:
-- wrapping with padding and indentation
-- padding
-- text length
-- trimming
-- alignment
-- escape sequence extraction and reapplication
-- escape sequence snapshot and simplification
-- truncation
-
-## Example
-
-```go
-package main
-
-import (
- "fmt"
- "strings"
-
- "github.com/MichaelMure/go-term-text"
-)
-
-func main() {
- input := "The \x1b[1mLorem ipsum\x1b[0m text is typically composed of " +
- "pseudo-Latin words. It is commonly used as \x1b[3mplaceholder\x1b[0m" +
- " text to examine or demonstrate the \x1b[9mvisual effects\x1b[0m of " +
- "various graphic design. 一只 A Quick \x1b[31m敏捷的狐 Fox " +
- "狸跳过了\x1b[0mDog一只懒狗。"
-
- output, n := text.Wrap(input, 60,
- text.WrapIndent("\x1b[34m<-indent-> \x1b[0m"),
- text.WrapPad("\x1b[33m<-pad-> \x1b[0m"),
- )
-
- fmt.Printf("output has %d lines\n\n", n)
-
- fmt.Println("|" + strings.Repeat("-", 58) + "|")
- fmt.Println(output)
- fmt.Println("|" + strings.Repeat("-", 58) + "|")
-}
-```
-
-This will print:
-
-
-
-For more details, have a look at the [GoDoc](https://godoc.org/github.com/MichaelMure/go-term-text).
-
-## Origin
-
-This package has been extracted from the [git-bug](https://github.com/MichaelMure/git-bug) project. As such, its aim is to support this project and not to provide an all-in-one solution. Contributions as welcome though.
-
-## Contribute
-
-PRs accepted.
-
-## License
-
-MIT
diff --git a/vendor/github.com/MichaelMure/go-term-text/align.go b/vendor/github.com/MichaelMure/go-term-text/align.go
deleted file mode 100644
index 8262a4de5d62c2ccbce6d7a3b21602d51bba0d03..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/align.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package text
-
-import (
- "strings"
-)
-
-type Alignment int
-
-const (
- NoAlign Alignment = iota
- AlignLeft
- AlignCenter
- AlignRight
-)
-
-// LineAlign align the given line as asked and apply the needed padding to match the given
-// lineWidth, while ignoring the terminal escape sequences.
-// If the given lineWidth is too small to fit the given line, it's returned without
-// padding, overflowing lineWidth.
-func LineAlign(line string, lineWidth int, align Alignment) string {
- switch align {
- case NoAlign:
- return line
- case AlignLeft:
- return LineAlignLeft(line, lineWidth)
- case AlignCenter:
- return LineAlignCenter(line, lineWidth)
- case AlignRight:
- return LineAlignRight(line, lineWidth)
- }
- panic("unknown alignment")
-}
-
-// LineAlignLeft align the given line on the left while ignoring the terminal escape sequences.
-// If the given lineWidth is too small to fit the given line, it's returned without
-// padding, overflowing lineWidth.
-func LineAlignLeft(line string, lineWidth int) string {
- return TrimSpace(line)
-}
-
-// LineAlignCenter align the given line on the center and apply the needed left
-// padding, while ignoring the terminal escape sequences.
-// If the given lineWidth is too small to fit the given line, it's returned without
-// padding, overflowing lineWidth.
-func LineAlignCenter(line string, lineWidth int) string {
- trimmed := TrimSpace(line)
- totalPadLen := lineWidth - Len(trimmed)
- if totalPadLen < 0 {
- totalPadLen = 0
- }
- pad := strings.Repeat(" ", totalPadLen/2)
- return pad + trimmed
-}
-
-// LineAlignRight align the given line on the right and apply the needed left
-// padding to match the given lineWidth, while ignoring the terminal escape sequences.
-// If the given lineWidth is too small to fit the given line, it's returned without
-// padding, overflowing lineWidth.
-func LineAlignRight(line string, lineWidth int) string {
- trimmed := TrimSpace(line)
- padLen := lineWidth - Len(trimmed)
- if padLen < 0 {
- padLen = 0
- }
- pad := strings.Repeat(" ", padLen)
- return pad + trimmed
-}
diff --git a/vendor/github.com/MichaelMure/go-term-text/escape_state.go b/vendor/github.com/MichaelMure/go-term-text/escape_state.go
deleted file mode 100644
index cec35c26f00ac4f4b4ed75c2f7ebdb2d2446f925..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/escape_state.go
+++ /dev/null
@@ -1,265 +0,0 @@
-package text
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-const Escape = '\x1b'
-
-type EscapeState struct {
- Bold bool
- Dim bool
- Italic bool
- Underlined bool
- Blink bool
- Reverse bool
- Hidden bool
- CrossedOut bool
-
- FgColor Color
- BgColor Color
-}
-
-type Color interface {
- Codes() []string
-}
-
-func (es *EscapeState) Witness(s string) {
- inEscape := false
- var start int
-
- runes := []rune(s)
-
- for i, r := range runes {
- if r == Escape {
- inEscape = true
- start = i
- continue
- }
- if inEscape {
- if r == 'm' {
- inEscape = false
- es.witnessCode(string(runes[start+1 : i]))
- }
- continue
- }
- }
-}
-
-func (es *EscapeState) witnessCode(s string) {
- if s == "" {
- return
- }
- if s == "[" {
- es.reset()
- return
- }
- if len(s) < 2 {
- return
- }
- if s[0] != '[' {
- return
- }
-
- s = s[1:]
- split := strings.Split(s, ";")
-
- dequeue := func() {
- split = split[1:]
- }
-
- color := func(ground int) Color {
- if len(split) < 1 {
- // the whole sequence is broken, ignoring the rest
- return nil
- }
-
- subCode := split[0]
- dequeue()
-
- switch subCode {
- case "2":
- if len(split) < 3 {
- return nil
- }
- r, err := strconv.Atoi(split[0])
- dequeue()
- if err != nil {
- return nil
- }
- g, err := strconv.Atoi(split[0])
- dequeue()
- if err != nil {
- return nil
- }
- b, err := strconv.Atoi(split[0])
- dequeue()
- if err != nil {
- return nil
- }
- return &ColorRGB{ground: ground, R: r, G: g, B: b}
-
- case "5":
- if len(split) < 1 {
- return nil
- }
- index, err := strconv.Atoi(split[0])
- dequeue()
- if err != nil {
- return nil
- }
- return &Color256{ground: ground, Index: index}
-
- }
- return nil
- }
-
- for len(split) > 0 {
- code, err := strconv.Atoi(split[0])
- if err != nil {
- return
- }
- dequeue()
-
- switch {
- case code == 0:
- es.reset()
-
- case code == 1:
- es.Bold = true
- case code == 2:
- es.Dim = true
- case code == 3:
- es.Italic = true
- case code == 4:
- es.Underlined = true
- case code == 5:
- es.Blink = true
- // case code == 6:
- case code == 7:
- es.Reverse = true
- case code == 8:
- es.Hidden = true
- case code == 9:
- es.CrossedOut = true
-
- case code == 21:
- es.Bold = false
- case code == 22:
- es.Dim = false
- case code == 23:
- es.Italic = false
- case code == 24:
- es.Underlined = false
- case code == 25:
- es.Blink = false
- // case code == 26:
- case code == 27:
- es.Reverse = false
- case code == 28:
- es.Hidden = false
- case code == 29:
- es.CrossedOut = false
-
- case (code >= 30 && code <= 37) || code == 39 || (code >= 90 && code <= 97):
- es.FgColor = ColorIndex(code)
-
- case (code >= 40 && code <= 47) || code == 49 || (code >= 100 && code <= 107):
- es.BgColor = ColorIndex(code)
-
- case code == 38:
- es.FgColor = color(code)
- if es.FgColor == nil {
- return
- }
-
- case code == 48:
- es.BgColor = color(code)
- if es.BgColor == nil {
- return
- }
- }
- }
-}
-
-func (es *EscapeState) reset() {
- *es = EscapeState{}
-}
-
-func (es *EscapeState) String() string {
- var codes []string
-
- if es.Bold {
- codes = append(codes, strconv.Itoa(1))
- }
- if es.Dim {
- codes = append(codes, strconv.Itoa(2))
- }
- if es.Italic {
- codes = append(codes, strconv.Itoa(3))
- }
- if es.Underlined {
- codes = append(codes, strconv.Itoa(4))
- }
- if es.Blink {
- codes = append(codes, strconv.Itoa(5))
- }
- if es.Reverse {
- codes = append(codes, strconv.Itoa(7))
- }
- if es.Hidden {
- codes = append(codes, strconv.Itoa(8))
- }
- if es.CrossedOut {
- codes = append(codes, strconv.Itoa(9))
- }
-
- if es.FgColor != nil {
- codes = append(codes, es.FgColor.Codes()...)
- }
- if es.BgColor != nil {
- codes = append(codes, es.BgColor.Codes()...)
- }
-
- if len(codes) == 0 {
- return "\x1b[0m"
- }
-
- return fmt.Sprintf("\x1b[%sm", strings.Join(codes, ";"))
-}
-
-type ColorIndex int
-
-func (cInd ColorIndex) Codes() []string {
- return []string{strconv.Itoa(int(cInd))}
-}
-
-type Color256 struct {
- ground int
- Index int
-}
-
-func (c256 Color256) Codes() []string {
- return []string{
- strconv.Itoa(c256.ground),
- "5",
- strconv.Itoa(c256.Index),
- }
-}
-
-type ColorRGB struct {
- ground int
- R, G, B int
-}
-
-func (cRGB ColorRGB) Codes() []string {
- return []string{
- strconv.Itoa(cRGB.ground),
- "2",
- strconv.Itoa(cRGB.R),
- strconv.Itoa(cRGB.G),
- strconv.Itoa(cRGB.B),
- }
-}
diff --git a/vendor/github.com/MichaelMure/go-term-text/escapes.go b/vendor/github.com/MichaelMure/go-term-text/escapes.go
deleted file mode 100644
index 19f78c9269851d5d0cead8397f488228704f9344..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/escapes.go
+++ /dev/null
@@ -1,95 +0,0 @@
-package text
-
-import (
- "strings"
- "unicode/utf8"
-)
-
-// EscapeItem hold the description of terminal escapes in a line.
-// 'item' is the actual escape command
-// 'pos' is the index in the rune array where the 'item' shall be inserted back.
-// For example, the escape item in "F\x1b33mox" is {"\x1b33m", 1}.
-type EscapeItem struct {
- Item string
- Pos int
-}
-
-// ExtractTermEscapes extract terminal escapes out of a line and returns a new
-// line without terminal escapes and a slice of escape items. The terminal escapes
-// can be inserted back into the new line at rune index 'item.pos' to recover the
-// original line.
-//
-// Required: The line shall not contain "\n"
-func ExtractTermEscapes(line string) (string, []EscapeItem) {
- var termEscapes []EscapeItem
- var line1 strings.Builder
-
- pos := 0
- item := ""
- occupiedRuneCount := 0
- inEscape := false
- for i, r := range []rune(line) {
- if r == '\x1b' {
- pos = i
- item = string(r)
- inEscape = true
- continue
- }
- if inEscape {
- item += string(r)
- if r == 'm' {
- termEscapes = append(termEscapes, EscapeItem{item, pos - occupiedRuneCount})
- occupiedRuneCount += utf8.RuneCountInString(item)
- inEscape = false
- }
- continue
- }
- line1.WriteRune(r)
- }
-
- return line1.String(), termEscapes
-}
-
-// ApplyTermEscapes apply the extracted terminal escapes to the edited line.
-// Escape sequences need to be ordered by their position.
-// If the position is < 0, the escape is applied at the beginning of the line.
-// If the position is > len(line), the escape is applied at the end of the line.
-func ApplyTermEscapes(line string, escapes []EscapeItem) string {
- if len(escapes) == 0 {
- return line
- }
-
- var out strings.Builder
-
- currPos := 0
- currItem := 0
- for _, r := range line {
- for currItem < len(escapes) && currPos >= escapes[currItem].Pos {
- out.WriteString(escapes[currItem].Item)
- currItem++
- }
- out.WriteRune(r)
- currPos++
- }
-
- // Don't forget the trailing escapes, if any.
- for currItem < len(escapes) {
- out.WriteString(escapes[currItem].Item)
- currItem++
- }
-
- return out.String()
-}
-
-// OffsetEscapes is a utility function to offset the position of a
-// collection of EscapeItem.
-func OffsetEscapes(escapes []EscapeItem, offset int) []EscapeItem {
- result := make([]EscapeItem, len(escapes))
- for i, e := range escapes {
- result[i] = EscapeItem{
- Item: e.Item,
- Pos: e.Pos + offset,
- }
- }
- return result
-}
diff --git a/vendor/github.com/MichaelMure/go-term-text/go.mod b/vendor/github.com/MichaelMure/go-term-text/go.mod
deleted file mode 100644
index a03c8606225ac1fee5aafcb3dce91205168256db..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/go.mod
+++ /dev/null
@@ -1,8 +0,0 @@
-module github.com/MichaelMure/go-term-text
-
-go 1.11
-
-require (
- github.com/mattn/go-runewidth v0.0.6
- github.com/stretchr/testify v1.3.0
-)
diff --git a/vendor/github.com/MichaelMure/go-term-text/go.sum b/vendor/github.com/MichaelMure/go-term-text/go.sum
deleted file mode 100644
index a119b457101b0d75624d5a5056856047841999cf..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/go.sum
+++ /dev/null
@@ -1,9 +0,0 @@
-github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
-github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/mattn/go-runewidth v0.0.6 h1:V2iyH+aX9C5fsYCpK60U8BYIvmhqxuOL3JZcqc1NB7k=
-github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
-github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
diff --git a/vendor/github.com/MichaelMure/go-term-text/left_pad.go b/vendor/github.com/MichaelMure/go-term-text/left_pad.go
deleted file mode 100644
index a63fedb9bf9b5872a95a9e5c5f8303fbebd0e792..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/left_pad.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package text
-
-import (
- "bytes"
- "strings"
-
- "github.com/mattn/go-runewidth"
-)
-
-// LeftPadMaxLine pads a line on the left by a specified amount and pads the
-// string on the right to fill the maxLength.
-// If the given string is too long, it is truncated with an ellipsis.
-// Handle properly terminal color escape code
-func LeftPadMaxLine(line string, length, leftPad int) string {
- cleaned, escapes := ExtractTermEscapes(line)
-
- scrWidth := runewidth.StringWidth(cleaned)
- // truncate and ellipse if needed
- if scrWidth+leftPad > length {
- cleaned = runewidth.Truncate(cleaned, length-leftPad, "…")
- } else if scrWidth+leftPad < length {
- cleaned = runewidth.FillRight(cleaned, length-leftPad)
- }
-
- rightPart := ApplyTermEscapes(cleaned, escapes)
- pad := strings.Repeat(" ", leftPad)
-
- return pad + rightPart
-}
-
-// LeftPad left pad each line of the given text
-func LeftPadLines(text string, leftPad int) string {
- var result bytes.Buffer
-
- pad := strings.Repeat(" ", leftPad)
-
- lines := strings.Split(text, "\n")
-
- for i, line := range lines {
- result.WriteString(pad)
- result.WriteString(line)
-
- // no additional line break at the end
- if i < len(lines)-1 {
- result.WriteString("\n")
- }
- }
-
- return result.String()
-}
diff --git a/vendor/github.com/MichaelMure/go-term-text/len.go b/vendor/github.com/MichaelMure/go-term-text/len.go
deleted file mode 100644
index c6bcaeaca8c803f7d5d08538ef95c63e1b117527..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/len.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package text
-
-import (
- "strings"
-
- "github.com/mattn/go-runewidth"
-)
-
-// Len return the length of a string in a terminal, while ignoring the terminal
-// escape sequences.
-func Len(text string) int {
- length := 0
- escape := false
-
- for _, char := range text {
- if char == '\x1b' {
- escape = true
- }
- if !escape {
- length += runewidth.RuneWidth(char)
- }
- if char == 'm' {
- escape = false
- }
- }
-
- return length
-}
-
-// MaxLineLen return the length in a terminal of the longest line, while
-// ignoring the terminal escape sequences.
-func MaxLineLen(text string) int {
- lines := strings.Split(text, "\n")
-
- max := 0
-
- for _, line := range lines {
- length := Len(line)
- if length > max {
- max = length
- }
- }
-
- return max
-}
diff --git a/vendor/github.com/MichaelMure/go-term-text/trim.go b/vendor/github.com/MichaelMure/go-term-text/trim.go
deleted file mode 100644
index eaf2ca0c0714135f301d5d7bffeeb08b93fe5bd0..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/trim.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package text
-
-import (
- "strings"
- "unicode"
-)
-
-// TrimSpace remove the leading and trailing whitespace while ignoring the
-// terminal escape sequences.
-// Returns the number of trimmed space on both side.
-func TrimSpace(line string) string {
- cleaned, escapes := ExtractTermEscapes(line)
-
- // trim left while counting
- left := 0
- trimmed := strings.TrimLeftFunc(cleaned, func(r rune) bool {
- if unicode.IsSpace(r) {
- left++
- return true
- }
- return false
- })
-
- trimmed = strings.TrimRightFunc(trimmed, unicode.IsSpace)
-
- escapes = OffsetEscapes(escapes, -left)
- return ApplyTermEscapes(trimmed, escapes)
-}
diff --git a/vendor/github.com/MichaelMure/go-term-text/truncate.go b/vendor/github.com/MichaelMure/go-term-text/truncate.go
deleted file mode 100644
index b51bb39e3740ec89f5265d2a3b9743f71283d244..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/truncate.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package text
-
-import "github.com/mattn/go-runewidth"
-
-// TruncateMax truncate a line if its length is greater
-// than the given length. Otherwise, the line is returned
-// as is. If truncating occur, an ellipsis is inserted at
-// the end.
-// Handle properly terminal color escape code
-func TruncateMax(line string, length int) string {
- if length <= 0 {
- return "…"
- }
-
- l := Len(line)
- if l <= length || l == 0 {
- return line
- }
-
- cleaned, escapes := ExtractTermEscapes(line)
- truncated := runewidth.Truncate(cleaned, length-1, "")
-
- return ApplyTermEscapes(truncated, escapes) + "…"
-}
diff --git a/vendor/github.com/MichaelMure/go-term-text/wrap.go b/vendor/github.com/MichaelMure/go-term-text/wrap.go
deleted file mode 100644
index eba9e0b897660e88d6c0e39d39f7b83df2cdb976..0000000000000000000000000000000000000000
--- a/vendor/github.com/MichaelMure/go-term-text/wrap.go
+++ /dev/null
@@ -1,407 +0,0 @@
-package text
-
-import (
- "strings"
-
- "github.com/mattn/go-runewidth"
-)
-
-// Force runewidth not to treat ambiguous runes as wide chars, so that things
-// like unicode ellipsis/up/down/left/right glyphs can have correct runewidth
-// and can be displayed correctly in terminals.
-func init() {
- runewidth.DefaultCondition.EastAsianWidth = false
-}
-
-type wrapOpts struct {
- indent string
- pad string
- align Alignment
-}
-
-// WrapOption is a functional option for the Wrap() function
-type WrapOption func(opts *wrapOpts)
-
-// WrapPad configure the padding with a string for Wrap()
-func WrapPad(pad string) WrapOption {
- return func(opts *wrapOpts) {
- opts.pad = pad
- }
-}
-
-// WrapPadded configure the padding with a number of space characters for Wrap()
-func WrapPadded(padLen int) WrapOption {
- return func(opts *wrapOpts) {
- opts.pad = strings.Repeat(" ", padLen)
- }
-}
-
-// WrapPad configure the indentation on the first line for Wrap()
-func WrapIndent(indent string) WrapOption {
- return func(opts *wrapOpts) {
- opts.indent = indent
- }
-}
-
-// WrapAlign configure the text alignment for Wrap()
-func WrapAlign(align Alignment) WrapOption {
- return func(opts *wrapOpts) {
- opts.align = align
- }
-}
-
-// allWrapOpts compile the set of WrapOption into a final wrapOpts
-// from the default values.
-func allWrapOpts(opts []WrapOption) *wrapOpts {
- wrapOpts := &wrapOpts{
- indent: "",
- pad: "",
- align: NoAlign,
- }
- for _, opt := range opts {
- opt(wrapOpts)
- }
- if wrapOpts.indent == "" {
- wrapOpts.indent = wrapOpts.pad
- }
- return wrapOpts
-}
-
-// Wrap a text for a given line size.
-// Handle properly terminal color escape code
-// Options are accepted to configure things like indent, padding or alignment.
-// Return the wrapped text and the number of lines
-func Wrap(text string, lineWidth int, opts ...WrapOption) (string, int) {
- wrapOpts := allWrapOpts(opts)
-
- if lineWidth <= 0 {
- return "", 1
- }
-
- var lines []string
- nbLine := 0
-
- if len(wrapOpts.indent) >= lineWidth {
- // fallback rendering
- lines = append(lines, strings.Repeat("⭬", lineWidth))
- nbLine++
- wrapOpts.indent = wrapOpts.pad
- }
- if len(wrapOpts.pad) >= lineWidth {
- // fallback rendering
- line := strings.Repeat("⭬", lineWidth)
- return strings.Repeat(line+"\n", 5), 5
- }
-
- // Start with the indent
- padStr := wrapOpts.indent
- padLen := Len(wrapOpts.indent)
-
- // tabs are formatted as 4 spaces
- text = strings.Replace(text, "\t", " ", -1)
-
- // NOTE: text is first segmented into lines so that softwrapLine can handle.
- for i, line := range strings.Split(text, "\n") {
- // on the second line, use the padding instead
- if i == 1 {
- padStr = wrapOpts.pad
- padLen = Len(wrapOpts.pad)
- }
-
- if line == "" || strings.TrimSpace(line) == "" {
- // nothing in the line, we just add the non-empty part of the padding
- lines = append(lines, strings.TrimRight(padStr, " "))
- nbLine++
- continue
- }
-
- wrapped := softwrapLine(line, lineWidth-padLen)
- split := strings.Split(wrapped, "\n")
-
- if i == 0 && len(split) > 1 {
- // the very first line got wrapped
- // that means we need to switch to the normal padding
- // use the first wrapped line, ignore everything else and
- // wrap the remaining of the line with the normal padding.
-
- content := LineAlign(strings.TrimRight(split[0], " "), lineWidth-padLen, wrapOpts.align)
- lines = append(lines, padStr+content)
- nbLine++
- line = strings.TrimPrefix(line, split[0])
- line = strings.TrimLeft(line, " ")
-
- padStr = wrapOpts.pad
- padLen = Len(wrapOpts.pad)
- wrapped = softwrapLine(line, lineWidth-padLen)
- split = strings.Split(wrapped, "\n")
- }
-
- for j, seg := range split {
- if j == 0 {
- // keep the left padding of the wrapped line
- content := LineAlign(strings.TrimRight(seg, " "), lineWidth-padLen, wrapOpts.align)
- lines = append(lines, padStr+content)
- } else {
- content := LineAlign(strings.TrimSpace(seg), lineWidth-padLen, wrapOpts.align)
- lines = append(lines, padStr+content)
- }
- nbLine++
- }
- }
-
- return strings.Join(lines, "\n"), nbLine
-}
-
-// WrapLeftPadded wrap a text for a given line size with a left padding.
-// Handle properly terminal color escape code
-func WrapLeftPadded(text string, lineWidth int, leftPad int) (string, int) {
- return Wrap(text, lineWidth, WrapPadded(leftPad))
-}
-
-// WrapWithPad wrap a text for a given line size with a custom left padding
-// Handle properly terminal color escape code
-func WrapWithPad(text string, lineWidth int, pad string) (string, int) {
- return Wrap(text, lineWidth, WrapPad(pad))
-}
-
-// WrapWithPad wrap a text for a given line size with a custom left padding
-// This function also align the result depending on the requested alignment.
-// Handle properly terminal color escape code
-func WrapWithPadAlign(text string, lineWidth int, pad string, align Alignment) (string, int) {
- return Wrap(text, lineWidth, WrapPad(pad), WrapAlign(align))
-}
-
-// WrapWithPadIndent wrap a text for a given line size with a custom left padding
-// and a first line indent. The padding is not effective on the first line, indent
-// is used instead, which allow to implement indents and outdents.
-// Handle properly terminal color escape code
-func WrapWithPadIndent(text string, lineWidth int, indent string, pad string) (string, int) {
- return Wrap(text, lineWidth, WrapIndent(indent), WrapPad(pad))
-}
-
-// WrapWithPadIndentAlign wrap a text for a given line size with a custom left padding
-// and a first line indent. The padding is not effective on the first line, indent
-// is used instead, which allow to implement indents and outdents.
-// This function also align the result depending on the requested alignment.
-// Handle properly terminal color escape code
-func WrapWithPadIndentAlign(text string, lineWidth int, indent string, pad string, align Alignment) (string, int) {
- return Wrap(text, lineWidth, WrapIndent(indent), WrapPad(pad), WrapAlign(align))
-}
-
-// Break a line into several lines so that each line consumes at most
-// 'textWidth' cells. Lines break at groups of white spaces and multibyte
-// chars. Nothing is removed from the original text so that it behaves like a
-// softwrap.
-//
-// Required: The line shall not contain '\n'
-//
-// WRAPPING ALGORITHM: The line is broken into non-breakable chunks, then line
-// breaks ("\n") are inserted between these groups so that the total length
-// between breaks does not exceed the required width. Words that are longer than
-// the textWidth are broken into pieces no longer than textWidth.
-func softwrapLine(line string, textWidth int) string {
- escaped, escapes := ExtractTermEscapes(line)
-
- chunks := segmentLine(escaped)
- // Reverse the chunk array so we can use it as a stack.
- for i, j := 0, len(chunks)-1; i < j; i, j = i+1, j-1 {
- chunks[i], chunks[j] = chunks[j], chunks[i]
- }
-
- // for readability, minimal implementation of a stack:
-
- pop := func() string {
- result := chunks[len(chunks)-1]
- chunks = chunks[:len(chunks)-1]
- return result
- }
-
- push := func(chunk string) {
- chunks = append(chunks, chunk)
- }
-
- peek := func() string {
- return chunks[len(chunks)-1]
- }
-
- empty := func() bool {
- return len(chunks) == 0
- }
-
- var out strings.Builder
-
- // helper to write in the output while interleaving the escape
- // sequence at the correct places.
- // note: the final algorithm will add additional line break in the original
- // text. Those line break are *not* fed to this helper so the positions don't
- // need to be offset, which make the whole thing much easier.
- currPos := 0
- currItem := 0
- outputString := func(s string) {
- for _, r := range s {
- for currItem < len(escapes) && currPos == escapes[currItem].Pos {
- out.WriteString(escapes[currItem].Item)
- currItem++
- }
- out.WriteRune(r)
- currPos++
- }
- }
-
- width := 0
-
- for !empty() {
- wl := Len(peek())
-
- if width+wl <= textWidth {
- // the chunk fit in the available space
- outputString(pop())
- width += wl
- if width == textWidth && !empty() {
- // only add line break when there is more chunk to come
- out.WriteRune('\n')
- width = 0
- }
- } else if wl > textWidth {
- // words too long for a full line are split to fill the remaining space.
- // But if the long words is the first non-space word in the middle of the
- // line, preceding spaces shall not be counted in word splitting.
- splitWidth := textWidth - width
- if strings.HasSuffix(out.String(), "\n"+strings.Repeat(" ", width)) {
- splitWidth += width
- }
- left, right := splitWord(pop(), splitWidth)
- // remainder is pushed back to the stack for next round
- push(right)
- outputString(left)
- out.WriteRune('\n')
- width = 0
- } else {
- // normal line overflow, we add a line break and try again
- out.WriteRune('\n')
- width = 0
- }
- }
-
- // Don't forget the trailing escapes, if any.
- for currItem < len(escapes) && currPos >= escapes[currItem].Pos {
- out.WriteString(escapes[currItem].Item)
- currItem++
- }
-
- return out.String()
-}
-
-// Segment a line into chunks, where each chunk consists of chars with the same
-// type and is not breakable.
-func segmentLine(s string) []string {
- var chunks []string
-
- var word string
- wordType := none
- flushWord := func() {
- chunks = append(chunks, word)
- word = ""
- wordType = none
- }
-
- for _, r := range s {
- // A WIDE_CHAR itself constitutes a chunk.
- thisType := runeType(r)
- if thisType == wideChar {
- if wordType != none {
- flushWord()
- }
- chunks = append(chunks, string(r))
- continue
- }
- // Other type of chunks starts with a char of that type, and ends with a
- // char with different type or end of string.
- if thisType != wordType {
- if wordType != none {
- flushWord()
- }
- word = string(r)
- wordType = thisType
- } else {
- word += string(r)
- }
- }
- if word != "" {
- flushWord()
- }
-
- return chunks
-}
-
-type RuneType int
-
-// Rune categories
-//
-// These categories are so defined that each category forms a non-breakable
-// chunk. It IS NOT the same as unicode code point categories.
-const (
- none RuneType = iota
- wideChar
- invisible
- shortUnicode
- space
- visibleAscii
-)
-
-// Determine the category of a rune.
-func runeType(r rune) RuneType {
- rw := runewidth.RuneWidth(r)
- if rw > 1 {
- return wideChar
- } else if rw == 0 {
- return invisible
- } else if r > 127 {
- return shortUnicode
- } else if r == ' ' {
- return space
- } else {
- return visibleAscii
- }
-}
-
-// splitWord split a word at the given length, while ignoring the terminal escape sequences
-func splitWord(word string, length int) (string, string) {
- runes := []rune(word)
- var result []rune
- added := 0
- escape := false
-
- if length == 0 {
- return "", word
- }
-
- for _, r := range runes {
- if r == '\x1b' {
- escape = true
- }
-
- width := runewidth.RuneWidth(r)
- if width+added > length {
- // wide character made the length overflow
- break
- }
-
- result = append(result, r)
-
- if !escape {
- added += width
- if added >= length {
- break
- }
- }
-
- if r == 'm' {
- escape = false
- }
- }
-
- leftover := runes[len(result):]
-
- return string(result), string(leftover)
-}
diff --git a/vendor/github.com/agnivade/levenshtein/.gitignore b/vendor/github.com/agnivade/levenshtein/.gitignore
deleted file mode 100644
index 345780a4444f6fec3c9c7bdbf9e5f900cd50a80a..0000000000000000000000000000000000000000
--- a/vendor/github.com/agnivade/levenshtein/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-coverage.txt
-fuzz/fuzz-fuzz.zip
-fuzz/corpus/corpus/*
-fuzz/corpus/suppressions/*
-fuzz/corpus/crashes/*
diff --git a/vendor/github.com/agnivade/levenshtein/.travis.yml b/vendor/github.com/agnivade/levenshtein/.travis.yml
deleted file mode 100644
index 06b3ba55322867f3051611245a626e19ab302584..0000000000000000000000000000000000000000
--- a/vendor/github.com/agnivade/levenshtein/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: go
-
-go:
-- 1.8.x
-- 1.9.x
-- 1.10.x
-- tip
diff --git a/vendor/github.com/agnivade/levenshtein/License.txt b/vendor/github.com/agnivade/levenshtein/License.txt
deleted file mode 100644
index 54b51f49938d7be4d2ff25283cc4bbcc3ce98fa1..0000000000000000000000000000000000000000
--- a/vendor/github.com/agnivade/levenshtein/License.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015 Agniva De Sarker
-
-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/agnivade/levenshtein/Makefile b/vendor/github.com/agnivade/levenshtein/Makefile
deleted file mode 100644
index 4bef27dd1850854e8108a8a3d0c18534dd832db5..0000000000000000000000000000000000000000
--- a/vendor/github.com/agnivade/levenshtein/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-all: test install
-
-install:
- go install
-
-lint:
- gofmt -l -s -w . && go tool vet -all . && golint
-
-test:
- go test -race -v -coverprofile=coverage.txt -covermode=atomic
-
-bench:
- go test -run=XXX -bench=. -benchmem
diff --git a/vendor/github.com/agnivade/levenshtein/README.md b/vendor/github.com/agnivade/levenshtein/README.md
deleted file mode 100644
index b0fd81df7d9150136fc07aa50ea2f2fa49f80ffc..0000000000000000000000000000000000000000
--- a/vendor/github.com/agnivade/levenshtein/README.md
+++ /dev/null
@@ -1,57 +0,0 @@
-levenshtein [](https://travis-ci.org/agnivade/levenshtein) [](https://goreportcard.com/report/github.com/agnivade/levenshtein) [](https://godoc.org/github.com/agnivade/levenshtein)
-===========
-
-[Go](http://golang.org) package to calculate the [Levenshtein Distance](http://en.wikipedia.org/wiki/Levenshtein_distance)
-
-The library is fully capable of working with non-ascii strings. But the strings are not normalized. That is left as a user-dependant use case. Please normalize the strings before passing it to the library if you have such a requirement.
-- https://blog.golang.org/normalization
-
-Install
--------
-
- go get github.com/agnivade/levenshtein
-
-Example
--------
-
-```go
-package main
-
-import (
- "fmt"
- "github.com/agnivade/levenshtein"
-)
-
-func main() {
- s1 := "kitten"
- s2 := "sitting"
- distance := levenshtein.ComputeDistance(s1, s2)
- fmt.Printf("The distance between %s and %s is %d.\n", s1, s2, distance)
- // Output:
- // The distance between kitten and sitting is 3.
-}
-
-```
-
-Benchmarks
-----------
-
-```
-name time/op
-Simple/ASCII-4 537ns ± 2%
-Simple/French-4 956ns ± 0%
-Simple/Nordic-4 1.95µs ± 1%
-Simple/Tibetan-4 1.53µs ± 2%
-
-name alloc/op
-Simple/ASCII-4 96.0B ± 0%
-Simple/French-4 128B ± 0%
-Simple/Nordic-4 192B ± 0%
-Simple/Tibetan-4 144B ± 0%
-
-name allocs/op
-Simple/ASCII-4 1.00 ± 0%
-Simple/French-4 1.00 ± 0%
-Simple/Nordic-4 1.00 ± 0%
-Simple/Tibetan-4 1.00 ± 0%
-```
diff --git a/vendor/github.com/agnivade/levenshtein/go.mod b/vendor/github.com/agnivade/levenshtein/go.mod
deleted file mode 100644
index b2921fb35ec7386458b08d1ece3d8f030bc85724..0000000000000000000000000000000000000000
--- a/vendor/github.com/agnivade/levenshtein/go.mod
+++ /dev/null
@@ -1 +0,0 @@
-module github.com/agnivade/levenshtein
diff --git a/vendor/github.com/agnivade/levenshtein/levenshtein.go b/vendor/github.com/agnivade/levenshtein/levenshtein.go
deleted file mode 100644
index e215813fc2f47e10747f351fdee2e85a53b3c8f1..0000000000000000000000000000000000000000
--- a/vendor/github.com/agnivade/levenshtein/levenshtein.go
+++ /dev/null
@@ -1,71 +0,0 @@
-// Package levenshtein is a Go implementation to calculate Levenshtein Distance.
-//
-// Implementation taken from
-// https://gist.github.com/andrei-m/982927#gistcomment-1931258
-package levenshtein
-
-// ComputeDistance computes the levenshtein distance between the two
-// strings passed as an argument. The return value is the levenshtein distance
-//
-// Works on runes (Unicode code points) but does not normalize
-// the input strings. See https://blog.golang.org/normalization
-// and the golang.org/x/text/unicode/norm pacage.
-func ComputeDistance(a, b string) int {
- if a == b {
- return 0
- }
-
- // We need to convert to []rune if the strings are non-ascii.
- // This could be avoided by using utf8.RuneCountInString
- // and then doing some juggling with rune indices.
- // The primary challenge is keeping track of the previous rune.
- // With a range loop, its not that easy. And with a for-loop
- // we need to keep track of the inter-rune width using utf8.DecodeRuneInString
- s1 := []rune(a)
- s2 := []rune(b)
-
- // swap to save some memory O(min(a,b)) instead of O(a)
- if len(s1) > len(s2) {
- s1, s2 = s2, s1
- }
- lenS1 := len(s1)
- lenS2 := len(s2)
-
- // init the row
- x := make([]int, lenS1+1)
- for i := 0; i <= lenS1; i++ {
- x[i] = i
- }
-
- // fill in the rest
- for i := 1; i <= lenS2; i++ {
- prev := i
- var current int
-
- for j := 1; j <= lenS1; j++ {
-
- if s2[i-1] == s1[j-1] {
- current = x[j-1] // match
- } else {
- current = min(x[j-1]+1, prev+1, x[j]+1)
- }
- x[j-1] = prev
- prev = current
- }
- x[lenS1] = prev
- }
- return x[lenS1]
-}
-
-func min(a, b, c int) int {
- if a < b {
- if a < c {
- return a
- }
- } else {
- if b < c {
- return b
- }
- }
- return c
-}
diff --git a/vendor/github.com/araddon/dateparse/.travis.yml b/vendor/github.com/araddon/dateparse/.travis.yml
deleted file mode 100644
index f071cf95a1fc37bc1d43496991ff4251a7d075c8..0000000000000000000000000000000000000000
--- a/vendor/github.com/araddon/dateparse/.travis.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-language: go
-
-go:
- - 1.10.x
- - 1.11.x
-
-before_install:
- - go get -t -v ./...
-
-script:
- - go test -race -coverprofile=coverage.txt -covermode=atomic
-
-after_success:
- - bash <(curl -s https://codecov.io/bash)
diff --git a/vendor/github.com/araddon/dateparse/LICENSE b/vendor/github.com/araddon/dateparse/LICENSE
deleted file mode 100644
index f675ed313ac0138c33d41e3abd5620e87001db2f..0000000000000000000000000000000000000000
--- a/vendor/github.com/araddon/dateparse/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015-2017 Aaron Raddon
-
-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/araddon/dateparse/README.md b/vendor/github.com/araddon/dateparse/README.md
deleted file mode 100644
index 005e456fc0daf3a169d42f48073ccc3b96ce96c0..0000000000000000000000000000000000000000
--- a/vendor/github.com/araddon/dateparse/README.md
+++ /dev/null
@@ -1,282 +0,0 @@
-Go Date Parser
----------------------------
-
-Parse many date strings without knowing format in advance. Uses a scanner to read bytes and use a state machine to find format. Much faster than shotgun based parse methods. See [bench_test.go](https://github.com/araddon/dateparse/blob/master/bench_test.go) for performance comparison.
-
-
-[](https://codecov.io/gh/araddon/dateparse)
-[](http://godoc.org/github.com/araddon/dateparse)
-[](https://travis-ci.org/araddon/dateparse)
-[](https://goreportcard.com/report/araddon/dateparse)
-
-**MM/DD/YYYY VS DD/MM/YYYY** Right now this uses mm/dd/yyyy WHEN ambiguous if this is not desired behavior, use `ParseStrict` which will fail on ambiguous date strings.
-
-**Timezones** The location your server is configured affects the results! See example or https://play.golang.org/p/IDHRalIyXh and last paragraph here https://golang.org/pkg/time/#Parse.
-
-
-```go
-
-// Normal parse. Equivalent Timezone rules as time.Parse()
-t, err := dateparse.ParseAny("3/1/2014")
-
-// Parse Strict, error on ambigous mm/dd vs dd/mm dates
-t, err := dateparse.ParseStrict("3/1/2014")
-> returns error
-
-// Return a string that represents the layout to parse the given date-time.
-layout, err := dateparse.ParseFormat("May 8, 2009 5:57:51 PM")
-> "Jan 2, 2006 3:04:05 PM"
-
-```
-
-cli tool for testing dateformats
-----------------------------------
-
-[Date Parse CLI](https://github.com/araddon/dateparse/blob/master/dateparse)
-
-
-Extended example
--------------------
-
-https://github.com/araddon/dateparse/blob/master/example/main.go
-
-```go
-package main
-
-import (
- "flag"
- "fmt"
- "time"
-
- "github.com/apcera/termtables"
- "github.com/araddon/dateparse"
-)
-
-var examples = []string{
- "May 8, 2009 5:57:51 PM",
- "oct 7, 1970",
- "oct 7, '70",
- "oct. 7, 1970",
- "oct. 7, 70",
- "Mon Jan 2 15:04:05 2006",
- "Mon Jan 2 15:04:05 MST 2006",
- "Mon Jan 02 15:04:05 -0700 2006",
- "Monday, 02-Jan-06 15:04:05 MST",
- "Mon, 02 Jan 2006 15:04:05 MST",
- "Tue, 11 Jul 2017 16:28:13 +0200 (CEST)",
- "Mon, 02 Jan 2006 15:04:05 -0700",
- "Thu, 4 Jan 2018 17:53:36 +0000",
- "Mon Aug 10 15:44:11 UTC+0100 2015",
- "Fri Jul 03 2015 18:04:07 GMT+0100 (GMT Daylight Time)",
- "September 17, 2012 10:09am",
- "September 17, 2012 at 10:09am PST-08",
- "September 17, 2012, 10:10:09",
- "October 7, 1970",
- "October 7th, 1970",
- "12 Feb 2006, 19:17",
- "12 Feb 2006 19:17",
- "7 oct 70",
- "7 oct 1970",
- "03 February 2013",
- "1 July 2013",
- "2013-Feb-03",
- // mm/dd/yy
- "3/31/2014",
- "03/31/2014",
- "08/21/71",
- "8/1/71",
- "4/8/2014 22:05",
- "04/08/2014 22:05",
- "4/8/14 22:05",
- "04/2/2014 03:00:51",
- "8/8/1965 12:00:00 AM",
- "8/8/1965 01:00:01 PM",
- "8/8/1965 01:00 PM",
- "8/8/1965 1:00 PM",
- "8/8/1965 12:00 AM",
- "4/02/2014 03:00:51",
- "03/19/2012 10:11:59",
- "03/19/2012 10:11:59.3186369",
- // yyyy/mm/dd
- "2014/3/31",
- "2014/03/31",
- "2014/4/8 22:05",
- "2014/04/08 22:05",
- "2014/04/2 03:00:51",
- "2014/4/02 03:00:51",
- "2012/03/19 10:11:59",
- "2012/03/19 10:11:59.3186369",
- // Chinese
- "2014年04月08日",
- // yyyy-mm-ddThh
- "2006-01-02T15:04:05+0000",
- "2009-08-12T22:15:09-07:00",
- "2009-08-12T22:15:09",
- "2009-08-12T22:15:09Z",
- // yyyy-mm-dd hh:mm:ss
- "2014-04-26 17:24:37.3186369",
- "2012-08-03 18:31:59.257000000",
- "2014-04-26 17:24:37.123",
- "2013-04-01 22:43",
- "2013-04-01 22:43:22",
- "2014-12-16 06:20:00 UTC",
- "2014-12-16 06:20:00 GMT",
- "2014-04-26 05:24:37 PM",
- "2014-04-26 13:13:43 +0800",
- "2014-04-26 13:13:43 +0800 +08",
- "2014-04-26 13:13:44 +09:00",
- "2012-08-03 18:31:59.257000000 +0000 UTC",
- "2015-09-30 18:48:56.35272715 +0000 UTC",
- "2015-02-18 00:12:00 +0000 GMT",
- "2015-02-18 00:12:00 +0000 UTC",
- "2015-02-08 03:02:00 +0300 MSK m=+0.000000001",
- "2015-02-08 03:02:00.001 +0300 MSK m=+0.000000001",
- "2017-07-19 03:21:51+00:00",
- "2014-04-26",
- "2014-04",
- "2014",
- "2014-05-11 08:20:13,787",
- // mm.dd.yy
- "3.31.2014",
- "03.31.2014",
- "08.21.71",
- "2014.03",
- "2014.03.30",
- // yyyymmdd and similar
- "20140601",
- "20140722105203",
- // unix seconds, ms, micro, nano
- "1332151919",
- "1384216367189",
- "1384216367111222",
- "1384216367111222333",
-}
-
-var (
- timezone = ""
-)
-
-func main() {
- flag.StringVar(&timezone, "timezone", "UTC", "Timezone aka `America/Los_Angeles` formatted time-zone")
- flag.Parse()
-
- if timezone != "" {
- // NOTE: This is very, very important to understand
- // time-parsing in go
- loc, err := time.LoadLocation(timezone)
- if err != nil {
- panic(err.Error())
- }
- time.Local = loc
- }
-
- table := termtables.CreateTable()
-
- table.AddHeaders("Input", "Parsed, and Output as %v")
- for _, dateExample := range examples {
- t, err := dateparse.ParseLocal(dateExample)
- if err != nil {
- panic(err.Error())
- }
- table.AddRow(dateExample, fmt.Sprintf("%v", t))
- }
- fmt.Println(table.Render())
-}
-
-/*
-+-------------------------------------------------------+-----------------------------------------+
-| Input | Parsed, and Output as %v |
-+-------------------------------------------------------+-----------------------------------------+
-| May 8, 2009 5:57:51 PM | 2009-05-08 17:57:51 +0000 UTC |
-| oct 7, 1970 | 1970-10-07 00:00:00 +0000 UTC |
-| oct 7, '70 | 1970-10-07 00:00:00 +0000 UTC |
-| oct. 7, 1970 | 1970-10-07 00:00:00 +0000 UTC |
-| oct. 7, 70 | 1970-10-07 00:00:00 +0000 UTC |
-| Mon Jan 2 15:04:05 2006 | 2006-01-02 15:04:05 +0000 UTC |
-| Mon Jan 2 15:04:05 MST 2006 | 2006-01-02 15:04:05 +0000 MST |
-| Mon Jan 02 15:04:05 -0700 2006 | 2006-01-02 15:04:05 -0700 -0700 |
-| Monday, 02-Jan-06 15:04:05 MST | 2006-01-02 15:04:05 +0000 MST |
-| Mon, 02 Jan 2006 15:04:05 MST | 2006-01-02 15:04:05 +0000 MST |
-| Tue, 11 Jul 2017 16:28:13 +0200 (CEST) | 2017-07-11 16:28:13 +0200 +0200 |
-| Mon, 02 Jan 2006 15:04:05 -0700 | 2006-01-02 15:04:05 -0700 -0700 |
-| Thu, 4 Jan 2018 17:53:36 +0000 | 2018-01-04 17:53:36 +0000 UTC |
-| Mon Aug 10 15:44:11 UTC+0100 2015 | 2015-08-10 15:44:11 +0000 UTC |
-| Fri Jul 03 2015 18:04:07 GMT+0100 (GMT Daylight Time) | 2015-07-03 18:04:07 +0100 GMT |
-| September 17, 2012 10:09am | 2012-09-17 10:09:00 +0000 UTC |
-| September 17, 2012 at 10:09am PST-08 | 2012-09-17 10:09:00 -0800 PST |
-| September 17, 2012, 10:10:09 | 2012-09-17 10:10:09 +0000 UTC |
-| October 7, 1970 | 1970-10-07 00:00:00 +0000 UTC |
-| October 7th, 1970 | 1970-10-07 00:00:00 +0000 UTC |
-| 12 Feb 2006, 19:17 | 2006-02-12 19:17:00 +0000 UTC |
-| 12 Feb 2006 19:17 | 2006-02-12 19:17:00 +0000 UTC |
-| 7 oct 70 | 1970-10-07 00:00:00 +0000 UTC |
-| 7 oct 1970 | 1970-10-07 00:00:00 +0000 UTC |
-| 03 February 2013 | 2013-02-03 00:00:00 +0000 UTC |
-| 1 July 2013 | 2013-07-01 00:00:00 +0000 UTC |
-| 2013-Feb-03 | 2013-02-03 00:00:00 +0000 UTC |
-| 3/31/2014 | 2014-03-31 00:00:00 +0000 UTC |
-| 03/31/2014 | 2014-03-31 00:00:00 +0000 UTC |
-| 08/21/71 | 1971-08-21 00:00:00 +0000 UTC |
-| 8/1/71 | 1971-08-01 00:00:00 +0000 UTC |
-| 4/8/2014 22:05 | 2014-04-08 22:05:00 +0000 UTC |
-| 04/08/2014 22:05 | 2014-04-08 22:05:00 +0000 UTC |
-| 4/8/14 22:05 | 2014-04-08 22:05:00 +0000 UTC |
-| 04/2/2014 03:00:51 | 2014-04-02 03:00:51 +0000 UTC |
-| 8/8/1965 12:00:00 AM | 1965-08-08 00:00:00 +0000 UTC |
-| 8/8/1965 01:00:01 PM | 1965-08-08 13:00:01 +0000 UTC |
-| 8/8/1965 01:00 PM | 1965-08-08 13:00:00 +0000 UTC |
-| 8/8/1965 1:00 PM | 1965-08-08 13:00:00 +0000 UTC |
-| 8/8/1965 12:00 AM | 1965-08-08 00:00:00 +0000 UTC |
-| 4/02/2014 03:00:51 | 2014-04-02 03:00:51 +0000 UTC |
-| 03/19/2012 10:11:59 | 2012-03-19 10:11:59 +0000 UTC |
-| 03/19/2012 10:11:59.3186369 | 2012-03-19 10:11:59.3186369 +0000 UTC |
-| 2014/3/31 | 2014-03-31 00:00:00 +0000 UTC |
-| 2014/03/31 | 2014-03-31 00:00:00 +0000 UTC |
-| 2014/4/8 22:05 | 2014-04-08 22:05:00 +0000 UTC |
-| 2014/04/08 22:05 | 2014-04-08 22:05:00 +0000 UTC |
-| 2014/04/2 03:00:51 | 2014-04-02 03:00:51 +0000 UTC |
-| 2014/4/02 03:00:51 | 2014-04-02 03:00:51 +0000 UTC |
-| 2012/03/19 10:11:59 | 2012-03-19 10:11:59 +0000 UTC |
-| 2012/03/19 10:11:59.3186369 | 2012-03-19 10:11:59.3186369 +0000 UTC |
-| 2014年04月08日 | 2014-04-08 00:00:00 +0000 UTC |
-| 2006-01-02T15:04:05+0000 | 2006-01-02 15:04:05 +0000 UTC |
-| 2009-08-12T22:15:09-07:00 | 2009-08-12 22:15:09 -0700 -0700 |
-| 2009-08-12T22:15:09 | 2009-08-12 22:15:09 +0000 UTC |
-| 2009-08-12T22:15:09Z | 2009-08-12 22:15:09 +0000 UTC |
-| 2014-04-26 17:24:37.3186369 | 2014-04-26 17:24:37.3186369 +0000 UTC |
-| 2012-08-03 18:31:59.257000000 | 2012-08-03 18:31:59.257 +0000 UTC |
-| 2014-04-26 17:24:37.123 | 2014-04-26 17:24:37.123 +0000 UTC |
-| 2013-04-01 22:43 | 2013-04-01 22:43:00 +0000 UTC |
-| 2013-04-01 22:43:22 | 2013-04-01 22:43:22 +0000 UTC |
-| 2014-12-16 06:20:00 UTC | 2014-12-16 06:20:00 +0000 UTC |
-| 2014-12-16 06:20:00 GMT | 2014-12-16 06:20:00 +0000 UTC |
-| 2014-04-26 05:24:37 PM | 2014-04-26 17:24:37 +0000 UTC |
-| 2014-04-26 13:13:43 +0800 | 2014-04-26 13:13:43 +0800 +0800 |
-| 2014-04-26 13:13:43 +0800 +08 | 2014-04-26 13:13:43 +0800 +0800 |
-| 2014-04-26 13:13:44 +09:00 | 2014-04-26 13:13:44 +0900 +0900 |
-| 2012-08-03 18:31:59.257000000 +0000 UTC | 2012-08-03 18:31:59.257 +0000 UTC |
-| 2015-09-30 18:48:56.35272715 +0000 UTC | 2015-09-30 18:48:56.35272715 +0000 UTC |
-| 2015-02-18 00:12:00 +0000 GMT | 2015-02-18 00:12:00 +0000 UTC |
-| 2015-02-18 00:12:00 +0000 UTC | 2015-02-18 00:12:00 +0000 UTC |
-| 2015-02-08 03:02:00 +0300 MSK m=+0.000000001 | 2015-02-08 03:02:00 +0300 +0300 |
-| 2015-02-08 03:02:00.001 +0300 MSK m=+0.000000001 | 2015-02-08 03:02:00.001 +0300 +0300 |
-| 2017-07-19 03:21:51+00:00 | 2017-07-19 03:21:51 +0000 UTC |
-| 2014-04-26 | 2014-04-26 00:00:00 +0000 UTC |
-| 2014-04 | 2014-04-01 00:00:00 +0000 UTC |
-| 2014 | 2014-01-01 00:00:00 +0000 UTC |
-| 2014-05-11 08:20:13,787 | 2014-05-11 08:20:13.787 +0000 UTC |
-| 3.31.2014 | 2014-03-31 00:00:00 +0000 UTC |
-| 03.31.2014 | 2014-03-31 00:00:00 +0000 UTC |
-| 08.21.71 | 1971-08-21 00:00:00 +0000 UTC |
-| 2014.03 | 2014-03-01 00:00:00 +0000 UTC |
-| 2014.03.30 | 2014-03-30 00:00:00 +0000 UTC |
-| 20140601 | 2014-06-01 00:00:00 +0000 UTC |
-| 20140722105203 | 2014-07-22 10:52:03 +0000 UTC |
-| 1332151919 | 2012-03-19 10:11:59 +0000 UTC |
-| 1384216367189 | 2013-11-12 00:32:47.189 +0000 UTC |
-| 1384216367111222 | 2013-11-12 00:32:47.111222 +0000 UTC |
-| 1384216367111222333 | 2013-11-12 00:32:47.111222333 +0000 UTC |
-+-------------------------------------------------------+-----------------------------------------+
-*/
-
-```
diff --git a/vendor/github.com/araddon/dateparse/parseany.go b/vendor/github.com/araddon/dateparse/parseany.go
deleted file mode 100644
index 5e66aa6d6a1f68ba38934d730c2ef5960ddb2169..0000000000000000000000000000000000000000
--- a/vendor/github.com/araddon/dateparse/parseany.go
+++ /dev/null
@@ -1,1864 +0,0 @@
-// Package dateparse parses date-strings without knowing the format
-// in advance, using a fast lex based approach to eliminate shotgun
-// attempts. It leans towards US style dates when there is a conflict.
-package dateparse
-
-import (
- "fmt"
- "strconv"
- "strings"
- "time"
- "unicode"
- "unicode/utf8"
-)
-
-// func init() {
-// gou.SetupLogging("debug")
-// gou.SetColorOutput()
-// }
-
-var months = []string{
- "january",
- "february",
- "march",
- "april",
- "may",
- "june",
- "july",
- "august",
- "september",
- "october",
- "november",
- "december",
-}
-
-type dateState uint8
-type timeState uint8
-
-const (
- dateStart dateState = iota // 0
- dateDigit
- dateYearDash
- dateYearDashAlphaDash
- dateYearDashDash
- dateYearDashDashWs // 5
- dateYearDashDashT
- dateDigitDash
- dateDigitDashAlpha
- dateDigitDashAlphaDash
- dateDigitDot // 10
- dateDigitDotDot
- dateDigitSlash
- dateDigitChineseYear
- dateDigitChineseYearWs
- dateDigitWs // 15
- dateDigitWsMoYear
- dateDigitWsMolong
- dateAlpha
- dateAlphaWs
- dateAlphaWsDigit // 20
- dateAlphaWsDigitMore
- dateAlphaWsDigitMoreWs
- dateAlphaWsDigitMoreWsYear
- dateAlphaWsMonth
- dateAlphaWsMonthMore
- dateAlphaWsMonthSuffix
- dateAlphaWsMore
- dateAlphaWsAtTime
- dateAlphaWsAlpha
- dateAlphaWsAlphaYearmaybe
- dateAlphaPeriodWsDigit
- dateWeekdayComma
- dateWeekdayAbbrevComma
-)
-const (
- // Time state
- timeIgnore timeState = iota // 0
- timeStart
- timeWs
- timeWsAlpha
- timeWsAlphaWs
- timeWsAlphaZoneOffset // 5
- timeWsAlphaZoneOffsetWs
- timeWsAlphaZoneOffsetWsYear
- timeWsAlphaZoneOffsetWsExtra
- timeWsAMPMMaybe
- timeWsAMPM // 10
- timeWsOffset
- timeWsOffsetWs // 12
- timeWsOffsetColonAlpha
- timeWsOffsetColon
- timeWsYear // 15
- timeOffset
- timeOffsetColon
- timeAlpha
- timePeriod
- timePeriodOffset // 20
- timePeriodOffsetColon
- timePeriodOffsetColonWs
- timePeriodWs
- timePeriodWsAlpha
- timePeriodWsOffset // 25
- timePeriodWsOffsetWs
- timePeriodWsOffsetWsAlpha
- timePeriodWsOffsetColon
- timePeriodWsOffsetColonAlpha
- timeZ
- timeZDigit
-)
-
-var (
- // ErrAmbiguousMMDD for date formats such as 04/02/2014 the mm/dd vs dd/mm are
- // ambiguous, so it is an error for strict parse rules.
- ErrAmbiguousMMDD = fmt.Errorf("This date has ambiguous mm/dd vs dd/mm type format")
-)
-
-func unknownErr(datestr string) error {
- return fmt.Errorf("Could not find format for %q", datestr)
-}
-
-// ParseAny parse an unknown date format, detect the layout.
-// Normal parse. Equivalent Timezone rules as time.Parse().
-// NOTE: please see readme on mmdd vs ddmm ambiguous dates.
-func ParseAny(datestr string) (time.Time, error) {
- p, err := parseTime(datestr, nil)
- if err != nil {
- return time.Time{}, err
- }
- return p.parse()
-}
-
-// ParseIn with Location, equivalent to time.ParseInLocation() timezone/offset
-// rules. Using location arg, if timezone/offset info exists in the
-// datestring, it uses the given location rules for any zone interpretation.
-// That is, MST means one thing when using America/Denver and something else
-// in other locations.
-func ParseIn(datestr string, loc *time.Location) (time.Time, error) {
- p, err := parseTime(datestr, loc)
- if err != nil {
- return time.Time{}, err
- }
- return p.parse()
-}
-
-// ParseLocal Given an unknown date format, detect the layout,
-// using time.Local, parse.
-//
-// Set Location to time.Local. Same as ParseIn Location but lazily uses
-// the global time.Local variable for Location argument.
-//
-// denverLoc, _ := time.LoadLocation("America/Denver")
-// time.Local = denverLoc
-//
-// t, err := dateparse.ParseLocal("3/1/2014")
-//
-// Equivalent to:
-//
-// t, err := dateparse.ParseIn("3/1/2014", denverLoc)
-//
-func ParseLocal(datestr string) (time.Time, error) {
- p, err := parseTime(datestr, time.Local)
- if err != nil {
- return time.Time{}, err
- }
- return p.parse()
-}
-
-// MustParse parse a date, and panic if it can't be parsed. Used for testing.
-// Not recommended for most use-cases.
-func MustParse(datestr string) time.Time {
- p, err := parseTime(datestr, nil)
- if err != nil {
- panic(err.Error())
- }
- t, err := p.parse()
- if err != nil {
- panic(err.Error())
- }
- return t
-}
-
-// ParseFormat parse's an unknown date-time string and returns a layout
-// string that can parse this (and exact same format) other date-time strings.
-//
-// layout, err := dateparse.ParseFormat("2013-02-01 00:00:00")
-// // layout = "2006-01-02 15:04:05"
-//
-func ParseFormat(datestr string) (string, error) {
- p, err := parseTime(datestr, nil)
- if err != nil {
- return "", err
- }
- _, err = p.parse()
- if err != nil {
- return "", err
- }
- return string(p.format), nil
-}
-
-// ParseStrict parse an unknown date format. IF the date is ambigous
-// mm/dd vs dd/mm then return an error. These return errors: 3.3.2014 , 8/8/71 etc
-func ParseStrict(datestr string) (time.Time, error) {
- p, err := parseTime(datestr, nil)
- if err != nil {
- return time.Time{}, err
- }
- if p.ambiguousMD {
- return time.Time{}, ErrAmbiguousMMDD
- }
- return p.parse()
-}
-
-func parseTime(datestr string, loc *time.Location) (*parser, error) {
-
- p := newParser(datestr, loc)
- i := 0
-
- // General strategy is to read rune by rune through the date looking for
- // certain hints of what type of date we are dealing with.
- // Hopefully we only need to read about 5 or 6 bytes before
- // we figure it out and then attempt a parse
-iterRunes:
- for ; i < len(datestr); i++ {
- //r := rune(datestr[i])
- r, bytesConsumed := utf8.DecodeRuneInString(datestr[i:])
- if bytesConsumed > 1 {
- i += (bytesConsumed - 1)
- }
-
- //gou.Debugf("i=%d r=%s state=%d %s", i, string(r), p.stateDate, datestr)
- switch p.stateDate {
- case dateStart:
- if unicode.IsDigit(r) {
- p.stateDate = dateDigit
- } else if unicode.IsLetter(r) {
- p.stateDate = dateAlpha
- } else {
- return nil, unknownErr(datestr)
- }
- case dateDigit:
-
- switch r {
- case '-', '\u2212':
- // 2006-01-02
- // 2013-Feb-03
- // 13-Feb-03
- // 29-Jun-2016
- if i == 4 {
- p.stateDate = dateYearDash
- p.yeari = 0
- p.yearlen = i
- p.moi = i + 1
- p.set(0, "2006")
- } else {
- p.stateDate = dateDigitDash
- }
- case '/':
- // 03/31/2005
- // 2014/02/24
- p.stateDate = dateDigitSlash
- if i == 4 {
- p.yearlen = i
- p.moi = i + 1
- p.setYear()
- } else {
- p.ambiguousMD = true
- if p.preferMonthFirst {
- if p.molen == 0 {
- p.molen = i
- p.setMonth()
- p.dayi = i + 1
- }
- }
- }
-
- case '.':
- // 3.31.2014
- // 08.21.71
- // 2014.05
- p.stateDate = dateDigitDot
- if i == 4 {
- p.yearlen = i
- p.moi = i + 1
- p.setYear()
- } else {
- p.ambiguousMD = true
- p.moi = 0
- p.molen = i
- p.setMonth()
- p.dayi = i + 1
- }
-
- case ' ':
- // 18 January 2018
- // 8 January 2018
- // 8 jan 2018
- // 02 Jan 2018 23:59
- // 02 Jan 2018 23:59:34
- // 12 Feb 2006, 19:17
- // 12 Feb 2006, 19:17:22
- p.stateDate = dateDigitWs
- p.dayi = 0
- p.daylen = i
- case '年':
- // Chinese Year
- p.stateDate = dateDigitChineseYear
- case ',':
- return nil, unknownErr(datestr)
- default:
- continue
- }
- p.part1Len = i
-
- case dateYearDash:
- // dateYearDashDashT
- // 2006-01-02T15:04:05Z07:00
- // dateYearDashDashWs
- // 2013-04-01 22:43:22
- // dateYearDashAlphaDash
- // 2013-Feb-03
- switch r {
- case '-':
- p.molen = i - p.moi
- p.dayi = i + 1
- p.stateDate = dateYearDashDash
- p.setMonth()
- default:
- if unicode.IsLetter(r) {
- p.stateDate = dateYearDashAlphaDash
- }
- }
-
- case dateYearDashDash:
- // dateYearDashDashT
- // 2006-01-02T15:04:05Z07:00
- // dateYearDashDashWs
- // 2013-04-01 22:43:22
- switch r {
- case ' ':
- p.daylen = i - p.dayi
- p.stateDate = dateYearDashDashWs
- p.stateTime = timeStart
- p.setDay()
- break iterRunes
- case 'T':
- p.daylen = i - p.dayi
- p.stateDate = dateYearDashDashT
- p.stateTime = timeStart
- p.setDay()
- break iterRunes
- }
- case dateYearDashAlphaDash:
- // 2013-Feb-03
- switch r {
- case '-':
- p.molen = i - p.moi
- p.set(p.moi, "Jan")
- p.dayi = i + 1
- }
- case dateDigitDash:
- // 13-Feb-03
- // 29-Jun-2016
- if unicode.IsLetter(r) {
- p.stateDate = dateDigitDashAlpha
- p.moi = i
- } else {
- return nil, unknownErr(datestr)
- }
- case dateDigitDashAlpha:
- // 13-Feb-03
- // 28-Feb-03
- // 29-Jun-2016
- switch r {
- case '-':
- p.molen = i - p.moi
- p.set(p.moi, "Jan")
- p.yeari = i + 1
- p.stateDate = dateDigitDashAlphaDash
- }
-
- case dateDigitDashAlphaDash:
- // 13-Feb-03 ambiguous
- // 28-Feb-03 ambiguous
- // 29-Jun-2016
- switch r {
- case ' ':
- // we need to find if this was 4 digits, aka year
- // or 2 digits which makes it ambiguous year/day
- length := i - (p.moi + p.molen + 1)
- if length == 4 {
- p.yearlen = 4
- p.set(p.yeari, "2006")
- // We now also know that part1 was the day
- p.dayi = 0
- p.daylen = p.part1Len
- p.setDay()
- } else if length == 2 {
- // We have no idea if this is
- // yy-mon-dd OR dd-mon-yy
- //
- // We are going to ASSUME (bad, bad) that it is dd-mon-yy which is a horible assumption
- p.ambiguousMD = true
- p.yearlen = 2
- p.set(p.yeari, "06")
- // We now also know that part1 was the day
- p.dayi = 0
- p.daylen = p.part1Len
- p.setDay()
- }
- p.stateTime = timeStart
- break iterRunes
- }
-
- case dateDigitSlash:
- // 2014/07/10 06:55:38.156283
- // 03/19/2012 10:11:59
- // 04/2/2014 03:00:37
- // 3/1/2012 10:11:59
- // 4/8/2014 22:05
- // 3/1/2014
- // 10/13/2014
- // 01/02/2006
- // 1/2/06
-
- switch r {
- case ' ':
- p.stateTime = timeStart
- if p.yearlen == 0 {
- p.yearlen = i - p.yeari
- p.setYear()
- } else if p.daylen == 0 {
- p.daylen = i - p.dayi
- p.setDay()
- }
- break iterRunes
- case '/':
- if p.yearlen > 0 {
- // 2014/07/10 06:55:38.156283
- if p.molen == 0 {
- p.molen = i - p.moi
- p.setMonth()
- p.dayi = i + 1
- }
- } else if p.preferMonthFirst {
- if p.daylen == 0 {
- p.daylen = i - p.dayi
- p.setDay()
- p.yeari = i + 1
- }
- }
- }
-
- case dateDigitWs:
- // 18 January 2018
- // 8 January 2018
- // 8 jan 2018
- // 1 jan 18
- // 02 Jan 2018 23:59
- // 02 Jan 2018 23:59:34
- // 12 Feb 2006, 19:17
- // 12 Feb 2006, 19:17:22
- switch r {
- case ' ':
- p.yeari = i + 1
- //p.yearlen = 4
- p.dayi = 0
- p.daylen = p.part1Len
- p.setDay()
- p.stateTime = timeStart
- if i > p.daylen+len(" Sep") { // November etc
- // If len greather than space + 3 it must be full month
- p.stateDate = dateDigitWsMolong
- } else {
- // If len=3, the might be Feb or May? Ie ambigous abbreviated but
- // we can parse may with either. BUT, that means the
- // format may not be correct?
- // mo := strings.ToLower(datestr[p.daylen+1 : i])
- p.moi = p.daylen + 1
- p.molen = i - p.moi
- p.set(p.moi, "Jan")
- p.stateDate = dateDigitWsMoYear
- }
- }
-
- case dateDigitWsMoYear:
- // 8 jan 2018
- // 02 Jan 2018 23:59
- // 02 Jan 2018 23:59:34
- // 12 Feb 2006, 19:17
- // 12 Feb 2006, 19:17:22
- switch r {
- case ',':
- p.yearlen = i - p.yeari
- p.setYear()
- i++
- break iterRunes
- case ' ':
- p.yearlen = i - p.yeari
- p.setYear()
- break iterRunes
- }
- case dateDigitWsMolong:
- // 18 January 2018
- // 8 January 2018
-
- case dateDigitChineseYear:
- // dateDigitChineseYear
- // 2014年04月08日
- // weekday %Y年%m月%e日 %A %I:%M %p
- // 2013年07月18日 星期四 10:27 上午
- if r == ' ' {
- p.stateDate = dateDigitChineseYearWs
- break
- }
- case dateDigitDot:
- // This is the 2nd period
- // 3.31.2014
- // 08.21.71
- // 2014.05
- // 2018.09.30
- if r == '.' {
- if p.moi == 0 {
- // 3.31.2014
- p.daylen = i - p.dayi
- p.yeari = i + 1
- p.setDay()
- p.stateDate = dateDigitDotDot
- } else {
- // 2018.09.30
- //p.molen = 2
- p.molen = i - p.moi
- p.dayi = i + 1
- p.setMonth()
- p.stateDate = dateDigitDotDot
- }
- }
- case dateDigitDotDot:
- // iterate all the way through
- case dateAlpha:
- // dateAlphaWS
- // Mon Jan _2 15:04:05 2006
- // Mon Jan _2 15:04:05 MST 2006
- // Mon Jan 02 15:04:05 -0700 2006
- // Mon Aug 10 15:44:11 UTC+0100 2015
- // Fri Jul 03 2015 18:04:07 GMT+0100 (GMT Daylight Time)
- // dateAlphaWSDigit
- // May 8, 2009 5:57:51 PM
- // oct 1, 1970
- // dateAlphaWsMonth
- // April 8, 2009
- // dateAlphaWsMore
- // dateAlphaWsAtTime
- // January 02, 2006 at 3:04pm MST-07
- //
- // dateAlphaPeriodWsDigit
- // oct. 1, 1970
- // dateWeekdayComma
- // Monday, 02 Jan 2006 15:04:05 MST
- // Monday, 02-Jan-06 15:04:05 MST
- // Monday, 02 Jan 2006 15:04:05 -0700
- // Monday, 02 Jan 2006 15:04:05 +0100
- // dateWeekdayAbbrevComma
- // Mon, 02 Jan 2006 15:04:05 MST
- // Mon, 02 Jan 2006 15:04:05 -0700
- // Thu, 13 Jul 2017 08:58:40 +0100
- // Tue, 11 Jul 2017 16:28:13 +0200 (CEST)
- // Mon, 02-Jan-06 15:04:05 MST
- switch {
- case r == ' ':
- // X
- // April 8, 2009
- if i > 3 {
- // Check to see if the alpha is name of month? or Day?
- month := strings.ToLower(datestr[0:i])
- if isMonthFull(month) {
- p.fullMonth = month
- // len(" 31, 2018") = 9
- if len(datestr[i:]) < 10 {
- // April 8, 2009
- p.stateDate = dateAlphaWsMonth
- } else {
- p.stateDate = dateAlphaWsMore
- }
- p.dayi = i + 1
- break
- }
-
- } else {
- // This is possibly ambiguous? May will parse as either though.
- // So, it could return in-correct format.
- // May 05, 2005, 05:05:05
- // May 05 2005, 05:05:05
- // Jul 05, 2005, 05:05:05
- p.stateDate = dateAlphaWs
- }
-
- case r == ',':
- // Mon, 02 Jan 2006
- // p.moi = 0
- // p.molen = i
- if i == 3 {
- p.stateDate = dateWeekdayAbbrevComma
- p.set(0, "Mon")
- } else {
- p.stateDate = dateWeekdayComma
- p.skip = i + 2
- i++
- // TODO: lets just make this "skip" as we don't need
- // the mon, monday, they are all superfelous and not needed
- // just lay down the skip, no need to fill and then skip
- }
- case r == '.':
- // sept. 28, 2017
- // jan. 28, 2017
- p.stateDate = dateAlphaPeriodWsDigit
- if i == 3 {
- p.molen = i
- p.set(0, "Jan")
- } else if i == 4 {
- // gross
- datestr = datestr[0:i-1] + datestr[i:]
- return parseTime(datestr, loc)
- } else {
- return nil, unknownErr(datestr)
- }
- }
-
- case dateAlphaWs:
- // dateAlphaWsAlpha
- // Mon Jan _2 15:04:05 2006
- // Mon Jan _2 15:04:05 MST 2006
- // Mon Jan 02 15:04:05 -0700 2006
- // Fri Jul 03 2015 18:04:07 GMT+0100 (GMT Daylight Time)
- // Mon Aug 10 15:44:11 UTC+0100 2015
- // dateAlphaWsDigit
- // May 8, 2009 5:57:51 PM
- // May 8 2009 5:57:51 PM
- // oct 1, 1970
- // oct 7, '70
- switch {
- case unicode.IsLetter(r):
- p.set(0, "Mon")
- p.stateDate = dateAlphaWsAlpha
- p.set(i, "Jan")
- case unicode.IsDigit(r):
- p.set(0, "Jan")
- p.stateDate = dateAlphaWsDigit
- p.dayi = i
- }
-
- case dateAlphaWsDigit:
- // May 8, 2009 5:57:51 PM
- // May 8 2009 5:57:51 PM
- // oct 1, 1970
- // oct 7, '70
- // oct. 7, 1970
- if r == ',' {
- p.daylen = i - p.dayi
- p.setDay()
- p.stateDate = dateAlphaWsDigitMore
- } else if r == ' ' {
- p.daylen = i - p.dayi
- p.setDay()
- p.yeari = i + 1
- p.stateDate = dateAlphaWsDigitMoreWs
- } else if unicode.IsLetter(r) {
- p.stateDate = dateAlphaWsMonthSuffix
- i--
- }
- case dateAlphaWsDigitMore:
- // x
- // May 8, 2009 5:57:51 PM
- // May 05, 2005, 05:05:05
- // May 05 2005, 05:05:05
- // oct 1, 1970
- // oct 7, '70
- if r == ' ' {
- p.yeari = i + 1
- p.stateDate = dateAlphaWsDigitMoreWs
- }
- case dateAlphaWsDigitMoreWs:
- // x
- // May 8, 2009 5:57:51 PM
- // May 05, 2005, 05:05:05
- // oct 1, 1970
- // oct 7, '70
- switch r {
- case '\'':
- p.yeari = i + 1
- case ' ', ',':
- // x
- // May 8, 2009 5:57:51 PM
- // x
- // May 8, 2009, 5:57:51 PM
- p.stateDate = dateAlphaWsDigitMoreWsYear
- p.yearlen = i - p.yeari
- p.setYear()
- p.stateTime = timeStart
- break iterRunes
- }
-
- case dateAlphaWsAlpha:
- // Mon Jan _2 15:04:05 2006
- // Mon Jan 02 15:04:05 -0700 2006
- // Mon Jan _2 15:04:05 MST 2006
- // Mon Aug 10 15:44:11 UTC+0100 2015
- // Fri Jul 03 2015 18:04:07 GMT+0100 (GMT Daylight Time)
- if r == ' ' {
- if p.dayi > 0 {
- p.daylen = i - p.dayi
- p.setDay()
- p.yeari = i + 1
- p.stateDate = dateAlphaWsAlphaYearmaybe
- p.stateTime = timeStart
- }
- } else if unicode.IsDigit(r) {
- if p.dayi == 0 {
- p.dayi = i
- }
- }
-
- case dateAlphaWsAlphaYearmaybe:
- // x
- // Mon Jan _2 15:04:05 2006
- // Fri Jul 03 2015 18:04:07 GMT+0100 (GMT Daylight Time)
- if r == ':' {
- i = i - 3
- p.stateDate = dateAlphaWsAlpha
- p.yeari = 0
- break iterRunes
- } else if r == ' ' {
- // must be year format, not 15:04
- p.yearlen = i - p.yeari
- p.setYear()
- break iterRunes
- }
-
- case dateAlphaWsMonth:
- // April 8, 2009
- // April 8 2009
- switch r {
- case ' ', ',':
- // x
- // June 8, 2009
- // x
- // June 8 2009
- if p.daylen == 0 {
- p.daylen = i - p.dayi
- p.setDay()
- }
- case 's', 'S', 'r', 'R', 't', 'T', 'n', 'N':
- // st, rd, nd, st
- i--
- p.stateDate = dateAlphaWsMonthSuffix
- default:
- if p.daylen > 0 && p.yeari == 0 {
- p.yeari = i
- }
- }
- case dateAlphaWsMonthMore:
- // X
- // January 02, 2006, 15:04:05
- // January 02 2006, 15:04:05
- // January 02, 2006 15:04:05
- // January 02 2006 15:04:05
- switch r {
- case ',':
- p.yearlen = i - p.yeari
- p.setYear()
- p.stateTime = timeStart
- i++
- break iterRunes
- case ' ':
- p.yearlen = i - p.yeari
- p.setYear()
- p.stateTime = timeStart
- break iterRunes
- }
- case dateAlphaWsMonthSuffix:
- // x
- // April 8th, 2009
- // April 8th 2009
- switch r {
- case 't', 'T':
- if p.nextIs(i, 'h') || p.nextIs(i, 'H') {
- if len(datestr) > i+2 {
- return parseTime(fmt.Sprintf("%s%s", p.datestr[0:i], p.datestr[i+2:]), loc)
- }
- }
- case 'n', 'N':
- if p.nextIs(i, 'd') || p.nextIs(i, 'D') {
- if len(datestr) > i+2 {
- return parseTime(fmt.Sprintf("%s%s", p.datestr[0:i], p.datestr[i+2:]), loc)
- }
- }
- case 's', 'S':
- if p.nextIs(i, 't') || p.nextIs(i, 'T') {
- if len(datestr) > i+2 {
- return parseTime(fmt.Sprintf("%s%s", p.datestr[0:i], p.datestr[i+2:]), loc)
- }
- }
- case 'r', 'R':
- if p.nextIs(i, 'd') || p.nextIs(i, 'D') {
- if len(datestr) > i+2 {
- return parseTime(fmt.Sprintf("%s%s", p.datestr[0:i], p.datestr[i+2:]), loc)
- }
- }
- }
- case dateAlphaWsMore:
- // January 02, 2006, 15:04:05
- // January 02 2006, 15:04:05
- // January 2nd, 2006, 15:04:05
- // January 2nd 2006, 15:04:05
- // September 17, 2012 at 5:00pm UTC-05
- switch {
- case r == ',':
- // x
- // January 02, 2006, 15:04:05
- if p.nextIs(i, ' ') {
- p.daylen = i - p.dayi
- p.setDay()
- p.yeari = i + 2
- p.stateDate = dateAlphaWsMonthMore
- i++
- }
-
- case r == ' ':
- // x
- // January 02 2006, 15:04:05
- p.daylen = i - p.dayi
- p.setDay()
- p.yeari = i + 1
- p.stateDate = dateAlphaWsMonthMore
- case unicode.IsDigit(r):
- // XX
- // January 02, 2006, 15:04:05
- continue
- case unicode.IsLetter(r):
- // X
- // January 2nd, 2006, 15:04:05
- p.daylen = i - p.dayi
- p.setDay()
- p.stateDate = dateAlphaWsMonthSuffix
- i--
- }
-
- case dateAlphaPeriodWsDigit:
- // oct. 7, '70
- switch {
- case r == ' ':
- // continue
- case unicode.IsDigit(r):
- p.stateDate = dateAlphaWsDigit
- p.dayi = i
- default:
- return p, unknownErr(datestr)
- }
- case dateWeekdayComma:
- // Monday, 02 Jan 2006 15:04:05 MST
- // Monday, 02 Jan 2006 15:04:05 -0700
- // Monday, 02 Jan 2006 15:04:05 +0100
- // Monday, 02-Jan-06 15:04:05 MST
- if p.dayi == 0 {
- p.dayi = i
- }
- switch r {
- case ' ', '-':
- if p.moi == 0 {
- p.moi = i + 1
- p.daylen = i - p.dayi
- p.setDay()
- } else if p.yeari == 0 {
- p.yeari = i + 1
- p.molen = i - p.moi
- p.set(p.moi, "Jan")
- } else {
- p.stateTime = timeStart
- break iterRunes
- }
- }
- case dateWeekdayAbbrevComma:
- // Mon, 02 Jan 2006 15:04:05 MST
- // Mon, 02 Jan 2006 15:04:05 -0700
- // Thu, 13 Jul 2017 08:58:40 +0100
- // Thu, 4 Jan 2018 17:53:36 +0000
- // Tue, 11 Jul 2017 16:28:13 +0200 (CEST)
- // Mon, 02-Jan-06 15:04:05 MST
- switch r {
- case ' ', '-':
- if p.dayi == 0 {
- p.dayi = i + 1
- } else if p.moi == 0 {
- p.daylen = i - p.dayi
- p.setDay()
- p.moi = i + 1
- } else if p.yeari == 0 {
- p.molen = i - p.moi
- p.set(p.moi, "Jan")
- p.yeari = i + 1
- } else {
- p.yearlen = i - p.yeari
- p.setYear()
- p.stateTime = timeStart
- break iterRunes
- }
- }
-
- default:
- break iterRunes
- }
- }
- p.coalesceDate(i)
- if p.stateTime == timeStart {
- // increment first one, since the i++ occurs at end of loop
- if i < len(p.datestr) {
- i++
- }
- // ensure we skip any whitespace prefix
- for ; i < len(datestr); i++ {
- r := rune(datestr[i])
- if r != ' ' {
- break
- }
- }
-
- iterTimeRunes:
- for ; i < len(datestr); i++ {
- r := rune(datestr[i])
-
- //gou.Debugf("%d %s %d iterTimeRunes %s %s", i, string(r), p.stateTime, p.ds(), p.ts())
-
- switch p.stateTime {
- case timeStart:
- // 22:43:22
- // 22:43
- // timeComma
- // 08:20:13,787
- // timeWs
- // 05:24:37 PM
- // 06:20:00 UTC
- // 06:20:00 UTC-05
- // 00:12:00 +0000 UTC
- // 22:18:00 +0000 UTC m=+0.000000001
- // 15:04:05 -0700
- // 15:04:05 -07:00
- // 15:04:05 2008
- // timeOffset
- // 03:21:51+00:00
- // 19:55:00+0100
- // timePeriod
- // 17:24:37.3186369
- // 00:07:31.945167
- // 18:31:59.257000000
- // 00:00:00.000
- // timePeriodOffset
- // 19:55:00.799+0100
- // timePeriodOffsetColon
- // 15:04:05.999-07:00
- // timePeriodWs
- // timePeriodWsOffset
- // 00:07:31.945167 +0000
- // 00:00:00.000 +0000
- // timePeriodWsOffsetAlpha
- // 00:07:31.945167 +0000 UTC
- // 22:18:00.001 +0000 UTC m=+0.000000001
- // 00:00:00.000 +0000 UTC
- // timePeriodWsAlpha
- // 06:20:00.000 UTC
- if p.houri == 0 {
- p.houri = i
- }
- switch r {
- case ',':
- // hm, lets just swap out comma for period. for some reason go
- // won't parse it.
- // 2014-05-11 08:20:13,787
- ds := []byte(p.datestr)
- ds[i] = '.'
- return parseTime(string(ds), loc)
- case '-', '+':
- // 03:21:51+00:00
- p.stateTime = timeOffset
- if p.seci == 0 {
- // 22:18+0530
- p.minlen = i - p.mini
- } else {
- p.seclen = i - p.seci
- }
- p.offseti = i
- case '.':
- p.stateTime = timePeriod
- p.seclen = i - p.seci
- p.msi = i + 1
- case 'Z':
- p.stateTime = timeZ
- if p.seci == 0 {
- p.minlen = i - p.mini
- } else {
- p.seclen = i - p.seci
- }
- case 'a', 'A':
- if p.nextIs(i, 't') || p.nextIs(i, 'T') {
- // x
- // September 17, 2012 at 5:00pm UTC-05
- i++ // skip t
- if p.nextIs(i, ' ') {
- // x
- // September 17, 2012 at 5:00pm UTC-05
- i++ // skip '
- p.houri = 0 // reset hour
- }
- } else {
- switch {
- case r == 'a' && p.nextIs(i, 'm'):
- p.coalesceTime(i)
- p.set(i, "am")
- case r == 'A' && p.nextIs(i, 'M'):
- p.coalesceTime(i)
- p.set(i, "PM")
- }
- }
-
- case 'p', 'P':
- // Could be AM/PM
- switch {
- case r == 'p' && p.nextIs(i, 'm'):
- p.coalesceTime(i)
- p.set(i, "pm")
- case r == 'P' && p.nextIs(i, 'M'):
- p.coalesceTime(i)
- p.set(i, "PM")
- }
- case ' ':
- p.coalesceTime(i)
- p.stateTime = timeWs
- case ':':
- if p.mini == 0 {
- p.mini = i + 1
- p.hourlen = i - p.houri
- } else if p.seci == 0 {
- p.seci = i + 1
- p.minlen = i - p.mini
- }
- }
- case timeOffset:
- // 19:55:00+0100
- // timeOffsetColon
- // 15:04:05+07:00
- // 15:04:05-07:00
- if r == ':' {
- p.stateTime = timeOffsetColon
- }
- case timeWs:
- // timeWsAlpha
- // 06:20:00 UTC
- // 06:20:00 UTC-05
- // 15:44:11 UTC+0100 2015
- // 18:04:07 GMT+0100 (GMT Daylight Time)
- // 17:57:51 MST 2009
- // timeWsAMPMMaybe
- // 05:24:37 PM
- // timeWsOffset
- // 15:04:05 -0700
- // 00:12:00 +0000 UTC
- // timeWsOffsetColon
- // 15:04:05 -07:00
- // 17:57:51 -0700 2009
- // timeWsOffsetColonAlpha
- // 00:12:00 +00:00 UTC
- // timeWsYear
- // 00:12:00 2008
- // timeZ
- // 15:04:05.99Z
- switch r {
- case 'A', 'P':
- // Could be AM/PM or could be PST or similar
- p.tzi = i
- p.stateTime = timeWsAMPMMaybe
- case '+', '-':
- p.offseti = i
- p.stateTime = timeWsOffset
- default:
- if unicode.IsLetter(r) {
- // 06:20:00 UTC
- // 06:20:00 UTC-05
- // 15:44:11 UTC+0100 2015
- // 17:57:51 MST 2009
- p.tzi = i
- p.stateTime = timeWsAlpha
- //break iterTimeRunes
- } else if unicode.IsDigit(r) {
- // 00:12:00 2008
- p.stateTime = timeWsYear
- p.yeari = i
- }
- }
- case timeWsAlpha:
- // 06:20:00 UTC
- // 06:20:00 UTC-05
- // timeWsAlphaWs
- // 17:57:51 MST 2009
- // timeWsAlphaZoneOffset
- // timeWsAlphaZoneOffsetWs
- // timeWsAlphaZoneOffsetWsExtra
- // 18:04:07 GMT+0100 (GMT Daylight Time)
- // timeWsAlphaZoneOffsetWsYear
- // 15:44:11 UTC+0100 2015
- switch r {
- case '+', '-':
- p.tzlen = i - p.tzi
- if p.tzlen == 4 {
- p.set(p.tzi, " MST")
- } else if p.tzlen == 3 {
- p.set(p.tzi, "MST")
- }
- p.stateTime = timeWsAlphaZoneOffset
- p.offseti = i
- case ' ':
- // 17:57:51 MST 2009
- p.tzlen = i - p.tzi
- if p.tzlen == 4 {
- p.set(p.tzi, " MST")
- } else if p.tzlen == 3 {
- p.set(p.tzi, "MST")
- }
- p.stateTime = timeWsAlphaWs
- p.yeari = i + 1
- }
- case timeWsAlphaWs:
- // 17:57:51 MST 2009
-
- case timeWsAlphaZoneOffset:
- // 06:20:00 UTC-05
- // timeWsAlphaZoneOffset
- // timeWsAlphaZoneOffsetWs
- // timeWsAlphaZoneOffsetWsExtra
- // 18:04:07 GMT+0100 (GMT Daylight Time)
- // timeWsAlphaZoneOffsetWsYear
- // 15:44:11 UTC+0100 2015
- switch r {
- case ' ':
- p.set(p.offseti, "-0700")
- p.yeari = i + 1
- p.stateTime = timeWsAlphaZoneOffsetWs
- }
- case timeWsAlphaZoneOffsetWs:
- // timeWsAlphaZoneOffsetWs
- // timeWsAlphaZoneOffsetWsExtra
- // 18:04:07 GMT+0100 (GMT Daylight Time)
- // timeWsAlphaZoneOffsetWsYear
- // 15:44:11 UTC+0100 2015
- if unicode.IsDigit(r) {
- p.stateTime = timeWsAlphaZoneOffsetWsYear
- } else {
- p.extra = i - 1
- p.stateTime = timeWsAlphaZoneOffsetWsExtra
- }
- case timeWsAlphaZoneOffsetWsYear:
- // 15:44:11 UTC+0100 2015
- if unicode.IsDigit(r) {
- p.yearlen = i - p.yeari + 1
- if p.yearlen == 4 {
- p.setYear()
- }
- }
- case timeWsAMPMMaybe:
- // timeWsAMPMMaybe
- // timeWsAMPM
- // 05:24:37 PM
- // timeWsAlpha
- // 00:12:00 PST
- // 15:44:11 UTC+0100 2015
- if r == 'M' {
- //return parse("2006-01-02 03:04:05 PM", datestr, loc)
- p.stateTime = timeWsAMPM
- p.set(i-1, "PM")
- if p.hourlen == 2 {
- p.set(p.houri, "03")
- } else if p.hourlen == 1 {
- p.set(p.houri, "3")
- }
- } else {
- p.stateTime = timeWsAlpha
- }
-
- case timeWsOffset:
- // timeWsOffset
- // 15:04:05 -0700
- // timeWsOffsetWsOffset
- // 17:57:51 -0700 -07
- // timeWsOffsetWs
- // 17:57:51 -0700 2009
- // 00:12:00 +0000 UTC
- // timeWsOffsetColon
- // 15:04:05 -07:00
- // timeWsOffsetColonAlpha
- // 00:12:00 +00:00 UTC
- switch r {
- case ':':
- p.stateTime = timeWsOffsetColon
- case ' ':
- p.set(p.offseti, "-0700")
- p.yeari = i + 1
- p.stateTime = timeWsOffsetWs
- }
- case timeWsOffsetWs:
- // 17:57:51 -0700 2009
- // 00:12:00 +0000 UTC
- // 22:18:00.001 +0000 UTC m=+0.000000001
- // w Extra
- // 17:57:51 -0700 -07
- switch r {
- case '=':
- // eff you golang
- if datestr[i-1] == 'm' {
- p.extra = i - 2
- p.trimExtra()
- break
- }
- case '+', '-':
- // This really doesn't seem valid, but for some reason when round-tripping a go date
- // their is an extra +03 printed out. seems like go bug to me, but, parsing anyway.
- // 00:00:00 +0300 +03
- // 00:00:00 +0300 +0300
- p.extra = i - 1
- p.stateTime = timeWsOffset
- p.trimExtra()
- break
- default:
- switch {
- case unicode.IsDigit(r):
- p.yearlen = i - p.yeari + 1
- if p.yearlen == 4 {
- p.setYear()
- }
- case unicode.IsLetter(r):
- if p.tzi == 0 {
- p.tzi = i
- }
- }
- }
-
- case timeWsOffsetColon:
- // timeWsOffsetColon
- // 15:04:05 -07:00
- // timeWsOffsetColonAlpha
- // 2015-02-18 00:12:00 +00:00 UTC
- if unicode.IsLetter(r) {
- // 2015-02-18 00:12:00 +00:00 UTC
- p.stateTime = timeWsOffsetColonAlpha
- break iterTimeRunes
- }
- case timePeriod:
- // 15:04:05.999999999+07:00
- // 15:04:05.999999999-07:00
- // 15:04:05.999999+07:00
- // 15:04:05.999999-07:00
- // 15:04:05.999+07:00
- // 15:04:05.999-07:00
- // timePeriod
- // 17:24:37.3186369
- // 00:07:31.945167
- // 18:31:59.257000000
- // 00:00:00.000
- // timePeriodOffset
- // 19:55:00.799+0100
- // timePeriodOffsetColon
- // 15:04:05.999-07:00
- // timePeriodWs
- // timePeriodWsOffset
- // 00:07:31.945167 +0000
- // 00:00:00.000 +0000
- // With Extra
- // 00:00:00.000 +0300 +03
- // timePeriodWsOffsetAlpha
- // 00:07:31.945167 +0000 UTC
- // 00:00:00.000 +0000 UTC
- // 22:18:00.001 +0000 UTC m=+0.000000001
- // timePeriodWsAlpha
- // 06:20:00.000 UTC
- switch r {
- case ' ':
- p.mslen = i - p.msi
- p.stateTime = timePeriodWs
- case '+', '-':
- // This really shouldn't happen
- p.mslen = i - p.msi
- p.offseti = i
- p.stateTime = timePeriodOffset
- default:
- if unicode.IsLetter(r) {
- // 06:20:00.000 UTC
- p.mslen = i - p.msi
- p.stateTime = timePeriodWsAlpha
- }
- }
- case timePeriodOffset:
- // timePeriodOffset
- // 19:55:00.799+0100
- // timePeriodOffsetColon
- // 15:04:05.999-07:00
- // 13:31:51.999-07:00 MST
- if r == ':' {
- p.stateTime = timePeriodOffsetColon
- }
- case timePeriodOffsetColon:
- // timePeriodOffset
- // timePeriodOffsetColon
- // 15:04:05.999-07:00
- // 13:31:51.999 -07:00 MST
- switch r {
- case ' ':
- p.set(p.offseti, "-07:00")
- p.stateTime = timePeriodOffsetColonWs
- p.tzi = i + 1
- }
- case timePeriodOffsetColonWs:
- // continue
- case timePeriodWs:
- // timePeriodWs
- // timePeriodWsOffset
- // 00:07:31.945167 +0000
- // 00:00:00.000 +0000
- // timePeriodWsOffsetAlpha
- // 00:07:31.945167 +0000 UTC
- // 00:00:00.000 +0000 UTC
- // timePeriodWsOffsetColon
- // 13:31:51.999 -07:00 MST
- // timePeriodWsAlpha
- // 06:20:00.000 UTC
- if p.offseti == 0 {
- p.offseti = i
- }
- switch r {
- case '+', '-':
- p.mslen = i - p.msi - 1
- p.stateTime = timePeriodWsOffset
- default:
- if unicode.IsLetter(r) {
- // 00:07:31.945167 +0000 UTC
- // 00:00:00.000 +0000 UTC
- p.stateTime = timePeriodWsOffsetWsAlpha
- break iterTimeRunes
- }
- }
-
- case timePeriodWsOffset:
- // timePeriodWs
- // timePeriodWsOffset
- // 00:07:31.945167 +0000
- // 00:00:00.000 +0000
- // With Extra
- // 00:00:00.000 +0300 +03
- // timePeriodWsOffsetAlpha
- // 00:07:31.945167 +0000 UTC
- // 00:00:00.000 +0000 UTC
- // 03:02:00.001 +0300 MSK m=+0.000000001
- // timePeriodWsOffsetColon
- // 13:31:51.999 -07:00 MST
- // timePeriodWsAlpha
- // 06:20:00.000 UTC
- switch r {
- case ':':
- p.stateTime = timePeriodWsOffsetColon
- case ' ':
- p.set(p.offseti, "-0700")
- case '+', '-':
- // This really doesn't seem valid, but for some reason when round-tripping a go date
- // their is an extra +03 printed out. seems like go bug to me, but, parsing anyway.
- // 00:00:00.000 +0300 +03
- // 00:00:00.000 +0300 +0300
- p.extra = i - 1
- p.trimExtra()
- break
- default:
- if unicode.IsLetter(r) {
- // 00:07:31.945167 +0000 UTC
- // 00:00:00.000 +0000 UTC
- // 03:02:00.001 +0300 MSK m=+0.000000001
- p.stateTime = timePeriodWsOffsetWsAlpha
- }
- }
- case timePeriodWsOffsetWsAlpha:
- // 03:02:00.001 +0300 MSK m=+0.000000001
- // eff you golang
- if r == '=' && datestr[i-1] == 'm' {
- p.extra = i - 2
- p.trimExtra()
- break
- }
-
- case timePeriodWsOffsetColon:
- // 13:31:51.999 -07:00 MST
- switch r {
- case ' ':
- p.set(p.offseti, "-07:00")
- default:
- if unicode.IsLetter(r) {
- // 13:31:51.999 -07:00 MST
- p.tzi = i
- p.stateTime = timePeriodWsOffsetColonAlpha
- }
- }
- case timePeriodWsOffsetColonAlpha:
- // continue
- case timeZ:
- // timeZ
- // 15:04:05.99Z
- // With a time-zone at end after Z
- // 2006-01-02T15:04:05.999999999Z07:00
- // 2006-01-02T15:04:05Z07:00
- // RFC3339 = "2006-01-02T15:04:05Z07:00"
- // RFC3339Nano = "2006-01-02T15:04:05.999999999Z07:00"
- if unicode.IsDigit(r) {
- p.stateTime = timeZDigit
- }
-
- }
- }
-
- switch p.stateTime {
- case timeWsAlphaWs:
- p.yearlen = i - p.yeari
- p.setYear()
- case timeWsYear:
- p.yearlen = i - p.yeari
- p.setYear()
- case timeWsAlphaZoneOffsetWsExtra:
- p.trimExtra()
- case timeWsAlphaZoneOffset:
- // 06:20:00 UTC-05
- if i-p.offseti < 4 {
- p.set(p.offseti, "-07")
- } else {
- p.set(p.offseti, "-0700")
- }
-
- case timePeriod:
- p.mslen = i - p.msi
- case timeOffset:
- // 19:55:00+0100
- p.set(p.offseti, "-0700")
- case timeWsOffset:
- p.set(p.offseti, "-0700")
- case timeWsOffsetWs:
- // 17:57:51 -0700 2009
- // 00:12:00 +0000 UTC
- case timeWsOffsetColon:
- // 17:57:51 -07:00
- p.set(p.offseti, "-07:00")
- case timeOffsetColon:
- // 15:04:05+07:00
- p.set(p.offseti, "-07:00")
- case timePeriodOffset:
- // 19:55:00.799+0100
- p.set(p.offseti, "-0700")
- case timePeriodOffsetColon:
- p.set(p.offseti, "-07:00")
- case timePeriodWsOffsetColonAlpha:
- p.tzlen = i - p.tzi
- switch p.tzlen {
- case 3:
- p.set(p.tzi, "MST")
- case 4:
- p.set(p.tzi, "MST ")
- }
- case timePeriodWsOffset:
- p.set(p.offseti, "-0700")
- }
- p.coalesceTime(i)
- }
-
- switch p.stateDate {
- case dateDigit:
- // unixy timestamps ish
- // example ct type
- // 1499979655583057426 19 nanoseconds
- // 1499979795437000 16 micro-seconds
- // 20180722105203 14 yyyyMMddhhmmss
- // 1499979795437 13 milliseconds
- // 1332151919 10 seconds
- // 20140601 8 yyyymmdd
- // 2014 4 yyyy
- t := time.Time{}
- if len(datestr) == len("1499979655583057426") { // 19
- // nano-seconds
- if nanoSecs, err := strconv.ParseInt(datestr, 10, 64); err == nil {
- t = time.Unix(0, nanoSecs)
- }
- } else if len(datestr) == len("1499979795437000") { // 16
- // micro-seconds
- if microSecs, err := strconv.ParseInt(datestr, 10, 64); err == nil {
- t = time.Unix(0, microSecs*1000)
- }
- } else if len(datestr) == len("yyyyMMddhhmmss") { // 14
- // yyyyMMddhhmmss
- p.format = []byte("20060102150405")
- return p, nil
- } else if len(datestr) == len("1332151919000") { // 13
- if miliSecs, err := strconv.ParseInt(datestr, 10, 64); err == nil {
- t = time.Unix(0, miliSecs*1000*1000)
- }
- } else if len(datestr) == len("1332151919") { //10
- if secs, err := strconv.ParseInt(datestr, 10, 64); err == nil {
- t = time.Unix(secs, 0)
- }
- } else if len(datestr) == len("20140601") {
- p.format = []byte("20060102")
- return p, nil
- } else if len(datestr) == len("2014") {
- p.format = []byte("2006")
- return p, nil
- } else if len(datestr) < 4 {
- return nil, fmt.Errorf("unrecognized format, too short %v", datestr)
- }
- if !t.IsZero() {
- if loc == nil {
- p.t = &t
- return p, nil
- }
- t = t.In(loc)
- p.t = &t
- return p, nil
- }
-
- case dateYearDash:
- // 2006-01
- return p, nil
-
- case dateYearDashDash:
- // 2006-01-02
- // 2006-1-02
- // 2006-1-2
- // 2006-01-2
- return p, nil
-
- case dateYearDashAlphaDash:
- // 2013-Feb-03
- // 2013-Feb-3
- p.daylen = i - p.dayi
- p.setDay()
- return p, nil
-
- case dateYearDashDashWs:
- // 2013-04-01
- return p, nil
-
- case dateYearDashDashT:
- return p, nil
-
- case dateDigitDashAlphaDash:
- // 13-Feb-03 ambiguous
- // 28-Feb-03 ambiguous
- // 29-Jun-2016
- length := len(datestr) - (p.moi + p.molen + 1)
- if length == 4 {
- p.yearlen = 4
- p.set(p.yeari, "2006")
- // We now also know that part1 was the day
- p.dayi = 0
- p.daylen = p.part1Len
- p.setDay()
- } else if length == 2 {
- // We have no idea if this is
- // yy-mon-dd OR dd-mon-yy
- //
- // We are going to ASSUME (bad, bad) that it is dd-mon-yy which is a horible assumption
- p.ambiguousMD = true
- p.yearlen = 2
- p.set(p.yeari, "06")
- // We now also know that part1 was the day
- p.dayi = 0
- p.daylen = p.part1Len
- p.setDay()
- }
-
- return p, nil
-
- case dateDigitDot:
- // 2014.05
- p.molen = i - p.moi
- p.setMonth()
- return p, nil
-
- case dateDigitDotDot:
- // 03.31.1981
- // 3.31.2014
- // 3.2.1981
- // 3.2.81
- // 08.21.71
- // 2018.09.30
- return p, nil
-
- case dateDigitWsMoYear:
- // 2 Jan 2018
- // 2 Jan 18
- // 2 Jan 2018 23:59
- // 02 Jan 2018 23:59
- // 12 Feb 2006, 19:17
- return p, nil
-
- case dateDigitWsMolong:
- // 18 January 2018
- // 8 January 2018
- if p.daylen == 2 {
- p.format = []byte("02 January 2006")
- return p, nil
- }
- p.format = []byte("2 January 2006")
- return p, nil // parse("2 January 2006", datestr, loc)
-
- case dateAlphaWsMonth:
- p.yearlen = i - p.yeari
- p.setYear()
- return p, nil
-
- case dateAlphaWsMonthMore:
- return p, nil
-
- case dateAlphaWsDigitMoreWs:
- // oct 1, 1970
- p.yearlen = i - p.yeari
- p.setYear()
- return p, nil
-
- case dateAlphaWsDigitMoreWsYear:
- // May 8, 2009 5:57:51 PM
- // Jun 7, 2005, 05:57:51
- return p, nil
-
- case dateAlphaWsAlpha:
- return p, nil
-
- case dateAlphaWsAlphaYearmaybe:
- return p, nil
-
- case dateDigitSlash:
- // 3/1/2014
- // 10/13/2014
- // 01/02/2006
- // 2014/10/13
- return p, nil
-
- case dateDigitChineseYear:
- // dateDigitChineseYear
- // 2014年04月08日
- p.format = []byte("2006年01月02日")
- return p, nil
-
- case dateDigitChineseYearWs:
- p.format = []byte("2006年01月02日 15:04:05")
- return p, nil
-
- case dateWeekdayComma:
- // Monday, 02 Jan 2006 15:04:05 -0700
- // Monday, 02 Jan 2006 15:04:05 +0100
- // Monday, 02-Jan-06 15:04:05 MST
- return p, nil
-
- case dateWeekdayAbbrevComma:
- // Mon, 02-Jan-06 15:04:05 MST
- // Mon, 02 Jan 2006 15:04:05 MST
- return p, nil
-
- }
-
- return nil, unknownErr(datestr)
-}
-
-type parser struct {
- loc *time.Location
- preferMonthFirst bool
- ambiguousMD bool
- stateDate dateState
- stateTime timeState
- format []byte
- datestr string
- fullMonth string
- skip int
- extra int
- part1Len int
- yeari int
- yearlen int
- moi int
- molen int
- dayi int
- daylen int
- houri int
- hourlen int
- mini int
- minlen int
- seci int
- seclen int
- msi int
- mslen int
- offseti int
- offsetlen int
- tzi int
- tzlen int
- t *time.Time
-}
-
-func newParser(dateStr string, loc *time.Location) *parser {
- p := parser{
- stateDate: dateStart,
- stateTime: timeIgnore,
- datestr: dateStr,
- loc: loc,
- preferMonthFirst: true,
- }
- p.format = []byte(dateStr)
- return &p
-}
-
-func (p *parser) nextIs(i int, b byte) bool {
- if len(p.datestr) > i+1 && p.datestr[i+1] == b {
- return true
- }
- return false
-}
-
-func (p *parser) set(start int, val string) {
- if start < 0 {
- return
- }
- if len(p.format) < start+len(val) {
- return
- }
- for i, r := range val {
- p.format[start+i] = byte(r)
- }
-}
-func (p *parser) setMonth() {
- if p.molen == 2 {
- p.set(p.moi, "01")
- } else if p.molen == 1 {
- p.set(p.moi, "1")
- }
-}
-
-func (p *parser) setDay() {
- if p.daylen == 2 {
- p.set(p.dayi, "02")
- } else if p.daylen == 1 {
- p.set(p.dayi, "2")
- }
-}
-func (p *parser) setYear() {
- if p.yearlen == 2 {
- p.set(p.yeari, "06")
- } else if p.yearlen == 4 {
- p.set(p.yeari, "2006")
- }
-}
-func (p *parser) coalesceDate(end int) {
- if p.yeari > 0 {
- if p.yearlen == 0 {
- p.yearlen = end - p.yeari
- }
- p.setYear()
- }
- if p.moi > 0 && p.molen == 0 {
- p.molen = end - p.moi
- p.setMonth()
- }
- if p.dayi > 0 && p.daylen == 0 {
- p.daylen = end - p.dayi
- p.setDay()
- }
-}
-func (p *parser) ts() string {
- return fmt.Sprintf("h:(%d:%d) m:(%d:%d) s:(%d:%d)", p.houri, p.hourlen, p.mini, p.minlen, p.seci, p.seclen)
-}
-func (p *parser) ds() string {
- return fmt.Sprintf("%s d:(%d:%d) m:(%d:%d) y:(%d:%d)", p.datestr, p.dayi, p.daylen, p.moi, p.molen, p.yeari, p.yearlen)
-}
-func (p *parser) coalesceTime(end int) {
- // 03:04:05
- // 15:04:05
- // 3:04:05
- // 3:4:5
- // 15:04:05.00
- if p.houri > 0 {
- if p.hourlen == 2 {
- p.set(p.houri, "15")
- } else if p.hourlen == 1 {
- p.set(p.houri, "3")
- }
- }
- if p.mini > 0 {
- if p.minlen == 0 {
- p.minlen = end - p.mini
- }
- if p.minlen == 2 {
- p.set(p.mini, "04")
- } else {
- p.set(p.mini, "4")
- }
- }
- if p.seci > 0 {
- if p.seclen == 0 {
- p.seclen = end - p.seci
- }
- if p.seclen == 2 {
- p.set(p.seci, "05")
- } else {
- p.set(p.seci, "5")
- }
- }
-
- if p.msi > 0 {
- for i := 0; i < p.mslen; i++ {
- p.format[p.msi+i] = '0'
- }
- }
-}
-func (p *parser) setFullMonth(month string) {
- if p.moi == 0 {
- p.format = []byte(fmt.Sprintf("%s%s", "January", p.format[len(month):]))
- }
-}
-
-func (p *parser) trimExtra() {
- if p.extra > 0 && len(p.format) > p.extra {
- p.format = p.format[0:p.extra]
- p.datestr = p.datestr[0:p.extra]
- }
-}
-
-// func (p *parser) remove(i, length int) {
-// if len(p.format) > i+length {
-// //append(a[:i], a[j:]...)
-// p.format = append(p.format[0:i], p.format[i+length:]...)
-// }
-// if len(p.datestr) > i+length {
-// //append(a[:i], a[j:]...)
-// p.datestr = fmt.Sprintf("%s%s", p.datestr[0:i], p.datestr[i+length:])
-// }
-// }
-
-func (p *parser) parse() (time.Time, error) {
- if p.t != nil {
- return *p.t, nil
- }
- if len(p.fullMonth) > 0 {
- p.setFullMonth(p.fullMonth)
- }
- if p.skip > 0 && len(p.format) > p.skip {
- p.format = p.format[p.skip:]
- p.datestr = p.datestr[p.skip:]
- }
- //gou.Debugf("parse %q AS %q", p.datestr, string(p.format))
- if p.loc == nil {
- return time.Parse(string(p.format), p.datestr)
- }
- return time.ParseInLocation(string(p.format), p.datestr, p.loc)
-}
-func isMonthFull(alpha string) bool {
- for _, month := range months {
- if alpha == month {
- return true
- }
- }
- return false
-}
diff --git a/vendor/github.com/awesome-gocui/gocui/.gitignore b/vendor/github.com/awesome-gocui/gocui/.gitignore
deleted file mode 100644
index 1377554ebea6f98a2c748183bc5a96852af12ac2..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*.swp
diff --git a/vendor/github.com/awesome-gocui/gocui/AUTHORS b/vendor/github.com/awesome-gocui/gocui/AUTHORS
deleted file mode 100644
index 43ec4cecf7c4eeec53fcc3544ad1d1bb866146ba..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/AUTHORS
+++ /dev/null
@@ -1,30 +0,0 @@
-# This is the official list of gocui authors for copyright purposes.
-
-# Names should be added to this file as
-# Name or Organization contribution
-# Contribution
-# The email address is not required for organizations.
-
-Roi Martin
- Main developer
-
-Ryan Sullivan
- Toggleable view frames
-
-Matthieu Rakotojaona
- Wrapped views
-
-Harry Lawrence
- Basic mouse support
-
-Danny Tylman
- Masked views
-
-Frederik Deweerdt
- Colored fonts
-
-Henri Koski
- Custom current view color
-
-Dustin Willis Webber
- 256-colors output mode support
diff --git a/vendor/github.com/awesome-gocui/gocui/CODE_OF_CONDUCT.md b/vendor/github.com/awesome-gocui/gocui/CODE_OF_CONDUCT.md
deleted file mode 100644
index 1bdac055eb250e0a31998e384574647ff25e56eb..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,76 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as
-contributors and maintainers pledge to making participation in our project and
-our community a harassment-free experience for everyone, regardless of age, body
-size, disability, ethnicity, sex characteristics, gender identity and expression,
-level of experience, education, socio-economic status, nationality, personal
-appearance, race, religion, or sexual identity and orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment
-include:
-
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-* The use of sexualized language or imagery and unwelcome sexual attention or
- advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or electronic
- address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a
- professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable
-behavior and are expected to take appropriate and fair corrective action in
-response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or
-reject comments, commits, code, wiki edits, issues, and other contributions
-that are not aligned to this Code of Conduct, or to ban temporarily or
-permanently any contributor for other behaviors that they deem inappropriate,
-threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies both within project spaces and in public spaces
-when an individual is representing the project or its community. Examples of
-representing a project or community include using an official project e-mail
-address, posting via an official social media account, or acting as an appointed
-representative at an online or offline event. Representation of a project may be
-further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported by contacting the project team at mkopenga@gmail.com. All
-complaints will be reviewed and investigated and will result in a response that
-is deemed necessary and appropriate to the circumstances. The project team is
-obligated to maintain confidentiality with regard to the reporter of an incident.
-Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good
-faith may face temporary or permanent repercussions as determined by other
-members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
-available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
-
-[homepage]: https://www.contributor-covenant.org
-
-For answers to common questions about this code of conduct, see
-https://www.contributor-covenant.org/faq
diff --git a/vendor/github.com/awesome-gocui/gocui/CONTRIBUTING.md b/vendor/github.com/awesome-gocui/gocui/CONTRIBUTING.md
deleted file mode 100644
index b93e45b25a2c89e7fa863ec53a75b3889d3c5a3b..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/CONTRIBUTING.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Contributing
-
-Everyone is welcome to help make gocui better!
-
-When contributing to this repository, please first discuss the change you wish
-to make via issue, email, or any other method with the owners of this repository
-before making a change.
-
-## So all code changes happen through Pull Requests
-Pull requests are the best way to propose changes to the codebase. We actively
-welcome your pull requests:
-
-1. Fork the repo and create your branch from `master` with a name like `feature/contributors-guide`.
-2. If you've added code that should be tested, add tests.
-3. If you've added code that need documentation, update the documentation.
-4. Make sure your code follows the [effective go](https://golang.org/doc/effective_go.html) guidelines as much as possible.
-5. Be sure to test your modifications.
-6. Make sure your branch is up to date with the master branch.
-7. Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
-8. Create that pull request!
-
-## Code of conduct
-Please note by participating in this project, you agree to abide by the [code of conduct].
-
-[code of conduct]: https://github.com/awesome-gocui/gocui/blob/master/CODE-OF-CONDUCT.md
-
-## Any contributions you make will be under the license indicated in the [license](LICENSE.md)
-In short, when you submit code changes, your submissions are understood to be
-under the same license as the rest of project. Feel free to contact the maintainers if that's a concern.
-
-## Report bugs using Github's [issues](https://github.com/awesome-gocui/gocui/issues)
-We use GitHub issues to track public bugs. Report a bug by [opening a new
-issue](https://github.com/awesome-gocui/gocui/issues/new); it's that easy!
\ No newline at end of file
diff --git a/vendor/github.com/awesome-gocui/gocui/LICENSE b/vendor/github.com/awesome-gocui/gocui/LICENSE
deleted file mode 100644
index 8cb28215e45eea5b12c371e410a21cdc5b7c8923..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright (c) 2014 The gocui Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above 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 the gocui Authors nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/awesome-gocui/gocui/README.md b/vendor/github.com/awesome-gocui/gocui/README.md
deleted file mode 100644
index be212c58770d551f7edbc89f9f9d1836ca1a622b..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/README.md
+++ /dev/null
@@ -1,135 +0,0 @@
-# GOCUI - Go Console User Interface
-[](https://circleci.com/gh/awesome-gocui/gocui/tree/master)
-[](https://codecov.io/gh/awesome-gocui/gocui)
-[](https://goreportcard.com/report/github.com/awesome-gocui/gocui)
-[](https://golangci.com/badges/github.com/awesome-gocui/gocui.svg)
-[](https://godoc.org/github.com/awesome-gocui/gocui)
-
-
-Minimalist Go package aimed at creating Console User Interfaces.
-A community fork based on the amazing work of [jroimartin](https://github.com/jroimartin/gocui)
-
-## Features
-
-* Minimalist API.
-* Views (the "windows" in the GUI) implement the interface io.ReadWriter.
-* Support for overlapping views.
-* The GUI can be modified at runtime (concurrent-safe).
-* Global and view-level keybindings.
-* Mouse support.
-* Colored text.
-* Customizable editing mode.
-* Easy to build reusable widgets, complex layouts...
-
-## About fork
-
-This fork has many improvements over the original work from [jroimartin](https://github.com/jroimartin/gocui).
-
-* Better wide character support
-* Support for 1 Line height views
-* Better support for running in docker container
-* Customize frame colors
-* Improved code comments and quality
-* Many small improvements
-* Change Visibility of views
-
-For information about this org see: [awesome-gocui/about](https://github.com/awesome-gocui/about).
-
-## Installation
-
-Execute:
-
-```
-$ go get github.com/awesome-gocui/gocui
-```
-
-## Documentation
-
-Execute:
-
-```
-$ go doc github.com/awesome-gocui/gocui
-```
-
-Or visit [godoc.org](https://godoc.org/github.com/awesome-gocui/gocui) to read it
-online.
-
-## Example
-See the [_example](./_example/) folder for more examples
-
-```go
-package main
-
-import (
- "fmt"
- "log"
-
- "github.com/awesome-gocui/gocui"
-)
-
-func main() {
- g, err := gocui.NewGui(gocui.OutputNormal, false)
- if err != nil {
- log.Panicln(err)
- }
- defer g.Close()
-
- g.SetManagerFunc(layout)
-
- if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
- log.Panicln(err)
- }
-
- if err := g.MainLoop(); err != nil && !gocui.IsQuit(err) {
- log.Panicln(err)
- }
-}
-
-func layout(g *gocui.Gui) error {
- maxX, maxY := g.Size()
- if v, err := g.SetView("hello", maxX/2-7, maxY/2, maxX/2+7, maxY/2+2, 0); err != nil {
- if !gocui.IsUnknownView(err) {
- return err
- }
- fmt.Fprintln(v, "Hello world!")
- if _, err := g.SetCurrentView("hello"); err != nil {
- return err
- }
- }
- return nil
-}
-
-func quit(g *gocui.Gui, v *gocui.View) error {
- return gocui.ErrQuit
-}
-```
-
-## Screenshots
-
-
-
-
-
-
-
-## Projects using gocui
-
-* [komanda-cli](https://github.com/mephux/komanda-cli): IRC Client For Developers.
-* [vuls](https://github.com/future-architect/vuls): Agentless vulnerability scanner for Linux/FreeBSD.
-* [wuzz](https://github.com/asciimoo/wuzz): Interactive cli tool for HTTP inspection.
-* [httplab](https://github.com/gchaincl/httplab): Interactive web server.
-* [domainr](https://github.com/MichaelThessel/domainr): Tool that checks the availability of domains based on keywords.
-* [gotime](https://github.com/nanohard/gotime): Time tracker for projects and tasks.
-* [claws](https://github.com/thehowl/claws): Interactive command line client for testing websockets.
-* [terminews](http://github.com/antavelos/terminews): Terminal based RSS reader.
-* [diagram](https://github.com/esimov/diagram): Tool to convert ascii arts into hand drawn diagrams.
-* [pody](https://github.com/JulienBreux/pody): CLI app to manage Pods in a Kubernetes cluster.
-* [kubexp](https://github.com/alitari/kubexp): Kubernetes client.
-* [kcli](https://github.com/cswank/kcli): Tool for inspecting kafka topics/partitions/messages.
-* [fac](https://github.com/mkchoi212/fac): git merge conflict resolver
-* [jsonui](https://github.com/gulyasm/jsonui): Interactive JSON explorer for your terminal.
-* [cointop](https://github.com/miguelmota/cointop): Interactive terminal based UI application for tracking cryptocurrencies.
-* [lazygit](https://github.com/jesseduffield/lazygit): simple terminal UI for git commands.
-* [lazydocker](https://github.com/jesseduffield/lazydocker): The lazier way to manage everything docker.
-
-Note: if your project is not listed here, let us know! :)
diff --git a/vendor/github.com/awesome-gocui/gocui/attribute.go b/vendor/github.com/awesome-gocui/gocui/attribute.go
deleted file mode 100644
index 3d986a712acbde82909a140e556f7e64868178b9..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/attribute.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2014 The gocui Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package gocui
-
-import "github.com/awesome-gocui/termbox-go"
-
-// Attribute represents a terminal attribute, like color, font style, etc. They
-// can be combined using bitwise OR (|). Note that it is not possible to
-// combine multiple color attributes.
-type Attribute termbox.Attribute
-
-// Color attributes.
-const (
- ColorDefault Attribute = Attribute(termbox.ColorDefault)
- ColorBlack = Attribute(termbox.ColorBlack)
- ColorRed = Attribute(termbox.ColorRed)
- ColorGreen = Attribute(termbox.ColorGreen)
- ColorYellow = Attribute(termbox.ColorYellow)
- ColorBlue = Attribute(termbox.ColorBlue)
- ColorMagenta = Attribute(termbox.ColorMagenta)
- ColorCyan = Attribute(termbox.ColorCyan)
- ColorWhite = Attribute(termbox.ColorWhite)
-)
-
-// Text style attributes.
-const (
- AttrBold Attribute = Attribute(termbox.AttrBold)
- AttrUnderline = Attribute(termbox.AttrUnderline)
- AttrReverse = Attribute(termbox.AttrReverse)
-)
diff --git a/vendor/github.com/awesome-gocui/gocui/doc.go b/vendor/github.com/awesome-gocui/gocui/doc.go
deleted file mode 100644
index ca7113fa5494351149825d89d21efd087a4ff7e0..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/doc.go
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2014 The gocui Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package gocui allows to create console user interfaces.
-
-Create a new GUI:
-
- g, err := gocui.NewGui(gocui.OutputNormal)
- if err != nil {
- // handle error
- }
- defer g.Close()
-
- // Set GUI managers and key bindings
- // ...
-
- if err := g.MainLoop(); err != nil && !gocui.IsQuit(err) {
- // handle error
- }
-
-Set GUI managers:
-
- g.SetManager(mgr1, mgr2)
-
-Managers are in charge of GUI's layout and can be used to build widgets. On
-each iteration of the GUI's main loop, the Layout function of each configured
-manager is executed. Managers are used to set-up and update the application's
-main views, being possible to freely change them during execution. Also, it is
-important to mention that a main loop iteration is executed on each reported
-event (key-press, mouse event, window resize, etc).
-
-GUIs are composed by Views, you can think of it as buffers. Views implement the
-io.ReadWriter interface, so you can just write to them if you want to modify
-their content. The same is valid for reading.
-
-Create and initialize a view with absolute coordinates:
-
- if v, err := g.SetView("viewname", 2, 2, 22, 7); err != nil {
- if !gocui.IsUnknownView(err) {
- // handle error
- }
- fmt.Fprintln(v, "This is a new view")
- // ...
- }
-
-Views can also be created using relative coordinates:
-
- maxX, maxY := g.Size()
- if v, err := g.SetView("viewname", maxX/2-30, maxY/2, maxX/2+30, maxY/2+2); err != nil {
- // ...
- }
-
-Configure keybindings:
-
- if err := g.SetKeybinding("viewname", gocui.KeyEnter, gocui.ModNone, fcn); err != nil {
- // handle error
- }
-
-gocui implements full mouse support that can be enabled with:
-
- g.Mouse = true
-
-Mouse events are handled like any other keybinding:
-
- if err := g.SetKeybinding("viewname", gocui.MouseLeft, gocui.ModNone, fcn); err != nil {
- // handle error
- }
-
-IMPORTANT: Views can only be created, destroyed or updated in three ways: from
-the Layout function within managers, from keybinding callbacks or via
-*Gui.Update(). The reason for this is that it allows gocui to be
-concurrent-safe. So, if you want to update your GUI from a goroutine, you must
-use *Gui.Update(). For example:
-
- g.Update(func(g *gocui.Gui) error {
- v, err := g.View("viewname")
- if err != nil {
- // handle error
- }
- v.Clear()
- fmt.Fprintln(v, "Writing from different goroutines")
- return nil
- })
-
-By default, gocui provides a basic editing mode. This mode can be extended
-and customized creating a new Editor and assigning it to *View.Editor:
-
- type Editor interface {
- Edit(v *View, key Key, ch rune, mod Modifier)
- }
-
-DefaultEditor can be taken as example to create your own custom Editor:
-
- var DefaultEditor Editor = EditorFunc(simpleEditor)
-
- func simpleEditor(v *View, key Key, ch rune, mod Modifier) {
- switch {
- case ch != 0 && mod == 0:
- v.EditWrite(ch)
- case key == KeySpace:
- v.EditWrite(' ')
- case key == KeyBackspace || key == KeyBackspace2:
- v.EditDelete(true)
- // ...
- }
- }
-
-Colored text:
-
-Views allow to add colored text using ANSI colors. For example:
-
- fmt.Fprintln(v, "\x1b[0;31mHello world")
-
-For more information, see the examples in folder "_examples/".
-*/
-package gocui
diff --git a/vendor/github.com/awesome-gocui/gocui/edit.go b/vendor/github.com/awesome-gocui/gocui/edit.go
deleted file mode 100644
index b5630df326120739aff498985892f2217f2b7940..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/edit.go
+++ /dev/null
@@ -1,449 +0,0 @@
-// Copyright 2014 The gocui Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package gocui
-
-import (
- "github.com/go-errors/errors"
-
- "github.com/mattn/go-runewidth"
-)
-
-const maxInt = int(^uint(0) >> 1)
-
-// Editor interface must be satisfied by gocui editors.
-type Editor interface {
- Edit(v *View, key Key, ch rune, mod Modifier)
-}
-
-// The EditorFunc type is an adapter to allow the use of ordinary functions as
-// Editors. If f is a function with the appropriate signature, EditorFunc(f)
-// is an Editor object that calls f.
-type EditorFunc func(v *View, key Key, ch rune, mod Modifier)
-
-// Edit calls f(v, key, ch, mod)
-func (f EditorFunc) Edit(v *View, key Key, ch rune, mod Modifier) {
- f(v, key, ch, mod)
-}
-
-// DefaultEditor is the default editor.
-var DefaultEditor Editor = EditorFunc(simpleEditor)
-
-// simpleEditor is used as the default gocui editor.
-func simpleEditor(v *View, key Key, ch rune, mod Modifier) {
- switch {
- case ch != 0 && mod == 0:
- v.EditWrite(ch)
- case key == KeySpace:
- v.EditWrite(' ')
- case key == KeyBackspace || key == KeyBackspace2:
- v.EditDelete(true)
- case key == KeyDelete:
- v.EditDelete(false)
- case key == KeyInsert:
- v.Overwrite = !v.Overwrite
- case key == KeyEnter:
- v.EditNewLine()
- case key == KeyArrowDown:
- v.MoveCursor(0, 1, false)
- case key == KeyArrowUp:
- v.MoveCursor(0, -1, false)
- case key == KeyArrowLeft:
- v.MoveCursor(-1, 0, false)
- case key == KeyArrowRight:
- v.MoveCursor(1, 0, false)
- case key == KeyTab:
- v.EditWrite('\t')
- case key == KeySpace:
- v.EditWrite(' ')
- case key == KeyInsert:
- v.Overwrite = !v.Overwrite
- default:
- v.EditWrite(ch)
- }
-}
-
-// EditWrite writes a rune at the cursor position.
-func (v *View) EditWrite(ch rune) {
- w := runewidth.RuneWidth(ch)
- v.writeRune(v.cx, v.cy, ch)
- v.moveCursor(w, 0, true)
-}
-
-// EditDeleteToStartOfLine is the equivalent of pressing ctrl+U in your terminal, it deletes to the start of the line. Or if you are already at the start of the line, it deletes the newline character
-func (v *View) EditDeleteToStartOfLine() {
- x, _ := v.Cursor()
- if x == 0 {
- v.EditDelete(true)
- } else {
- // delete characters until we are the start of the line
- for x > 0 {
- v.EditDelete(true)
- x, _ = v.Cursor()
- }
- }
-}
-
-// EditGotoToStartOfLine takes you to the start of the current line
-func (v *View) EditGotoToStartOfLine() {
- x, _ := v.Cursor()
- for x > 0 {
- v.MoveCursor(-1, 0, false)
- x, _ = v.Cursor()
- }
-}
-
-// EditGotoToEndOfLine takes you to the end of the line
-func (v *View) EditGotoToEndOfLine() {
- _, y := v.Cursor()
- _ = v.SetCursor(0, y+1)
- x, newY := v.Cursor()
- if newY == y {
- // we must be on the last line, so lets move to the very end
- prevX := -1
- for prevX != x {
- prevX = x
- v.MoveCursor(1, 0, false)
- x, _ = v.Cursor()
- }
- } else {
- // most left so now we're at the end of the original line
- v.MoveCursor(-1, 0, false)
- }
-}
-
-// EditDelete deletes a rune at the cursor position. back determines the
-// direction.
-func (v *View) EditDelete(back bool) {
- x, y := v.ox+v.cx, v.oy+v.cy
- if y < 0 {
- return
- } else if y >= len(v.viewLines) {
- v.MoveCursor(-1, 0, true)
- return
- }
-
- maxX, _ := v.Size()
- if back {
- if x == 0 { // start of the line
- if y < 1 {
- return
- }
-
- var maxPrevWidth int
- if v.Wrap {
- maxPrevWidth = maxX
- } else {
- maxPrevWidth = maxInt
- }
-
- if v.viewLines[y].linesX == 0 { // regular line
- v.mergeLines(v.cy - 1)
- if len(v.viewLines[y-1].line) < maxPrevWidth {
- v.MoveCursor(-1, 0, true)
- }
- } else { // wrapped line
- n, _ := v.deleteRune(len(v.viewLines[y-1].line)-1, v.cy-1)
- v.MoveCursor(-n, 0, true)
- }
- } else { // middle/end of the line
- n, _ := v.deleteRune(v.cx-1, v.cy)
- v.MoveCursor(-n, 0, true)
- }
- } else {
- if x == len(v.viewLines[y].line) { // end of the line
- v.mergeLines(v.cy)
- } else { // start/middle of the line
- v.deleteRune(v.cx, v.cy)
- }
- }
-}
-
-// EditNewLine inserts a new line under the cursor.
-func (v *View) EditNewLine() {
- v.breakLine(v.cx, v.cy)
- v.ox = 0
- v.cy = v.cy + 1
- v.cx = 0
-}
-
-// MoveCursor moves the cursor taking into account the width of the line/view,
-// displacing the origin if necessary.
-func (v *View) MoveCursor(dx, dy int, writeMode bool) {
- ox, oy := v.cx+v.ox, v.cy+v.oy
- x, y := ox+dx, oy+dy
-
- if y < 0 || y >= len(v.viewLines) {
- v.moveCursor(dx, dy, writeMode)
- return
- }
-
- // Removing newline.
- if x < 0 {
- var prevLen int
- if y-1 >= 0 && y-1 < len(v.viewLines) {
- prevLen = lineWidth(v.viewLines[y-1].line)
- }
-
- v.MoveCursor(prevLen, -1, writeMode)
- return
- }
-
- line := v.viewLines[y].line
- var col int
- var prevCol int
- for i := range line {
- prevCol = col
- col += runewidth.RuneWidth(line[i].chr)
- if dx > 0 {
- if x <= col {
- x = col
- break
- }
- continue
- }
-
- if x < col {
- x = prevCol
- break
- }
- }
-
- v.moveCursor(x-ox, y-oy, writeMode)
-}
-
-func (v *View) moveCursor(dx, dy int, writeMode bool) {
- maxX, maxY := v.Size()
- cx, cy := v.cx+dx, v.cy+dy
- x, y := v.ox+cx, v.oy+cy
-
- var curLineWidth, prevLineWidth int
- // get the width of the current line
- curLineWidth = maxInt
- if v.Wrap {
- curLineWidth = maxX - 1
- }
-
- if !writeMode {
- curLineWidth = 0
- if y >= 0 && y < len(v.viewLines) {
- curLineWidth = lineWidth(v.viewLines[y].line)
- if v.Wrap && curLineWidth >= maxX {
- curLineWidth = maxX - 1
- }
- }
- }
- // get the width of the previous line
- prevLineWidth = 0
- if y-1 >= 0 && y-1 < len(v.viewLines) {
- prevLineWidth = lineWidth(v.viewLines[y-1].line)
- }
- // adjust cursor's x position and view's x origin
- if x > curLineWidth { // move to next line
- if dx > 0 { // horizontal movement
- cy++
- if writeMode || v.oy+cy < len(v.viewLines) {
- if !v.Wrap {
- v.ox = 0
- }
- v.cx = 0
- }
- } else { // vertical movement
- if curLineWidth > 0 { // move cursor to the EOL
- if v.Wrap {
- v.cx = curLineWidth
- } else {
- ncx := curLineWidth - v.ox
- if ncx < 0 {
- v.ox += ncx
- if v.ox < 0 {
- v.ox = 0
- }
- v.cx = 0
- } else {
- v.cx = ncx
- }
- }
- } else {
- if writeMode || v.oy+cy < len(v.viewLines) {
- if !v.Wrap {
- v.ox = 0
- }
- v.cx = 0
- }
- }
- }
- } else if cx < 0 {
- if !v.Wrap && v.ox > 0 { // move origin to the left
- v.ox += cx
- v.cx = 0
- } else { // move to previous line
- cy--
- if prevLineWidth > 0 {
- if !v.Wrap { // set origin so the EOL is visible
- nox := prevLineWidth - maxX + 1
- if nox < 0 {
- nox = 0
- }
- v.ox = nox
- }
- v.cx = prevLineWidth
- } else {
- if !v.Wrap {
- v.ox = 0
- }
- v.cx = 0
- }
- }
- } else { // stay on the same line
- if v.Wrap {
- v.cx = cx
- } else {
- if cx >= maxX {
- v.ox += cx - maxX + 1
- v.cx = maxX
- } else {
- v.cx = cx
- }
- }
- }
-
- // adjust cursor's y position and view's y origin
- if cy < 0 {
- if v.oy > 0 {
- v.oy--
- }
- } else if writeMode || v.oy+cy < len(v.viewLines) {
- if cy >= maxY {
- v.oy++
- } else {
- v.cy = cy
- }
- }
-}
-
-// writeRune writes a rune into the view's internal buffer, at the
-// position corresponding to the point (x, y). The length of the internal
-// buffer is increased if the point is out of bounds. Overwrite mode is
-// governed by the value of View.overwrite.
-func (v *View) writeRune(x, y int, ch rune) error {
- v.tainted = true
-
- x, y, err := v.realPosition(x, y)
- if err != nil {
- return err
- }
-
- if x < 0 || y < 0 {
- return errors.New("invalid point")
- }
-
- if y >= len(v.lines) {
- s := make([][]cell, y-len(v.lines)+1)
- v.lines = append(v.lines, s...)
- }
-
- olen := len(v.lines[y])
-
- var s []cell
- if x >= len(v.lines[y]) {
- s = make([]cell, x-len(v.lines[y])+1)
- } else if !v.Overwrite {
- s = make([]cell, 1)
- }
- v.lines[y] = append(v.lines[y], s...)
-
- if !v.Overwrite || (v.Overwrite && x >= olen-1) {
- copy(v.lines[y][x+1:], v.lines[y][x:])
- }
- v.lines[y][x] = cell{
- fgColor: v.FgColor,
- bgColor: v.BgColor,
- chr: ch,
- }
-
- return nil
-}
-
-// deleteRune removes a rune from the view's internal buffer, at the
-// position corresponding to the point (x, y).
-// returns the amount of columns that where removed.
-func (v *View) deleteRune(x, y int) (int, error) {
- v.tainted = true
-
- x, y, err := v.realPosition(x, y)
- if err != nil {
- return 0, err
- }
-
- if x < 0 || y < 0 || y >= len(v.lines) || x >= len(v.lines[y]) {
- return 0, errors.New("invalid point")
- }
-
- var tw int
- for i := range v.lines[y] {
- w := runewidth.RuneWidth(v.lines[y][i].chr)
- tw += w
- if tw > x {
- v.lines[y] = append(v.lines[y][:i], v.lines[y][i+1:]...)
- return w, nil
- }
-
- }
-
- return 0, nil
-}
-
-// mergeLines merges the lines "y" and "y+1" if possible.
-func (v *View) mergeLines(y int) error {
- v.tainted = true
-
- _, y, err := v.realPosition(0, y)
- if err != nil {
- return err
- }
-
- if y < 0 || y >= len(v.lines) {
- return errors.New("invalid point")
- }
-
- if y < len(v.lines)-1 { // otherwise we don't need to merge anything
- v.lines[y] = append(v.lines[y], v.lines[y+1]...)
- v.lines = append(v.lines[:y+1], v.lines[y+2:]...)
- }
- return nil
-}
-
-// breakLine breaks a line of the internal buffer at the position corresponding
-// to the point (x, y).
-func (v *View) breakLine(x, y int) error {
- v.tainted = true
-
- x, y, err := v.realPosition(x, y)
- if err != nil {
- return err
- }
-
- if y < 0 || y >= len(v.lines) {
- return errors.New("invalid point")
- }
-
- var left, right []cell
- if x < len(v.lines[y]) { // break line
- left = make([]cell, len(v.lines[y][:x]))
- copy(left, v.lines[y][:x])
- right = make([]cell, len(v.lines[y][x:]))
- copy(right, v.lines[y][x:])
- } else { // new empty line
- left = v.lines[y]
- }
-
- lines := make([][]cell, len(v.lines)+1)
- lines[y] = left
- lines[y+1] = right
- copy(lines, v.lines[:y])
- copy(lines[y+2:], v.lines[y+1:])
- v.lines = lines
- return nil
-}
diff --git a/vendor/github.com/awesome-gocui/gocui/escape.go b/vendor/github.com/awesome-gocui/gocui/escape.go
deleted file mode 100644
index 6436080271870bea6028e08f00377294aee8098a..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/escape.go
+++ /dev/null
@@ -1,259 +0,0 @@
-// Copyright 2014 The gocui Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package gocui
-
-import (
- "strconv"
-
- "github.com/go-errors/errors"
-)
-
-type escapeInterpreter struct {
- state escapeState
- curch rune
- csiParam []string
- curFgColor, curBgColor Attribute
- mode OutputMode
-}
-
-type (
- escapeState int
- fontEffect int
-)
-
-const (
- stateNone escapeState = iota
- stateEscape
- stateCSI
- stateParams
-
- bold fontEffect = 1
- underline fontEffect = 4
- reverse fontEffect = 7
- setForegroundColor fontEffect = 38
- setBackgroundColor fontEffect = 48
-)
-
-var (
- errNotCSI = errors.New("Not a CSI escape sequence")
- errCSIParseError = errors.New("CSI escape sequence parsing error")
- errCSITooLong = errors.New("CSI escape sequence is too long")
-)
-
-// runes in case of error will output the non-parsed runes as a string.
-func (ei *escapeInterpreter) runes() []rune {
- switch ei.state {
- case stateNone:
- return []rune{0x1b}
- case stateEscape:
- return []rune{0x1b, ei.curch}
- case stateCSI:
- return []rune{0x1b, '[', ei.curch}
- case stateParams:
- ret := []rune{0x1b, '['}
- for _, s := range ei.csiParam {
- ret = append(ret, []rune(s)...)
- ret = append(ret, ';')
- }
- return append(ret, ei.curch)
- }
- return nil
-}
-
-// newEscapeInterpreter returns an escapeInterpreter that will be able to parse
-// terminal escape sequences.
-func newEscapeInterpreter(mode OutputMode) *escapeInterpreter {
- ei := &escapeInterpreter{
- state: stateNone,
- curFgColor: ColorDefault,
- curBgColor: ColorDefault,
- mode: mode,
- }
- return ei
-}
-
-// reset sets the escapeInterpreter in initial state.
-func (ei *escapeInterpreter) reset() {
- ei.state = stateNone
- ei.curFgColor = ColorDefault
- ei.curBgColor = ColorDefault
- ei.csiParam = nil
-}
-
-// parseOne parses a rune. If isEscape is true, it means that the rune is part
-// of an escape sequence, and as such should not be printed verbatim. Otherwise,
-// it's not an escape sequence.
-func (ei *escapeInterpreter) parseOne(ch rune) (isEscape bool, err error) {
- // Sanity checks
- if len(ei.csiParam) > 20 {
- return false, errCSITooLong
- }
- if len(ei.csiParam) > 0 && len(ei.csiParam[len(ei.csiParam)-1]) > 255 {
- return false, errCSITooLong
- }
-
- ei.curch = ch
-
- switch ei.state {
- case stateNone:
- if ch == 0x1b {
- ei.state = stateEscape
- return true, nil
- }
- return false, nil
- case stateEscape:
- if ch == '[' {
- ei.state = stateCSI
- return true, nil
- }
- return false, errNotCSI
- case stateCSI:
- switch {
- case ch >= '0' && ch <= '9':
- ei.csiParam = append(ei.csiParam, "")
- case ch == 'm':
- ei.csiParam = append(ei.csiParam, "0")
- default:
- return false, errCSIParseError
- }
- ei.state = stateParams
- fallthrough
- case stateParams:
- switch {
- case ch >= '0' && ch <= '9':
- ei.csiParam[len(ei.csiParam)-1] += string(ch)
- return true, nil
- case ch == ';':
- ei.csiParam = append(ei.csiParam, "")
- return true, nil
- case ch == 'm':
- var err error
- switch ei.mode {
- case OutputNormal:
- err = ei.outputNormal()
- case Output256:
- err = ei.output256()
- }
- if err != nil {
- return false, errCSIParseError
- }
-
- ei.state = stateNone
- ei.csiParam = nil
- return true, nil
- default:
- return false, errCSIParseError
- }
- }
- return false, nil
-}
-
-// outputNormal provides 8 different colors:
-// black, red, green, yellow, blue, magenta, cyan, white
-func (ei *escapeInterpreter) outputNormal() error {
- for _, param := range ei.csiParam {
- p, err := strconv.Atoi(param)
- if err != nil {
- return errCSIParseError
- }
-
- switch {
- case p >= 30 && p <= 37:
- ei.curFgColor = Attribute(p - 30 + 1)
- case p == 39:
- ei.curFgColor = ColorDefault
- case p >= 40 && p <= 47:
- ei.curBgColor = Attribute(p - 40 + 1)
- case p == 49:
- ei.curBgColor = ColorDefault
- case p == 1:
- ei.curFgColor |= AttrBold
- case p == 4:
- ei.curFgColor |= AttrUnderline
- case p == 7:
- ei.curFgColor |= AttrReverse
- case p == 0:
- ei.curFgColor = ColorDefault
- ei.curBgColor = ColorDefault
- }
- }
-
- return nil
-}
-
-// output256 allows you to leverage the 256-colors terminal mode:
-// 0x01 - 0x08: the 8 colors as in OutputNormal
-// 0x09 - 0x10: Color* | AttrBold
-// 0x11 - 0xe8: 216 different colors
-// 0xe9 - 0x1ff: 24 different shades of grey
-func (ei *escapeInterpreter) output256() error {
- if len(ei.csiParam) < 3 {
- return ei.outputNormal()
- }
-
- mode, err := strconv.Atoi(ei.csiParam[1])
- if err != nil {
- return errCSIParseError
- }
- if mode != 5 {
- return ei.outputNormal()
- }
-
- for _, param := range splitFgBg(ei.csiParam) {
- fgbg, err := strconv.Atoi(param[0])
- if err != nil {
- return errCSIParseError
- }
- color, err := strconv.Atoi(param[2])
- if err != nil {
- return errCSIParseError
- }
-
- switch fontEffect(fgbg) {
- case setForegroundColor:
- ei.curFgColor = Attribute(color + 1)
-
- for _, s := range param[3:] {
- p, err := strconv.Atoi(s)
- if err != nil {
- return errCSIParseError
- }
-
- switch fontEffect(p) {
- case bold:
- ei.curFgColor |= AttrBold
- case underline:
- ei.curFgColor |= AttrUnderline
- case reverse:
- ei.curFgColor |= AttrReverse
-
- }
- }
- case setBackgroundColor:
- ei.curBgColor = Attribute(color + 1)
- default:
- return errCSIParseError
- }
- }
- return nil
-}
-
-func splitFgBg(params []string) [][]string {
- var out [][]string
- var current []string
- for _, p := range params {
- if len(current) == 3 && (p == "48" || p == "38") {
- out = append(out, current)
- current = []string{}
- }
- current = append(current, p)
- }
-
- if len(current) > 0 {
- out = append(out, current)
- }
-
- return out
-}
diff --git a/vendor/github.com/awesome-gocui/gocui/go.mod b/vendor/github.com/awesome-gocui/gocui/go.mod
deleted file mode 100644
index 5791b4e42c7735e332d39f4d804527da71215623..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/go.mod
+++ /dev/null
@@ -1,9 +0,0 @@
-module github.com/awesome-gocui/gocui
-
-go 1.12
-
-require (
- github.com/awesome-gocui/termbox-go v0.0.0-20190427202837-c0aef3d18bcc
- github.com/go-errors/errors v1.0.1
- github.com/mattn/go-runewidth v0.0.4
-)
diff --git a/vendor/github.com/awesome-gocui/gocui/go.sum b/vendor/github.com/awesome-gocui/gocui/go.sum
deleted file mode 100644
index 25f1c0370ed96d4df1d0583425c7c82beaa1c5a6..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/go.sum
+++ /dev/null
@@ -1,6 +0,0 @@
-github.com/awesome-gocui/termbox-go v0.0.0-20190427202837-c0aef3d18bcc h1:wGNpKcHU8Aadr9yOzsT3GEsFLS7HQu8HxQIomnekqf0=
-github.com/awesome-gocui/termbox-go v0.0.0-20190427202837-c0aef3d18bcc/go.mod h1:tOy3o5Nf1bA17mnK4W41gD7PS3u4Cv0P0pqFcoWMy8s=
-github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
-github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
-github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
-github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
diff --git a/vendor/github.com/awesome-gocui/gocui/gui.go b/vendor/github.com/awesome-gocui/gocui/gui.go
deleted file mode 100644
index 6fe0d5d8c4aa107b864e08f77ce45ef5e05fb024..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/gui.go
+++ /dev/null
@@ -1,832 +0,0 @@
-// Copyright 2014 The gocui Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package gocui
-
-import (
- standardErrors "errors"
- "runtime"
-
- "github.com/go-errors/errors"
-
- "github.com/awesome-gocui/termbox-go"
-)
-
-// OutputMode represents the terminal's output mode (8 or 256 colors).
-type OutputMode termbox.OutputMode
-
-var (
- // ErrAlreadyBlacklisted is returned when the keybinding is already blacklisted.
- ErrAlreadyBlacklisted = standardErrors.New("keybind already blacklisted")
-
- // ErrBlacklisted is returned when the keybinding being parsed / used is blacklisted.
- ErrBlacklisted = standardErrors.New("keybind blacklisted")
-
- // ErrNotBlacklisted is returned when a keybinding being whitelisted is not blacklisted.
- ErrNotBlacklisted = standardErrors.New("keybind not blacklisted")
-
- // ErrNoSuchKeybind is returned when the keybinding being parsed does not exist.
- ErrNoSuchKeybind = standardErrors.New("no such keybind")
-
- // ErrUnknownView allows to assert if a View must be initialized.
- ErrUnknownView = standardErrors.New("unknown view")
-
- // ErrQuit is used to decide if the MainLoop finished successfully.
- ErrQuit = standardErrors.New("quit")
-)
-
-const (
- // OutputNormal provides 8-colors terminal mode.
- OutputNormal = OutputMode(termbox.OutputNormal)
-
- // Output256 provides 256-colors terminal mode.
- Output256 = OutputMode(termbox.Output256)
-
- // OutputGrayScale provides greyscale terminal mode.
- OutputGrayScale = OutputMode(termbox.OutputGrayscale)
-
- // Output216 provides greyscale terminal mode.
- Output216 = OutputMode(termbox.Output216)
-)
-
-// Gui represents the whole User Interface, including the views, layouts
-// and keybindings.
-type Gui struct {
- tbEvents chan termbox.Event
- userEvents chan userEvent
- views []*View
- currentView *View
- managers []Manager
- keybindings []*keybinding
- maxX, maxY int
- outputMode OutputMode
- stop chan struct{}
- blacklist []Key
-
- // BgColor and FgColor allow to configure the background and foreground
- // colors of the GUI.
- BgColor, FgColor, FrameColor Attribute
-
- // SelBgColor and SelFgColor allow to configure the background and
- // foreground colors of the frame of the current view.
- SelBgColor, SelFgColor, SelFrameColor Attribute
-
- // If Highlight is true, Sel{Bg,Fg}Colors will be used to draw the
- // frame of the current view.
- Highlight bool
-
- // If Cursor is true then the cursor is enabled.
- Cursor bool
-
- // If Mouse is true then mouse events will be enabled.
- Mouse bool
-
- // If InputEsc is true, when ESC sequence is in the buffer and it doesn't
- // match any known sequence, ESC means KeyEsc.
- InputEsc bool
-
- // If ASCII is true then use ASCII instead of unicode to draw the
- // interface. Using ASCII is more portable.
- ASCII bool
-
- // SupportOverlaps is true when we allow for view edges to overlap with other
- // view edges
- SupportOverlaps bool
-}
-
-// NewGui returns a new Gui object with a given output mode.
-func NewGui(mode OutputMode, supportOverlaps bool) (*Gui, error) {
- err := termbox.Init()
- if err != nil {
- return nil, err
- }
-
- g := &Gui{}
-
- g.outputMode = mode
- termbox.SetOutputMode(termbox.OutputMode(mode))
-
- g.stop = make(chan struct{})
-
- g.tbEvents = make(chan termbox.Event, 20)
- g.userEvents = make(chan userEvent, 20)
-
- if runtime.GOOS != "windows" {
- g.maxX, g.maxY, err = g.getTermWindowSize()
- if err != nil {
- return nil, err
- }
- } else {
- g.maxX, g.maxY = termbox.Size()
- }
-
- g.BgColor, g.FgColor = ColorDefault, ColorDefault
- g.SelBgColor, g.SelFgColor = ColorDefault, ColorDefault
-
- // SupportOverlaps is true when we allow for view edges to overlap with other
- // view edges
- g.SupportOverlaps = supportOverlaps
-
- return g, nil
-}
-
-// Close finalizes the library. It should be called after a successful
-// initialization and when gocui is not needed anymore.
-func (g *Gui) Close() {
- go func() {
- g.stop <- struct{}{}
- }()
- termbox.Close()
-}
-
-// Size returns the terminal's size.
-func (g *Gui) Size() (x, y int) {
- return g.maxX, g.maxY
-}
-
-// SetRune writes a rune at the given point, relative to the top-left
-// corner of the terminal. It checks if the position is valid and applies
-// the given colors.
-func (g *Gui) SetRune(x, y int, ch rune, fgColor, bgColor Attribute) error {
- if x < 0 || y < 0 || x >= g.maxX || y >= g.maxY {
- return errors.New("invalid point")
- }
- termbox.SetCell(x, y, ch, termbox.Attribute(fgColor), termbox.Attribute(bgColor))
- return nil
-}
-
-// Rune returns the rune contained in the cell at the given position.
-// It checks if the position is valid.
-func (g *Gui) Rune(x, y int) (rune, error) {
- if x < 0 || y < 0 || x >= g.maxX || y >= g.maxY {
- return ' ', errors.New("invalid point")
- }
- c := termbox.CellBuffer()[y*g.maxX+x]
- return c.Ch, nil
-}
-
-// SetView creates a new view with its top-left corner at (x0, y0)
-// and the bottom-right one at (x1, y1). If a view with the same name
-// already exists, its dimensions are updated; otherwise, the error
-// ErrUnknownView is returned, which allows to assert if the View must
-// be initialized. It checks if the position is valid.
-func (g *Gui) SetView(name string, x0, y0, x1, y1 int, overlaps byte) (*View, error) {
- if x0 >= x1 {
- return nil, errors.New("invalid dimensions")
- }
- if name == "" {
- return nil, errors.New("invalid name")
- }
-
- if v, err := g.View(name); err == nil {
- v.x0 = x0
- v.y0 = y0
- v.x1 = x1
- v.y1 = y1
- v.tainted = true
- return v, nil
- }
-
- v := newView(name, x0, y0, x1, y1, g.outputMode)
- v.BgColor, v.FgColor = g.BgColor, g.FgColor
- v.SelBgColor, v.SelFgColor = g.SelBgColor, g.SelFgColor
- v.Overlaps = overlaps
- g.views = append(g.views, v)
- return v, errors.Wrap(ErrUnknownView, 0)
-}
-
-// SetViewBeneath sets a view stacked beneath another view
-func (g *Gui) SetViewBeneath(name string, aboveViewName string, height int) (*View, error) {
- aboveView, err := g.View(aboveViewName)
- if err != nil {
- return nil, err
- }
-
- viewTop := aboveView.y1 + 1
- return g.SetView(name, aboveView.x0, viewTop, aboveView.x1, viewTop+height-1, 0)
-}
-
-// SetViewOnTop sets the given view on top of the existing ones.
-func (g *Gui) SetViewOnTop(name string) (*View, error) {
- for i, v := range g.views {
- if v.name == name {
- s := append(g.views[:i], g.views[i+1:]...)
- g.views = append(s, v)
- return v, nil
- }
- }
- return nil, errors.Wrap(ErrUnknownView, 0)
-}
-
-// SetViewOnBottom sets the given view on bottom of the existing ones.
-func (g *Gui) SetViewOnBottom(name string) (*View, error) {
- for i, v := range g.views {
- if v.name == name {
- s := append(g.views[:i], g.views[i+1:]...)
- g.views = append([]*View{v}, s...)
- return v, nil
- }
- }
- return nil, errors.Wrap(ErrUnknownView, 0)
-}
-
-// Views returns all the views in the GUI.
-func (g *Gui) Views() []*View {
- return g.views
-}
-
-// View returns a pointer to the view with the given name, or error
-// ErrUnknownView if a view with that name does not exist.
-func (g *Gui) View(name string) (*View, error) {
- for _, v := range g.views {
- if v.name == name {
- return v, nil
- }
- }
- return nil, errors.Wrap(ErrUnknownView, 0)
-}
-
-// ViewByPosition returns a pointer to a view matching the given position, or
-// error ErrUnknownView if a view in that position does not exist.
-func (g *Gui) ViewByPosition(x, y int) (*View, error) {
- // traverse views in reverse order checking top views first
- for i := len(g.views); i > 0; i-- {
- v := g.views[i-1]
- if x > v.x0 && x < v.x1 && y > v.y0 && y < v.y1 {
- return v, nil
- }
- }
- return nil, errors.Wrap(ErrUnknownView, 0)
-}
-
-// ViewPosition returns the coordinates of the view with the given name, or
-// error ErrUnknownView if a view with that name does not exist.
-func (g *Gui) ViewPosition(name string) (x0, y0, x1, y1 int, err error) {
- for _, v := range g.views {
- if v.name == name {
- return v.x0, v.y0, v.x1, v.y1, nil
- }
- }
- return 0, 0, 0, 0, errors.Wrap(ErrUnknownView, 0)
-}
-
-// DeleteView deletes a view by name.
-func (g *Gui) DeleteView(name string) error {
- for i, v := range g.views {
- if v.name == name {
- g.views = append(g.views[:i], g.views[i+1:]...)
- return nil
- }
- }
- return errors.Wrap(ErrUnknownView, 0)
-}
-
-// SetCurrentView gives the focus to a given view.
-func (g *Gui) SetCurrentView(name string) (*View, error) {
- for _, v := range g.views {
- if v.name == name {
- g.currentView = v
- return v, nil
- }
- }
- return nil, errors.Wrap(ErrUnknownView, 0)
-}
-
-// CurrentView returns the currently focused view, or nil if no view
-// owns the focus.
-func (g *Gui) CurrentView() *View {
- return g.currentView
-}
-
-// SetKeybinding creates a new keybinding. If viewname equals to ""
-// (empty string) then the keybinding will apply to all views. key must
-// be a rune or a Key.
-func (g *Gui) SetKeybinding(viewname string, key interface{}, mod Modifier, handler func(*Gui, *View) error) error {
- var kb *keybinding
-
- k, ch, err := getKey(key)
- if err != nil {
- return err
- }
-
- if g.isBlacklisted(k) {
- return ErrBlacklisted
- }
-
- kb = newKeybinding(viewname, k, ch, mod, handler)
- g.keybindings = append(g.keybindings, kb)
- return nil
-}
-
-// DeleteKeybinding deletes a keybinding.
-func (g *Gui) DeleteKeybinding(viewname string, key interface{}, mod Modifier) error {
- k, ch, err := getKey(key)
- if err != nil {
- return err
- }
-
- for i, kb := range g.keybindings {
- if kb.viewName == viewname && kb.ch == ch && kb.key == k && kb.mod == mod {
- g.keybindings = append(g.keybindings[:i], g.keybindings[i+1:]...)
- return nil
- }
- }
- return errors.New("keybinding not found")
-}
-
-// DeleteKeybindings deletes all keybindings of view.
-func (g *Gui) DeleteKeybindings(viewname string) {
- var s []*keybinding
- for _, kb := range g.keybindings {
- if kb.viewName != viewname {
- s = append(s, kb)
- }
- }
- g.keybindings = s
-}
-
-// BlackListKeybinding adds a keybinding to the blacklist
-func (g *Gui) BlacklistKeybinding(k Key) error {
- for _, j := range g.blacklist {
- if j == k {
- return ErrAlreadyBlacklisted
- }
- }
- g.blacklist = append(g.blacklist, k)
- return nil
-}
-
-// WhiteListKeybinding removes a keybinding from the blacklist
-func (g *Gui) WhitelistKeybinding(k Key) error {
- for i, j := range g.blacklist {
- if j == k {
- g.blacklist = append(g.blacklist[:i], g.blacklist[i+1:]...)
- return nil
- }
- }
- return ErrNotBlacklisted
-}
-
-// getKey takes an empty interface with a key and returns the corresponding
-// typed Key or rune.
-func getKey(key interface{}) (Key, rune, error) {
- switch t := key.(type) {
- case Key:
- return t, 0, nil
- case rune:
- return 0, t, nil
- default:
- return 0, 0, errors.New("unknown type")
- }
-}
-
-// userEvent represents an event triggered by the user.
-type userEvent struct {
- f func(*Gui) error
-}
-
-// Update executes the passed function. This method can be called safely from a
-// goroutine in order to update the GUI. It is important to note that the
-// passed function won't be executed immediately, instead it will be added to
-// the user events queue. Given that Update spawns a goroutine, the order in
-// which the user events will be handled is not guaranteed.
-func (g *Gui) Update(f func(*Gui) error) {
- go func() { g.userEvents <- userEvent{f: f} }()
-}
-
-// A Manager is in charge of GUI's layout and can be used to build widgets.
-type Manager interface {
- // Layout is called every time the GUI is redrawn, it must contain the
- // base views and its initializations.
- Layout(*Gui) error
-}
-
-// The ManagerFunc type is an adapter to allow the use of ordinary functions as
-// Managers. If f is a function with the appropriate signature, ManagerFunc(f)
-// is an Manager object that calls f.
-type ManagerFunc func(*Gui) error
-
-// Layout calls f(g)
-func (f ManagerFunc) Layout(g *Gui) error {
- return f(g)
-}
-
-// SetManager sets the given GUI managers. It deletes all views and
-// keybindings.
-func (g *Gui) SetManager(managers ...Manager) {
- g.managers = managers
- g.currentView = nil
- g.views = nil
- g.keybindings = nil
-
- go func() { g.tbEvents <- termbox.Event{Type: termbox.EventResize} }()
-}
-
-// SetManagerFunc sets the given manager function. It deletes all views and
-// keybindings.
-func (g *Gui) SetManagerFunc(manager func(*Gui) error) {
- g.SetManager(ManagerFunc(manager))
-}
-
-// MainLoop runs the main loop until an error is returned. A successful
-// finish should return ErrQuit.
-func (g *Gui) MainLoop() error {
- g.loaderTick()
- if err := g.flush(); err != nil {
- return err
- }
-
- go func() {
- for {
- select {
- case <-g.stop:
- return
- default:
- g.tbEvents <- termbox.PollEvent()
- }
- }
- }()
-
- inputMode := termbox.InputAlt
- if true { // previously g.InputEsc, but didn't seem to work
- inputMode = termbox.InputEsc
- }
- if g.Mouse {
- inputMode |= termbox.InputMouse
- }
- termbox.SetInputMode(inputMode)
-
- if err := g.flush(); err != nil {
- return err
- }
- for {
- select {
- case ev := <-g.tbEvents:
- if err := g.handleEvent(&ev); err != nil {
- return err
- }
- case ev := <-g.userEvents:
- if err := ev.f(g); err != nil {
- return err
- }
- }
- if err := g.consumeevents(); err != nil {
- return err
- }
- if err := g.flush(); err != nil {
- return err
- }
- }
-}
-
-// consumeevents handles the remaining events in the events pool.
-func (g *Gui) consumeevents() error {
- for {
- select {
- case ev := <-g.tbEvents:
- if err := g.handleEvent(&ev); err != nil {
- return err
- }
- case ev := <-g.userEvents:
- if err := ev.f(g); err != nil {
- return err
- }
- default:
- return nil
- }
- }
-}
-
-// handleEvent handles an event, based on its type (key-press, error,
-// etc.)
-func (g *Gui) handleEvent(ev *termbox.Event) error {
- switch ev.Type {
- case termbox.EventKey, termbox.EventMouse:
- return g.onKey(ev)
- case termbox.EventError:
- return ev.Err
- default:
- return nil
- }
-}
-
-// flush updates the gui, re-drawing frames and buffers.
-func (g *Gui) flush() error {
- termbox.Clear(termbox.Attribute(g.FgColor), termbox.Attribute(g.BgColor))
-
- maxX, maxY := termbox.Size()
- // if GUI's size has changed, we need to redraw all views
- if maxX != g.maxX || maxY != g.maxY {
- for _, v := range g.views {
- v.tainted = true
- }
- }
- g.maxX, g.maxY = maxX, maxY
-
- for _, m := range g.managers {
- if err := m.Layout(g); err != nil {
- return err
- }
- }
- for _, v := range g.views {
- if !v.Visible || v.y1 < v.y0 {
- continue
- }
- if v.Frame {
- var fgColor, bgColor, frameColor Attribute
- if g.Highlight && v == g.currentView {
- fgColor = g.SelFgColor
- bgColor = g.SelBgColor
- frameColor = g.SelFrameColor
- } else {
- fgColor = g.FgColor
- bgColor = g.BgColor
- frameColor = g.FrameColor
- }
-
- if err := g.drawFrameEdges(v, frameColor, bgColor); err != nil {
- return err
- }
- if err := g.drawFrameCorners(v, frameColor, bgColor); err != nil {
- return err
- }
- if v.Title != "" {
- if err := g.drawTitle(v, fgColor, bgColor); err != nil {
- return err
- }
- }
- if v.Subtitle != "" {
- if err := g.drawSubtitle(v, fgColor, bgColor); err != nil {
- return err
- }
- }
- }
- if err := g.draw(v); err != nil {
- return err
- }
- }
- termbox.Flush()
- return nil
-}
-
-// drawFrameEdges draws the horizontal and vertical edges of a view.
-func (g *Gui) drawFrameEdges(v *View, fgColor, bgColor Attribute) error {
- runeH, runeV := '─', '│'
- if g.ASCII {
- runeH, runeV = '-', '|'
- }
-
- for x := v.x0 + 1; x < v.x1 && x < g.maxX; x++ {
- if x < 0 {
- continue
- }
- if v.y0 > -1 && v.y0 < g.maxY {
- if err := g.SetRune(x, v.y0, runeH, fgColor, bgColor); err != nil {
- return err
- }
- }
- if v.y1 > -1 && v.y1 < g.maxY {
- if err := g.SetRune(x, v.y1, runeH, fgColor, bgColor); err != nil {
- return err
- }
- }
- }
- for y := v.y0 + 1; y < v.y1 && y < g.maxY; y++ {
- if y < 0 {
- continue
- }
- if v.x0 > -1 && v.x0 < g.maxX {
- if err := g.SetRune(v.x0, y, runeV, fgColor, bgColor); err != nil {
- return err
- }
- }
- if v.x1 > -1 && v.x1 < g.maxX {
- if err := g.SetRune(v.x1, y, runeV, fgColor, bgColor); err != nil {
- return err
- }
- }
- }
- return nil
-}
-
-func cornerRune(index byte) rune {
- return []rune{' ', '│', '│', '│', '─', '┘', '┐', '┤', '─', '└', '┌', '├', '├', '┴', '┬', '┼'}[index]
-}
-
-func corner(v *View, directions byte) rune {
- index := v.Overlaps | directions
- return cornerRune(index)
-}
-
-// drawFrameCorners draws the corners of the view.
-func (g *Gui) drawFrameCorners(v *View, fgColor, bgColor Attribute) error {
- if v.y0 == v.y1 {
- if !g.SupportOverlaps && v.x0 >= 0 && v.x1 >= 0 && v.y0 >= 0 && v.x0 < g.maxX && v.x1 < g.maxX && v.y0 < g.maxY {
- if err := g.SetRune(v.x0, v.y0, '╶', fgColor, bgColor); err != nil {
- return err
- }
- if err := g.SetRune(v.x1, v.y0, '╴', fgColor, bgColor); err != nil {
- return err
- }
- }
- return nil
- }
-
- runeTL, runeTR, runeBL, runeBR := '┌', '┐', '└', '┘'
- if g.SupportOverlaps {
- runeTL = corner(v, BOTTOM|RIGHT)
- runeTR = corner(v, BOTTOM|LEFT)
- runeBL = corner(v, TOP|RIGHT)
- runeBR = corner(v, TOP|LEFT)
- }
- if g.ASCII {
- runeTL, runeTR, runeBL, runeBR = '+', '+', '+', '+'
- }
-
- corners := []struct {
- x, y int
- ch rune
- }{{v.x0, v.y0, runeTL}, {v.x1, v.y0, runeTR}, {v.x0, v.y1, runeBL}, {v.x1, v.y1, runeBR}}
-
- for _, c := range corners {
- if c.x >= 0 && c.y >= 0 && c.x < g.maxX && c.y < g.maxY {
- if err := g.SetRune(c.x, c.y, c.ch, fgColor, bgColor); err != nil {
- return err
- }
- }
- }
- return nil
-}
-
-// drawTitle draws the title of the view.
-func (g *Gui) drawTitle(v *View, fgColor, bgColor Attribute) error {
- if v.y0 < 0 || v.y0 >= g.maxY {
- return nil
- }
-
- for i, ch := range v.Title {
- x := v.x0 + i + 2
- if x < 0 {
- continue
- } else if x > v.x1-2 || x >= g.maxX {
- break
- }
- if err := g.SetRune(x, v.y0, ch, fgColor, bgColor); err != nil {
- return err
- }
- }
- return nil
-}
-
-// drawSubtitle draws the subtitle of the view.
-func (g *Gui) drawSubtitle(v *View, fgColor, bgColor Attribute) error {
- if v.y0 < 0 || v.y0 >= g.maxY {
- return nil
- }
-
- start := v.x1 - 5 - len(v.Subtitle)
- if start < v.x0 {
- return nil
- }
- for i, ch := range v.Subtitle {
- x := start + i
- if x >= v.x1 {
- break
- }
- if err := g.SetRune(x, v.y0, ch, fgColor, bgColor); err != nil {
- return err
- }
- }
- return nil
-}
-
-// draw manages the cursor and calls the draw function of a view.
-func (g *Gui) draw(v *View) error {
- if g.Cursor {
- if curview := g.currentView; curview != nil {
- vMaxX, vMaxY := curview.Size()
- if curview.cx < 0 {
- curview.cx = 0
- } else if curview.cx >= vMaxX {
- curview.cx = vMaxX - 1
- }
- if curview.cy < 0 {
- curview.cy = 0
- } else if curview.cy >= vMaxY {
- curview.cy = vMaxY - 1
- }
-
- gMaxX, gMaxY := g.Size()
- cx, cy := curview.x0+curview.cx+1, curview.y0+curview.cy+1
- if cx >= 0 && cx < gMaxX && cy >= 0 && cy < gMaxY {
- termbox.SetCursor(cx, cy)
- } else {
- termbox.HideCursor()
- }
- }
- } else {
- termbox.HideCursor()
- }
-
- v.clearRunes()
- if err := v.draw(); err != nil {
- return err
- }
- return nil
-}
-
-// onKey manages key-press events. A keybinding handler is called when
-// a key-press or mouse event satisfies a configured keybinding. Furthermore,
-// currentView's internal buffer is modified if currentView.Editable is true.
-func (g *Gui) onKey(ev *termbox.Event) error {
- switch ev.Type {
- case termbox.EventKey:
- matched, err := g.execKeybindings(g.currentView, ev)
- if err != nil {
- return err
- }
- if matched {
- break
- }
- if g.currentView != nil && g.currentView.Editable && g.currentView.Editor != nil {
- g.currentView.Editor.Edit(g.currentView, Key(ev.Key), ev.Ch, Modifier(ev.Mod))
- }
- case termbox.EventMouse:
- mx, my := ev.MouseX, ev.MouseY
- v, err := g.ViewByPosition(mx, my)
- if err != nil {
- break
- }
- if err := v.SetCursor(mx-v.x0-1, my-v.y0-1); err != nil {
- return err
- }
- if _, err := g.execKeybindings(v, ev); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// execKeybindings executes the keybinding handlers that match the passed view
-// and event. The value of matched is true if there is a match and no errors.
-func (g *Gui) execKeybindings(v *View, ev *termbox.Event) (matched bool, err error) {
- var globalKb *keybinding
-
- for _, kb := range g.keybindings {
- if kb.handler == nil {
- continue
- }
-
- if !kb.matchKeypress(Key(ev.Key), ev.Ch, Modifier(ev.Mod)) {
- continue
- }
-
- if kb.matchView(v) {
- return g.execKeybinding(v, kb)
- }
-
- if kb.viewName == "" && ((v != nil && !v.Editable) || kb.ch == 0) {
- globalKb = kb
- }
- }
-
- if globalKb != nil {
- return g.execKeybinding(v, globalKb)
- }
-
- return false, nil
-}
-
-// execKeybinding executes a given keybinding
-func (g *Gui) execKeybinding(v *View, kb *keybinding) (bool, error) {
- if g.isBlacklisted(kb.key) {
- return true, nil
- }
-
- if err := kb.handler(g, v); err != nil {
- return false, err
- }
- return true, nil
-}
-
-// isBlacklisted reports whether the key is blacklisted
-func (g *Gui) isBlacklisted(k Key) bool {
- for _, j := range g.blacklist {
- if j == k {
- return true
- }
- }
- return false
-}
-
-// IsUnknownView reports whether the contents of an error is "unknown view".
-func IsUnknownView(err error) bool {
- return err != nil && err.Error() == ErrUnknownView.Error()
-}
-
-// IsQuit reports whether the contents of an error is "quit".
-func IsQuit(err error) bool {
- return err != nil && err.Error() == ErrQuit.Error()
-}
diff --git a/vendor/github.com/awesome-gocui/gocui/gui_others.go b/vendor/github.com/awesome-gocui/gocui/gui_others.go
deleted file mode 100644
index 5d247a191d107c52da21609cef5642080b76621f..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/gui_others.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 The gocui Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !windows
-
-package gocui
-
-import (
- "os"
- "os/signal"
- "syscall"
- "unsafe"
-
- "github.com/go-errors/errors"
-)
-
-// getTermWindowSize is get terminal window size on linux or unix.
-// When gocui run inside the docker contaienr need to check and get the window size.
-func (g *Gui) getTermWindowSize() (int, int, error) {
- var sz struct {
- rows uint16
- cols uint16
- _ [2]uint16 // to match underlying syscall; see https://github.com/awesome-gocui/gocui/issues/33
- }
-
- var termw, termh int
-
- out, err := os.OpenFile("/dev/tty", os.O_RDWR, 0)
- if err != nil {
- return 0, 0, err
- }
- defer out.Close()
-
- signalCh := make(chan os.Signal, 1)
- signal.Notify(signalCh, syscall.SIGWINCH, syscall.SIGINT)
-
- for {
- _, _, _ = syscall.Syscall(syscall.SYS_IOCTL,
- out.Fd(), uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&sz)))
-
- // check terminal window size
- termw, termh = int(sz.cols), int(sz.rows)
- if termw > 0 && termh > 0 {
- return termw, termh, nil
- }
-
- select {
- case signal := <-signalCh:
- switch signal {
- // when the terminal window size is changed
- case syscall.SIGWINCH:
- continue
- // ctrl + c to cancel
- case syscall.SIGINT:
- return 0, 0, errors.New("stop to get term window size")
- }
- }
- }
-}
diff --git a/vendor/github.com/awesome-gocui/gocui/gui_windows.go b/vendor/github.com/awesome-gocui/gocui/gui_windows.go
deleted file mode 100644
index db1faab7dfa46adc186399a11c243be46ea435df..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/gui_windows.go
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2014 The gocui Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build windows
-
-package gocui
-
-import (
- "os"
- "syscall"
- "unsafe"
-)
-
-type wchar uint16
-type short int16
-type dword uint32
-type word uint16
-
-type coord struct {
- x short
- y short
-}
-
-type smallRect struct {
- left short
- top short
- right short
- bottom short
-}
-
-type consoleScreenBufferInfo struct {
- size coord
- cursorPosition coord
- attributes word
- window smallRect
- maximumWindowSize coord
-}
-
-var (
- kernel32 = syscall.NewLazyDLL("kernel32.dll")
- procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
-)
-
-// getTermWindowSize is get terminal window size on windows.
-func (g *Gui) getTermWindowSize() (int, int, error) {
- var csbi consoleScreenBufferInfo
- r1, _, err := procGetConsoleScreenBufferInfo.Call(os.Stdout.Fd(), uintptr(unsafe.Pointer(&csbi)))
- if r1 == 0 {
- return 0, 0, err
- }
- return int(csbi.window.right - csbi.window.left + 1), int(csbi.window.bottom - csbi.window.top + 1), nil
-}
diff --git a/vendor/github.com/awesome-gocui/gocui/keybinding.go b/vendor/github.com/awesome-gocui/gocui/keybinding.go
deleted file mode 100644
index d294e70de599fd9eb149b919cfe4cc073e111e2b..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/keybinding.go
+++ /dev/null
@@ -1,285 +0,0 @@
-// Copyright 2014 The gocui Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package gocui
-
-import (
- "strings"
-
- "github.com/awesome-gocui/termbox-go"
-)
-
-// Key represents special keys or keys combinations.
-type Key termbox.Key
-
-// Modifier allows to define special keys combinations. They can be used
-// in combination with Keys or Runes when a new keybinding is defined.
-type Modifier termbox.Modifier
-
-// Keybidings are used to link a given key-press event with a handler.
-type keybinding struct {
- viewName string
- key Key
- ch rune
- mod Modifier
- handler func(*Gui, *View) error
-}
-
-// Parse takes the input string and extracts the keybinding.
-// Returns a Key / rune, a Modifier and an error.
-func Parse(input string) (interface{}, Modifier, error) {
- if len(input) == 1 {
- _, r, err := getKey(rune(input[0]))
- if err != nil {
- return nil, ModNone, err
- }
- return r, ModNone, nil
- }
-
- var modifier Modifier
- cleaned := make([]string, 0)
-
- tokens := strings.Split(input, "+")
- for _, t := range tokens {
- normalized := strings.Title(strings.ToLower(t))
- if t == "Alt" {
- modifier = ModAlt
- continue
- }
- cleaned = append(cleaned, normalized)
- }
-
- key, exist := translate[strings.Join(cleaned, "")]
- if !exist {
- return nil, ModNone, ErrNoSuchKeybind
- }
-
- return key, modifier, nil
-}
-
-// ParseAll takes an array of strings and returns a map of all keybindings.
-func ParseAll(input []string) (map[interface{}]Modifier, error) {
- ret := make(map[interface{}]Modifier)
- for _, i := range input {
- k, m, err := Parse(i)
- if err != nil {
- return ret, err
- }
- ret[k] = m
- }
- return ret, nil
-}
-
-// MustParse takes the input string and returns a Key / rune and a Modifier.
-// It will panic if any error occured.
-func MustParse(input string) (interface{}, Modifier) {
- k, m, err := Parse(input)
- if err != nil {
- panic(err)
- }
- return k, m
-}
-
-// MustParseAll takes an array of strings and returns a map of all keybindings.
-// It will panic if any error occured.
-func MustParseAll(input []string) map[interface{}]Modifier {
- result, err := ParseAll(input)
- if err != nil {
- panic(err)
- }
- return result
-}
-
-// newKeybinding returns a new Keybinding object.
-func newKeybinding(viewname string, key Key, ch rune, mod Modifier, handler func(*Gui, *View) error) (kb *keybinding) {
- kb = &keybinding{
- viewName: viewname,
- key: key,
- ch: ch,
- mod: mod,
- handler: handler,
- }
- return kb
-}
-
-// matchKeypress returns if the keybinding matches the keypress.
-func (kb *keybinding) matchKeypress(key Key, ch rune, mod Modifier) bool {
- return kb.key == key && kb.ch == ch && kb.mod == mod
-}
-
-// matchView returns if the keybinding matches the current view.
-func (kb *keybinding) matchView(v *View) bool {
- // if the user is typing in a field, ignore char keys
- if v == nil || (v.Editable && kb.ch != 0) {
- return false
- }
- return kb.viewName == v.name
-}
-
-// translations for strings to keys
-var translate = map[string]Key{
- "F1": KeyF1,
- "F2": KeyF2,
- "F3": KeyF3,
- "F4": KeyF4,
- "F5": KeyF5,
- "F6": KeyF6,
- "F7": KeyF7,
- "F8": KeyF8,
- "F9": KeyF9,
- "F10": KeyF10,
- "F11": KeyF11,
- "F12": KeyF12,
- "Insert": KeyInsert,
- "Delete": KeyDelete,
- "Home": KeyHome,
- "End": KeyEnd,
- "Pgup": KeyPgup,
- "Pgdn": KeyPgdn,
- "ArrowUp": KeyArrowUp,
- "ArrowDown": KeyArrowDown,
- "ArrowLeft": KeyArrowLeft,
- "ArrowRight": KeyArrowRight,
- "CtrlTilde": KeyCtrlTilde,
- "Ctrl2": KeyCtrl2,
- "CtrlSpace": KeyCtrlSpace,
- "CtrlA": KeyCtrlA,
- "CtrlB": KeyCtrlB,
- "CtrlC": KeyCtrlC,
- "CtrlD": KeyCtrlD,
- "CtrlE": KeyCtrlE,
- "CtrlF": KeyCtrlF,
- "CtrlG": KeyCtrlG,
- "Backspace": KeyBackspace,
- "CtrlH": KeyCtrlH,
- "Tab": KeyTab,
- "CtrlI": KeyCtrlI,
- "CtrlJ": KeyCtrlJ,
- "CtrlK": KeyCtrlK,
- "CtrlL": KeyCtrlL,
- "Enter": KeyEnter,
- "CtrlM": KeyCtrlM,
- "CtrlN": KeyCtrlN,
- "CtrlO": KeyCtrlO,
- "CtrlP": KeyCtrlP,
- "CtrlQ": KeyCtrlQ,
- "CtrlR": KeyCtrlR,
- "CtrlS": KeyCtrlS,
- "CtrlT": KeyCtrlT,
- "CtrlU": KeyCtrlU,
- "CtrlV": KeyCtrlV,
- "CtrlW": KeyCtrlW,
- "CtrlX": KeyCtrlX,
- "CtrlY": KeyCtrlY,
- "CtrlZ": KeyCtrlZ,
- "Esc": KeyEsc,
- "CtrlLsqBracket": KeyCtrlLsqBracket,
- "Ctrl3": KeyCtrl3,
- "Ctrl4": KeyCtrl4,
- "CtrlBackslash": KeyCtrlBackslash,
- "Ctrl5": KeyCtrl5,
- "CtrlRsqBracket": KeyCtrlRsqBracket,
- "Ctrl6": KeyCtrl6,
- "Ctrl7": KeyCtrl7,
- "CtrlSlash": KeyCtrlSlash,
- "CtrlUnderscore": KeyCtrlUnderscore,
- "Space": KeySpace,
- "Backspace2": KeyBackspace2,
- "Ctrl8": KeyCtrl8,
- "Mouseleft": MouseLeft,
- "Mousemiddle": MouseMiddle,
- "Mouseright": MouseRight,
- "Mouserelease": MouseRelease,
- "MousewheelUp": MouseWheelUp,
- "MousewheelDown": MouseWheelDown,
-}
-
-// Special keys.
-const (
- KeyF1 Key = Key(termbox.KeyF1)
- KeyF2 = Key(termbox.KeyF2)
- KeyF3 = Key(termbox.KeyF3)
- KeyF4 = Key(termbox.KeyF4)
- KeyF5 = Key(termbox.KeyF5)
- KeyF6 = Key(termbox.KeyF6)
- KeyF7 = Key(termbox.KeyF7)
- KeyF8 = Key(termbox.KeyF8)
- KeyF9 = Key(termbox.KeyF9)
- KeyF10 = Key(termbox.KeyF10)
- KeyF11 = Key(termbox.KeyF11)
- KeyF12 = Key(termbox.KeyF12)
- KeyInsert = Key(termbox.KeyInsert)
- KeyDelete = Key(termbox.KeyDelete)
- KeyHome = Key(termbox.KeyHome)
- KeyEnd = Key(termbox.KeyEnd)
- KeyPgup = Key(termbox.KeyPgup)
- KeyPgdn = Key(termbox.KeyPgdn)
- KeyArrowUp = Key(termbox.KeyArrowUp)
- KeyArrowDown = Key(termbox.KeyArrowDown)
- KeyArrowLeft = Key(termbox.KeyArrowLeft)
- KeyArrowRight = Key(termbox.KeyArrowRight)
-
- MouseLeft = Key(termbox.MouseLeft)
- MouseMiddle = Key(termbox.MouseMiddle)
- MouseRight = Key(termbox.MouseRight)
- MouseRelease = Key(termbox.MouseRelease)
- MouseWheelUp = Key(termbox.MouseWheelUp)
- MouseWheelDown = Key(termbox.MouseWheelDown)
-)
-
-// Keys combinations.
-const (
- KeyCtrlTilde Key = Key(termbox.KeyCtrlTilde)
- KeyCtrl2 = Key(termbox.KeyCtrl2)
- KeyCtrlSpace = Key(termbox.KeyCtrlSpace)
- KeyCtrlA = Key(termbox.KeyCtrlA)
- KeyCtrlB = Key(termbox.KeyCtrlB)
- KeyCtrlC = Key(termbox.KeyCtrlC)
- KeyCtrlD = Key(termbox.KeyCtrlD)
- KeyCtrlE = Key(termbox.KeyCtrlE)
- KeyCtrlF = Key(termbox.KeyCtrlF)
- KeyCtrlG = Key(termbox.KeyCtrlG)
- KeyBackspace = Key(termbox.KeyBackspace)
- KeyCtrlH = Key(termbox.KeyCtrlH)
- KeyTab = Key(termbox.KeyTab)
- KeyCtrlI = Key(termbox.KeyCtrlI)
- KeyCtrlJ = Key(termbox.KeyCtrlJ)
- KeyCtrlK = Key(termbox.KeyCtrlK)
- KeyCtrlL = Key(termbox.KeyCtrlL)
- KeyEnter = Key(termbox.KeyEnter)
- KeyCtrlM = Key(termbox.KeyCtrlM)
- KeyCtrlN = Key(termbox.KeyCtrlN)
- KeyCtrlO = Key(termbox.KeyCtrlO)
- KeyCtrlP = Key(termbox.KeyCtrlP)
- KeyCtrlQ = Key(termbox.KeyCtrlQ)
- KeyCtrlR = Key(termbox.KeyCtrlR)
- KeyCtrlS = Key(termbox.KeyCtrlS)
- KeyCtrlT = Key(termbox.KeyCtrlT)
- KeyCtrlU = Key(termbox.KeyCtrlU)
- KeyCtrlV = Key(termbox.KeyCtrlV)
- KeyCtrlW = Key(termbox.KeyCtrlW)
- KeyCtrlX = Key(termbox.KeyCtrlX)
- KeyCtrlY = Key(termbox.KeyCtrlY)
- KeyCtrlZ = Key(termbox.KeyCtrlZ)
- KeyEsc = Key(termbox.KeyEsc)
- KeyCtrlLsqBracket = Key(termbox.KeyCtrlLsqBracket)
- KeyCtrl3 = Key(termbox.KeyCtrl3)
- KeyCtrl4 = Key(termbox.KeyCtrl4)
- KeyCtrlBackslash = Key(termbox.KeyCtrlBackslash)
- KeyCtrl5 = Key(termbox.KeyCtrl5)
- KeyCtrlRsqBracket = Key(termbox.KeyCtrlRsqBracket)
- KeyCtrl6 = Key(termbox.KeyCtrl6)
- KeyCtrl7 = Key(termbox.KeyCtrl7)
- KeyCtrlSlash = Key(termbox.KeyCtrlSlash)
- KeyCtrlUnderscore = Key(termbox.KeyCtrlUnderscore)
- KeySpace = Key(termbox.KeySpace)
- KeyBackspace2 = Key(termbox.KeyBackspace2)
- KeyCtrl8 = Key(termbox.KeyCtrl8)
-)
-
-// Modifiers.
-const (
- ModNone Modifier = Modifier(0)
- ModAlt = Modifier(termbox.ModAlt)
-)
diff --git a/vendor/github.com/awesome-gocui/gocui/loader.go b/vendor/github.com/awesome-gocui/gocui/loader.go
deleted file mode 100644
index d6715ac6d6a3e29de72f355b2c0e8e39fd664b7d..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/loader.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package gocui
-
-import "time"
-
-func (g *Gui) loaderTick() {
- go func() {
- for range time.Tick(time.Millisecond * 50) {
- for _, view := range g.Views() {
- if view.HasLoader {
- g.userEvents <- userEvent{func(g *Gui) error { return nil }}
- break
- }
- }
- }
- }()
-}
-
-func (v *View) loaderLines() [][]cell {
- duplicate := make([][]cell, len(v.lines))
- for i := range v.lines {
- if i < len(v.lines)-1 {
- duplicate[i] = make([]cell, len(v.lines[i]))
- copy(duplicate[i], v.lines[i])
- } else {
- duplicate[i] = make([]cell, len(v.lines[i])+2)
- copy(duplicate[i], v.lines[i])
- duplicate[i][len(duplicate[i])-2] = cell{chr: ' '}
- duplicate[i][len(duplicate[i])-1] = Loader()
- }
- }
-
- return duplicate
-}
-
-// Loader can show a loading animation
-func Loader() cell {
- characters := "|/-\\"
- now := time.Now()
- nanos := now.UnixNano()
- index := nanos / 50000000 % int64(len(characters))
- str := characters[index : index+1]
- chr := []rune(str)[0]
- return cell{
- chr: chr,
- }
-}
diff --git a/vendor/github.com/awesome-gocui/gocui/view.go b/vendor/github.com/awesome-gocui/gocui/view.go
deleted file mode 100644
index 81f906031a12a7dc49c1e85c86b60c5c0454ec51..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/gocui/view.go
+++ /dev/null
@@ -1,800 +0,0 @@
-// Copyright 2014 The gocui Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package gocui
-
-import (
- "bytes"
- "io"
- "strings"
- "sync"
- "unicode/utf8"
-
- "github.com/go-errors/errors"
-
- "github.com/awesome-gocui/termbox-go"
- "github.com/mattn/go-runewidth"
-)
-
-// Constants for overlapping edges
-const (
- TOP = 1 // view is overlapping at top edge
- BOTTOM = 2 // view is overlapping at bottom edge
- LEFT = 4 // view is overlapping at left edge
- RIGHT = 8 // view is overlapping at right edge
-)
-
-var (
- // ErrInvalidPoint is returned when client passed invalid coordinates of a cell.
- // Most likely client has passed negative coordinates of a cell.
- ErrInvalidPoint = errors.New("invalid point")
-)
-
-// A View is a window. It maintains its own internal buffer and cursor
-// position.
-type View struct {
- name string
- x0, y0, x1, y1 int // left top right bottom
- ox, oy int // view offsets
- cx, cy int // cursor position
- rx, ry int // Read() offsets
- wx, wy int // Write() offsets
- lines [][]cell // All the data
-
- // readBuffer is used for storing unread bytes
- readBuffer []byte
-
- // tained is true if the viewLines must be updated
- tainted bool
-
- // internal representation of the view's buffer
- viewLines []viewLine
-
- // writeMutex protects locks the write process
- writeMutex sync.Mutex
-
- // ei is used to decode ESC sequences on Write
- ei *escapeInterpreter
-
- // Visible specifies whether the view is visible.
- Visible bool
-
- // BgColor and FgColor allow to configure the background and foreground
- // colors of the View.
- BgColor, FgColor Attribute
-
- // SelBgColor and SelFgColor are used to configure the background and
- // foreground colors of the selected line, when it is highlighted.
- SelBgColor, SelFgColor Attribute
-
- // If Editable is true, keystrokes will be added to the view's internal
- // buffer at the cursor position.
- Editable bool
-
- // Editor allows to define the editor that manages the editing mode,
- // including keybindings or cursor behaviour. DefaultEditor is used by
- // default.
- Editor Editor
-
- // Overwrite enables or disables the overwrite mode of the view.
- Overwrite bool
-
- // If Highlight is true, Sel{Bg,Fg}Colors will be used
- // for the line under the cursor position.
- Highlight bool
-
- // If Frame is true, a border will be drawn around the view.
- Frame bool
-
- // If Wrap is true, the content that is written to this View is
- // automatically wrapped when it is longer than its width. If true the
- // view's x-origin will be ignored.
- Wrap bool
-
- // If Autoscroll is true, the View will automatically scroll down when the
- // text overflows. If true the view's y-origin will be ignored.
- Autoscroll bool
-
- // If Frame is true, Title allows to configure a title for the view.
- Title string
-
- // If Frame is true, Subtitle allows to configure a subtitle for the view.
- Subtitle string
-
- // If Mask is true, the View will display the mask instead of the real
- // content
- Mask rune
-
- // Overlaps describes which edges are overlapping with another view's edges
- Overlaps byte
-
- // If HasLoader is true, the message will be appended with a spinning loader animation
- HasLoader bool
-}
-
-type viewLine struct {
- linesX, linesY int // coordinates relative to v.lines
- line []cell
-}
-
-type cell struct {
- chr rune
- bgColor, fgColor Attribute
-}
-
-type lineType []cell
-
-// String returns a string from a given cell slice.
-func (l lineType) String() string {
- str := ""
- for _, c := range l {
- str += string(c.chr)
- }
- return str
-}
-
-// newView returns a new View object.
-func newView(name string, x0, y0, x1, y1 int, mode OutputMode) *View {
- v := &View{
- name: name,
- x0: x0,
- y0: y0,
- x1: x1,
- y1: y1,
- Visible: true,
- Frame: true,
- Editor: DefaultEditor,
- tainted: true,
- ei: newEscapeInterpreter(mode),
- }
- return v
-}
-
-// Dimensions returns the dimensions of the View
-func (v *View) Dimensions() (int, int, int, int) {
- return v.x0, v.y0, v.x1, v.y1
-}
-
-// Size returns the number of visible columns and rows in the View.
-func (v *View) Size() (x, y int) {
- return v.x1 - v.x0 - 1, v.y1 - v.y0 - 1
-}
-
-// Name returns the name of the view.
-func (v *View) Name() string {
- return v.name
-}
-
-// setRune sets a rune at the given point relative to the view. It applies the
-// specified colors, taking into account if the cell must be highlighted. Also,
-// it checks if the position is valid.
-func (v *View) setRune(x, y int, ch rune, fgColor, bgColor Attribute) error {
- maxX, maxY := v.Size()
- if x < 0 || x >= maxX || y < 0 || y >= maxY {
- return ErrInvalidPoint
- }
- var (
- ry, rcy int
- err error
- )
- if v.Highlight {
- _, ry, err = v.realPosition(x, y)
- if err != nil {
- return err
- }
- _, rcy, err = v.realPosition(v.cx, v.cy)
- if err != nil {
- return err
- }
- }
-
- if v.Mask != 0 {
- fgColor = v.FgColor
- bgColor = v.BgColor
- ch = v.Mask
- } else if v.Highlight && ry == rcy {
- fgColor = fgColor | AttrBold
- }
-
- // Don't display NUL characters
- if ch == 0 {
- ch = ' '
- }
-
- termbox.SetCell(v.x0+x+1, v.y0+y+1, ch,
- termbox.Attribute(fgColor), termbox.Attribute(bgColor))
-
- return nil
-}
-
-// SetCursor sets the cursor position of the view at the given point,
-// relative to the view. It checks if the position is valid.
-func (v *View) SetCursor(x, y int) error {
- maxX, maxY := v.Size()
- if x < 0 || x >= maxX || y < 0 || y >= maxY {
- return ErrInvalidPoint
- }
- v.cx = x
- v.cy = y
- return nil
-}
-
-// Cursor returns the cursor position of the view.
-func (v *View) Cursor() (x, y int) {
- return v.cx, v.cy
-}
-
-// SetOrigin sets the origin position of the view's internal buffer,
-// so the buffer starts to be printed from this point, which means that
-// it is linked with the origin point of view. It can be used to
-// implement Horizontal and Vertical scrolling with just incrementing
-// or decrementing ox and oy.
-func (v *View) SetOrigin(x, y int) error {
- if x < 0 || y < 0 {
- return ErrInvalidPoint
- }
- v.ox = x
- v.oy = y
- return nil
-}
-
-// Origin returns the origin position of the view.
-func (v *View) Origin() (x, y int) {
- return v.ox, v.oy
-}
-
-// SetWritePos sets the write position of the view's internal buffer.
-// So the next Write call would write directly to the specified position.
-func (v *View) SetWritePos(x, y int) error {
- if x < 0 || y < 0 {
- return ErrInvalidPoint
- }
- v.wx = x
- v.wy = y
- return nil
-}
-
-// WritePos returns the current write position of the view's internal buffer.
-func (v *View) WritePos() (x, y int) {
- return v.wx, v.wy
-}
-
-// SetReadPos sets the read position of the view's internal buffer.
-// So the next Read call would read from the specified position.
-func (v *View) SetReadPos(x, y int) error {
- if x < 0 || y < 0 {
- return ErrInvalidPoint
- }
- v.readBuffer = nil
- v.rx = x
- v.ry = y
- return nil
-}
-
-// ReadPos returns the current read position of the view's internal buffer.
-func (v *View) ReadPos() (x, y int) {
- return v.rx, v.ry
-}
-
-// makeWriteable creates empty cells if required to make position (x, y) writeable.
-func (v *View) makeWriteable(x, y int) {
- // TODO: make this more efficient
-
- // line `y` must be index-able (that's why `<=`)
- for len(v.lines) <= y {
- if cap(v.lines) > len(v.lines) {
- newLen := cap(v.lines)
- if newLen > y {
- newLen = y + 1
- }
- v.lines = v.lines[:newLen]
- } else {
- v.lines = append(v.lines, nil)
- }
- }
- // cell `x` must not be index-able (that's why `<`)
- // append should be used by `lines[y]` user if he wants to write beyond `x`
- for len(v.lines[y]) < x {
- if cap(v.lines[y]) > len(v.lines[y]) {
- newLen := cap(v.lines[y])
- if newLen > x {
- newLen = x
- }
- v.lines[y] = v.lines[y][:newLen]
- } else {
- v.lines[y] = append(v.lines[y], cell{})
- }
- }
-}
-
-// writeCells copies []cell to specified location (x, y)
-// !!! caller MUST ensure that specified location (x, y) is writeable by calling makeWriteable
-func (v *View) writeCells(x, y int, cells []cell) {
- var newLen int
- // use maximum len available
- line := v.lines[y][:cap(v.lines[y])]
- maxCopy := len(line) - x
- if maxCopy < len(cells) {
- copy(line[x:], cells[:maxCopy])
- line = append(line, cells[maxCopy:]...)
- newLen = len(line)
- } else { // maxCopy >= len(cells)
- copy(line[x:], cells)
- newLen = x + len(cells)
- if newLen < len(v.lines[y]) {
- newLen = len(v.lines[y])
- }
- }
- v.lines[y] = line[:newLen]
-}
-
-// Write appends a byte slice into the view's internal buffer. Because
-// View implements the io.Writer interface, it can be passed as parameter
-// of functions like fmt.Fprintf, fmt.Fprintln, io.Copy, etc. Clear must
-// be called to clear the view's buffer.
-func (v *View) Write(p []byte) (n int, err error) {
- v.tainted = true
- v.writeMutex.Lock()
- v.makeWriteable(v.wx, v.wy)
- v.writeRunes(bytes.Runes(p))
- v.writeMutex.Unlock()
-
- return len(p), nil
-}
-
-func (v *View) WriteRunes(p []rune) {
- v.tainted = true
-
- // Fill with empty cells, if writing outside current view buffer
- v.makeWriteable(v.wx, v.wy)
- v.writeRunes(p)
-}
-
-func (v *View) WriteString(s string) {
- v.WriteRunes([]rune(s))
-}
-
-// writeRunes copies slice of runes into internal lines buffer.
-// caller must make sure that writing position is accessable.
-func (v *View) writeRunes(p []rune) {
- for _, r := range p {
- switch r {
- case '\n':
- v.wy++
- if v.wy >= len(v.lines) {
- v.lines = append(v.lines, nil)
- }
-
- fallthrough
- // not valid in every OS, but making runtime OS checks in cycle is bad.
- case '\r':
- v.wx = 0
- default:
- cells := v.parseInput(r)
- if cells == nil {
- continue
- }
- v.writeCells(v.wx, v.wy, cells)
- v.wx += len(cells)
- }
- }
-}
-
-// parseInput parses char by char the input written to the View. It returns nil
-// while processing ESC sequences. Otherwise, it returns a cell slice that
-// contains the processed data.
-func (v *View) parseInput(ch rune) []cell {
- cells := []cell{}
-
- isEscape, err := v.ei.parseOne(ch)
- if err != nil {
- for _, r := range v.ei.runes() {
- c := cell{
- fgColor: v.FgColor,
- bgColor: v.BgColor,
- chr: r,
- }
- cells = append(cells, c)
- }
- v.ei.reset()
- } else {
- if isEscape {
- return nil
- }
- repeatCount := 1
- if ch == '\t' {
- ch = ' '
- repeatCount = 4
- }
- for i := 0; i < repeatCount; i++ {
- c := cell{
- fgColor: v.ei.curFgColor,
- bgColor: v.ei.curBgColor,
- chr: ch,
- }
- cells = append(cells, c)
- }
- }
-
- return cells
-}
-
-// Read reads data into p from the current reading position set by SetReadPos.
-// It returns the number of bytes read into p.
-// At EOF, err will be io.EOF.
-func (v *View) Read(p []byte) (n int, err error) {
- buffer := make([]byte, utf8.UTFMax)
- offset := 0
- if v.readBuffer != nil {
- copy(p, v.readBuffer)
- if len(v.readBuffer) >= len(p) {
- if len(v.readBuffer) > len(p) {
- v.readBuffer = v.readBuffer[len(p):]
- }
- return len(p), nil
- }
- v.readBuffer = nil
- }
- for v.ry < len(v.lines) {
- for v.rx < len(v.lines[v.ry]) {
- count := utf8.EncodeRune(buffer, v.lines[v.ry][v.rx].chr)
- copy(p[offset:], buffer[:count])
- v.rx++
- newOffset := offset + count
- if newOffset >= len(p) {
- if newOffset > len(p) {
- v.readBuffer = buffer[newOffset-len(p):]
- }
- return len(p), nil
- }
- offset += count
- }
- v.rx = 0
- v.ry++
- }
- return offset, io.EOF
-}
-
-// Rewind sets read and write pos to (0, 0).
-func (v *View) Rewind() {
- if err := v.SetReadPos(0, 0); err != nil {
- // SetReadPos returns error only if x and y are negative
- // we are passing 0, 0, thus no error should occur.
- panic(err)
- }
- if err := v.SetWritePos(0, 0); err != nil {
- // SetWritePos returns error only if x and y are negative
- // we are passing 0, 0, thus no error should occur.
- panic(err)
- }
-}
-
-// IsTainted tells us if the view is tainted
-func (v *View) IsTainted() bool {
- return v.tainted
-}
-
-// draw re-draws the view's contents.
-func (v *View) draw() error {
- if !v.Visible {
- return nil
- }
-
- maxX, maxY := v.Size()
-
- if v.Wrap {
- if maxX == 0 {
- return errors.New("X size of the view cannot be 0")
- }
- v.ox = 0
- }
- if v.tainted {
- v.viewLines = nil
- lines := v.lines
- if v.HasLoader {
- lines = v.loaderLines()
- }
- for i, line := range lines {
- wrap := 0
- if v.Wrap {
- wrap = maxX
- }
-
- ls := lineWrap(line, wrap)
- for j := range ls {
- vline := viewLine{linesX: j, linesY: i, line: ls[j]}
- v.viewLines = append(v.viewLines, vline)
- }
- }
- if !v.HasLoader {
- v.tainted = false
- }
- }
-
- if v.Autoscroll && len(v.viewLines) > maxY {
- v.oy = len(v.viewLines) - maxY
- }
- y := 0
- for i, vline := range v.viewLines {
- if i < v.oy {
- continue
- }
- if y >= maxY {
- break
- }
- x := 0
- for j, c := range vline.line {
- if j < v.ox {
- continue
- }
- if x >= maxX {
- break
- }
-
- fgColor := c.fgColor
- if fgColor == ColorDefault {
- fgColor = v.FgColor
- }
- bgColor := c.bgColor
- if bgColor == ColorDefault {
- bgColor = v.BgColor
- }
-
- if err := v.setRune(x, y, c.chr, fgColor, bgColor); err != nil {
- return err
- }
-
- if c.chr != 0 {
- // If it is a rune, add rune width
- x += runewidth.RuneWidth(c.chr)
- } else {
- // If it is NULL rune, add 1 to be able to use SetWritePos
- // (runewidth.RuneWidth of space is 1)
- x++
- }
- }
- y++
- }
- return nil
-}
-
-// realPosition returns the position in the internal buffer corresponding to the
-// point (x, y) of the view.
-func (v *View) realPosition(vx, vy int) (x, y int, err error) {
- vx = v.ox + vx
- vy = v.oy + vy
-
- if vx < 0 || vy < 0 {
- return 0, 0, ErrInvalidPoint
- }
-
- if len(v.viewLines) == 0 {
- return vx, vy, nil
- }
-
- if vy < len(v.viewLines) {
- vline := v.viewLines[vy]
- x = vline.linesX + vx
- y = vline.linesY
- } else {
- vline := v.viewLines[len(v.viewLines)-1]
- x = vx
- y = vline.linesY + vy - len(v.viewLines) + 1
- }
-
- return x, y, nil
-}
-
-// Clear empties the view's internal buffer.
-// And resets reading and writing offsets.
-func (v *View) Clear() {
- v.writeMutex.Lock()
- v.Rewind()
- v.tainted = true
- v.ei.reset()
- v.lines = nil
- v.viewLines = nil
- v.clearRunes()
- v.writeMutex.Unlock()
-}
-
-// clearRunes erases all the cells in the view.
-func (v *View) clearRunes() {
- maxX, maxY := v.Size()
- for x := 0; x < maxX; x++ {
- for y := 0; y < maxY; y++ {
- termbox.SetCell(v.x0+x+1, v.y0+y+1, ' ',
- termbox.Attribute(v.FgColor), termbox.Attribute(v.BgColor))
- }
- }
-}
-
-// BufferLines returns the lines in the view's internal
-// buffer.
-func (v *View) BufferLines() []string {
- lines := make([]string, len(v.lines))
- for i, l := range v.lines {
- str := lineType(l).String()
- str = strings.Replace(str, "\x00", " ", -1)
- lines[i] = str
- }
- return lines
-}
-
-// Buffer returns a string with the contents of the view's internal
-// buffer.
-func (v *View) Buffer() string {
- return linesToString(v.lines)
-}
-
-// ViewBufferLines returns the lines in the view's internal
-// buffer that is shown to the user.
-func (v *View) ViewBufferLines() []string {
- lines := make([]string, len(v.viewLines))
- for i, l := range v.viewLines {
- str := lineType(l.line).String()
- str = strings.Replace(str, "\x00", " ", -1)
- lines[i] = str
- }
- return lines
-}
-
-// LinesHeight is the count of view lines (i.e. lines excluding wrapping)
-func (v *View) LinesHeight() int {
- return len(v.lines)
-}
-
-// ViewLinesHeight is the count of view lines (i.e. lines including wrapping)
-func (v *View) ViewLinesHeight() int {
- return len(v.viewLines)
-}
-
-// ViewBuffer returns a string with the contents of the view's buffer that is
-// shown to the user.
-func (v *View) ViewBuffer() string {
- lines := make([][]cell, len(v.viewLines))
- for i := range v.viewLines {
- lines[i] = v.viewLines[i].line
- }
-
- return linesToString(lines)
-}
-
-// Line returns a string with the line of the view's internal buffer
-// at the position corresponding to the point (x, y).
-func (v *View) Line(y int) (string, error) {
- _, y, err := v.realPosition(0, y)
- if err != nil {
- return "", err
- }
-
- if y < 0 || y >= len(v.lines) {
- return "", ErrInvalidPoint
- }
-
- return lineType(v.lines[y]).String(), nil
-}
-
-// Word returns a string with the word of the view's internal buffer
-// at the position corresponding to the point (x, y).
-func (v *View) Word(x, y int) (string, error) {
- x, y, err := v.realPosition(x, y)
- if err != nil {
- return "", err
- }
-
- if x < 0 || y < 0 || y >= len(v.lines) || x >= len(v.lines[y]) {
- return "", ErrInvalidPoint
- }
-
- str := lineType(v.lines[y]).String()
-
- nl := strings.LastIndexFunc(str[:x], indexFunc)
- if nl == -1 {
- nl = 0
- } else {
- nl = nl + 1
- }
- nr := strings.IndexFunc(str[x:], indexFunc)
- if nr == -1 {
- nr = len(str)
- } else {
- nr = nr + x
- }
- return string(str[nl:nr]), nil
-}
-
-// indexFunc allows to split lines by words taking into account spaces
-// and 0.
-func indexFunc(r rune) bool {
- return r == ' ' || r == 0
-}
-
-// SetLine changes the contents of an existing line.
-func (v *View) SetLine(y int, text string) error {
- if y < 0 || y >= len(v.lines) {
- err := ErrInvalidPoint
- return err
- }
-
- v.tainted = true
- line := make([]cell, 0)
- for _, r := range text {
- c := v.parseInput(r)
- line = append(line, c...)
- }
- v.lines[y] = line
- return nil
-}
-
-// SetHighlight toggles highlighting of separate lines, for custom lists
-// or multiple selection in views.
-func (v *View) SetHighlight(y int, on bool) error {
- if y < 0 || y >= len(v.lines) {
- err := ErrInvalidPoint
- return err
- }
-
- line := v.lines[y]
- cells := make([]cell, 0)
- for _, c := range line {
- if on {
- c.bgColor = v.SelBgColor
- c.fgColor = v.SelFgColor
- } else {
- c.bgColor = v.BgColor
- c.fgColor = v.FgColor
- }
- cells = append(cells, c)
- }
- v.tainted = true
- v.lines[y] = cells
- return nil
-}
-
-func lineWidth(line []cell) (n int) {
- for i := range line {
- n += runewidth.RuneWidth(line[i].chr)
- }
-
- return
-}
-
-func lineWrap(line []cell, columns int) [][]cell {
- if columns == 0 {
- return [][]cell{line}
- }
-
- var n int
- var offset int
- lines := make([][]cell, 0, 1)
- for i := range line {
- rw := runewidth.RuneWidth(line[i].chr)
- n += rw
- if n > columns {
- n = rw
- lines = append(lines, line[offset:i])
- offset = i
- }
- }
-
- lines = append(lines, line[offset:])
- return lines
-}
-
-func linesToString(lines [][]cell) string {
- str := make([]string, len(lines))
- for i := range lines {
- rns := make([]rune, 0, len(lines[i]))
- line := lineType(lines[i]).String()
- for _, c := range line {
- if c != '\x00' {
- rns = append(rns, c)
- }
- }
- str[i] = string(rns)
- }
-
- return strings.Join(str, "\n")
-}
diff --git a/vendor/github.com/awesome-gocui/termbox-go/AUTHORS b/vendor/github.com/awesome-gocui/termbox-go/AUTHORS
deleted file mode 100644
index fe26fb0fb058b83fa0f97821232375ea8361ecfe..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/AUTHORS
+++ /dev/null
@@ -1,4 +0,0 @@
-# Please keep this file sorted.
-
-Georg Reinke
-nsf
diff --git a/vendor/github.com/awesome-gocui/termbox-go/LICENSE b/vendor/github.com/awesome-gocui/termbox-go/LICENSE
deleted file mode 100644
index d9bc068ce748ebf7a2e82b7ffeb20d1d0c29df99..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (C) 2012 termbox-go authors
-
-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/awesome-gocui/termbox-go/README.md b/vendor/github.com/awesome-gocui/termbox-go/README.md
deleted file mode 100644
index 734aab73cb5e29760734efcd13ea9e96d385dafa..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/README.md
+++ /dev/null
@@ -1,49 +0,0 @@
-[](http://godoc.org/github.com/nsf/termbox-go)
-
-## IMPORTANT
-
-This library is somewhat not maintained anymore. But I'm glad that it did what I wanted the most. It moved people away from "ncurses" mindset and these days we see both re-implementations of termbox API in various languages and even possibly better libs with similar API design. If you're looking for a Go lib that provides terminal-based user interface facilities, I've heard that https://github.com/gdamore/tcell is good (never used it myself). Also for more complicated interfaces and/or computer games I recommend you to consider using HTML-based UI. Having said that, termbox still somewhat works. In fact I'm writing this line of text right now in godit (which is a text editor written using termbox-go). So, be aware. Good luck and have a nice day.
-
-## Termbox
-Termbox is a library that provides a minimalistic API which allows the programmer to write text-based user interfaces. The library is crossplatform and has both terminal-based implementations on *nix operating systems and a winapi console based implementation for windows operating systems. The basic idea is an abstraction of the greatest common subset of features available on all major terminals and other terminal-like APIs in a minimalistic fashion. Small API means it is easy to implement, test, maintain and learn it, that's what makes the termbox a distinct library in its area.
-
-### Installation
-Install and update this go package with `go get -u github.com/nsf/termbox-go`
-
-### Examples
-For examples of what can be done take a look at demos in the _demos directory. You can try them with go run: `go run _demos/keyboard.go`
-
-There are also some interesting projects using termbox-go:
- - [godit](https://github.com/nsf/godit) is an emacsish lightweight text editor written using termbox.
- - [gotetris](https://github.com/jjinux/gotetris) is an implementation of Tetris.
- - [sokoban-go](https://github.com/rn2dy/sokoban-go) is an implementation of sokoban game.
- - [hecate](https://github.com/evanmiller/hecate) is a hex editor designed by Satan.
- - [httopd](https://github.com/verdverm/httopd) is top for httpd logs.
- - [mop](https://github.com/mop-tracker/mop) is stock market tracker for hackers.
- - [termui](https://github.com/gizak/termui) is a terminal dashboard.
- - [termdash](https://github.com/mum4k/termdash) is a terminal dashboard.
- - [termloop](https://github.com/JoelOtter/termloop) is a terminal game engine.
- - [xterm-color-chart](https://github.com/kutuluk/xterm-color-chart) is a XTerm 256 color chart.
- - [gocui](https://github.com/jroimartin/gocui) is a minimalist Go library aimed at creating console user interfaces.
- - [dry](https://github.com/moncho/dry) is an interactive cli to manage Docker containers.
- - [pxl](https://github.com/ichinaski/pxl) displays images in the terminal.
- - [snake-game](https://github.com/DyegoCosta/snake-game) is an implementation of the Snake game.
- - [gone](https://github.com/guillaumebreton/gone) is a CLI pomodoro® timer.
- - [Spoof.go](https://github.com/sabey/spoofgo) controllable movement spoofing from the cli
- - [lf](https://github.com/gokcehan/lf) is a terminal file manager
- - [rat](https://github.com/ericfreese/rat) lets you compose shell commands to build terminal applications.
- - [httplab](https://github.com/gchaincl/httplab) An interactive web server.
- - [tetris](https://github.com/MichaelS11/tetris) Go Tetris with AI option
- - [wot](https://github.com/kyu-suke/wot) Wait time during command is completed.
- - [2048-go](https://github.com/1984weed/2048-go) is 2048 in Go
- - [jv](https://github.com/maxzender/jv) helps you view JSON on the command-line.
- - [pinger](https://github.com/hirose31/pinger) helps you to monitor numerous hosts using ICMP ECHO_REQUEST.
- - [vixl44](https://github.com/sebashwa/vixl44) lets you create pixel art inside your terminal using vim movements
- - [zterm](https://github.com/varunrau/zterm) is a typing game inspired by http://zty.pe/
- - [gotypist](https://github.com/pb-/gotypist) is a fun touch-typing tutor following Steve Yegge's method.
- - [cointop](https://github.com/miguelmota/cointop) is an interactive terminal based UI application for tracking cryptocurrencies.
- - [pexpo](https://github.com/nnao45/pexpo) is a terminal sending ping tool written in Go.
- - [jid](https://github.com/simeji/jid) is an interactive JSON drill down tool using filtering queries like jq.
-
-### API reference
-[godoc.org/github.com/nsf/termbox-go](http://godoc.org/github.com/nsf/termbox-go)
diff --git a/vendor/github.com/awesome-gocui/termbox-go/api.go b/vendor/github.com/awesome-gocui/termbox-go/api.go
deleted file mode 100644
index a461fc27bb3e2db633ae8c77f933c668c1db0557..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/api.go
+++ /dev/null
@@ -1,506 +0,0 @@
-// +build !windows
-
-package termbox
-
-import "github.com/mattn/go-runewidth"
-import "fmt"
-import "os"
-import "os/signal"
-import "syscall"
-import "runtime"
-import "time"
-
-// public API
-
-// Initializes termbox library. This function should be called before any other functions.
-// After successful initialization, the library must be finalized using 'Close' function.
-//
-// Example usage:
-// err := termbox.Init()
-// if err != nil {
-// panic(err)
-// }
-// defer termbox.Close()
-func Init() error {
- var err error
-
- if runtime.GOOS == "openbsd" {
- out, err = os.OpenFile("/dev/tty", os.O_RDWR, 0)
- if err != nil {
- return err
- }
- in = int(out.Fd())
- } else {
- out, err = os.OpenFile("/dev/tty", os.O_WRONLY, 0)
- if err != nil {
- return err
- }
- in, err = syscall.Open("/dev/tty", syscall.O_RDONLY, 0)
- if err != nil {
- return err
- }
- }
-
- err = setup_term()
- if err != nil {
- return fmt.Errorf("termbox: error while reading terminfo data: %v", err)
- }
-
- signal.Notify(sigwinch, syscall.SIGWINCH)
- signal.Notify(sigio, syscall.SIGIO)
-
- _, err = fcntl(in, syscall.F_SETFL, syscall.O_ASYNC|syscall.O_NONBLOCK)
- if err != nil {
- return err
- }
- _, err = fcntl(in, syscall.F_SETOWN, syscall.Getpid())
- if runtime.GOOS != "darwin" && err != nil {
- return err
- }
- err = tcgetattr(out.Fd(), &orig_tios)
- if err != nil {
- return err
- }
-
- tios := orig_tios
- tios.Iflag &^= syscall_IGNBRK | syscall_BRKINT | syscall_PARMRK |
- syscall_ISTRIP | syscall_INLCR | syscall_IGNCR |
- syscall_ICRNL | syscall_IXON
- tios.Lflag &^= syscall_ECHO | syscall_ECHONL | syscall_ICANON |
- syscall_ISIG | syscall_IEXTEN
- tios.Cflag &^= syscall_CSIZE | syscall_PARENB
- tios.Cflag |= syscall_CS8
- tios.Cc[syscall_VMIN] = 1
- tios.Cc[syscall_VTIME] = 0
-
- err = tcsetattr(out.Fd(), &tios)
- if err != nil {
- return err
- }
-
- out.WriteString(funcs[t_enter_ca])
- out.WriteString(funcs[t_enter_keypad])
- out.WriteString(funcs[t_hide_cursor])
- out.WriteString(funcs[t_clear_screen])
-
- termw, termh = get_term_size(out.Fd())
- back_buffer.init(termw, termh)
- front_buffer.init(termw, termh)
- back_buffer.clear()
- front_buffer.clear()
-
- go func() {
- buf := make([]byte, 128)
- for {
- select {
- case <-sigio:
- for {
- n, err := syscall.Read(in, buf)
- if err == syscall.EAGAIN || err == syscall.EWOULDBLOCK {
- break
- }
- select {
- case input_comm <- input_event{buf[:n], err}:
- ie := <-input_comm
- buf = ie.data[:128]
- case <-quit:
- return
- }
- }
- case <-quit:
- return
- }
- }
- }()
-
- IsInit = true
- return nil
-}
-
-// Interrupt an in-progress call to PollEvent by causing it to return
-// EventInterrupt. Note that this function will block until the PollEvent
-// function has successfully been interrupted.
-func Interrupt() {
- interrupt_comm <- struct{}{}
-}
-
-// Finalizes termbox library, should be called after successful initialization
-// when termbox's functionality isn't required anymore.
-func Close() {
- quit <- 1
- out.WriteString(funcs[t_show_cursor])
- out.WriteString(funcs[t_sgr0])
- out.WriteString(funcs[t_clear_screen])
- out.WriteString(funcs[t_exit_ca])
- out.WriteString(funcs[t_exit_keypad])
- out.WriteString(funcs[t_exit_mouse])
- tcsetattr(out.Fd(), &orig_tios)
-
- out.Close()
- syscall.Close(in)
-
- // reset the state, so that on next Init() it will work again
- termw = 0
- termh = 0
- input_mode = InputEsc
- out = nil
- in = 0
- lastfg = attr_invalid
- lastbg = attr_invalid
- lastx = coord_invalid
- lasty = coord_invalid
- cursor_x = cursor_hidden
- cursor_y = cursor_hidden
- foreground = ColorDefault
- background = ColorDefault
- IsInit = false
-}
-
-// Synchronizes the internal back buffer with the terminal.
-func Flush() error {
- // invalidate cursor position
- lastx = coord_invalid
- lasty = coord_invalid
-
- update_size_maybe()
-
- for y := 0; y < front_buffer.height; y++ {
- line_offset := y * front_buffer.width
- for x := 0; x < front_buffer.width; {
- cell_offset := line_offset + x
- back := &back_buffer.cells[cell_offset]
- front := &front_buffer.cells[cell_offset]
- if back.Ch < ' ' {
- back.Ch = ' '
- }
- w := runewidth.RuneWidth(back.Ch)
- if w == 0 || w == 2 && runewidth.IsAmbiguousWidth(back.Ch) {
- w = 1
- }
- if *back == *front {
- x += w
- continue
- }
- *front = *back
- send_attr(back.Fg, back.Bg)
-
- if w == 2 && x == front_buffer.width-1 {
- // there's not enough space for 2-cells rune,
- // let's just put a space in there
- send_char(x, y, ' ')
- } else {
- send_char(x, y, back.Ch)
- if w == 2 {
- next := cell_offset + 1
- front_buffer.cells[next] = Cell{
- Ch: 0,
- Fg: back.Fg,
- Bg: back.Bg,
- }
- }
- }
- x += w
- }
- }
- if !is_cursor_hidden(cursor_x, cursor_y) {
- write_cursor(cursor_x, cursor_y)
- }
- return flush()
-}
-
-// Sets the position of the cursor. See also HideCursor().
-func SetCursor(x, y int) {
- if is_cursor_hidden(cursor_x, cursor_y) && !is_cursor_hidden(x, y) {
- outbuf.WriteString(funcs[t_show_cursor])
- }
-
- if !is_cursor_hidden(cursor_x, cursor_y) && is_cursor_hidden(x, y) {
- outbuf.WriteString(funcs[t_hide_cursor])
- }
-
- cursor_x, cursor_y = x, y
- if !is_cursor_hidden(cursor_x, cursor_y) {
- write_cursor(cursor_x, cursor_y)
- }
-}
-
-// The shortcut for SetCursor(-1, -1).
-func HideCursor() {
- SetCursor(cursor_hidden, cursor_hidden)
-}
-
-// Changes cell's parameters in the internal back buffer at the specified
-// position.
-func SetCell(x, y int, ch rune, fg, bg Attribute) {
- if x < 0 || x >= back_buffer.width {
- return
- }
- if y < 0 || y >= back_buffer.height {
- return
- }
-
- back_buffer.cells[y*back_buffer.width+x] = Cell{ch, fg, bg}
-}
-
-// Returns a slice into the termbox's back buffer. You can get its dimensions
-// using 'Size' function. The slice remains valid as long as no 'Clear' or
-// 'Flush' function calls were made after call to this function.
-func CellBuffer() []Cell {
- return back_buffer.cells
-}
-
-// After getting a raw event from PollRawEvent function call, you can parse it
-// again into an ordinary one using termbox logic. That is parse an event as
-// termbox would do it. Returned event in addition to usual Event struct fields
-// sets N field to the amount of bytes used within 'data' slice. If the length
-// of 'data' slice is zero or event cannot be parsed for some other reason, the
-// function will return a special event type: EventNone.
-//
-// IMPORTANT: EventNone may contain a non-zero N, which means you should skip
-// these bytes, because termbox cannot recognize them.
-//
-// NOTE: This API is experimental and may change in future.
-func ParseEvent(data []byte) Event {
- event := Event{Type: EventKey}
- status := extract_event(data, &event, false)
- if status != event_extracted {
- return Event{Type: EventNone, N: event.N}
- }
- return event
-}
-
-// Wait for an event and return it. This is a blocking function call. Instead
-// of EventKey and EventMouse it returns EventRaw events. Raw event is written
-// into `data` slice and Event's N field is set to the amount of bytes written.
-// The minimum required length of the 'data' slice is 1. This requirement may
-// vary on different platforms.
-//
-// NOTE: This API is experimental and may change in future.
-func PollRawEvent(data []byte) Event {
- if len(data) == 0 {
- panic("len(data) >= 1 is a requirement")
- }
-
- var event Event
- if extract_raw_event(data, &event) {
- return event
- }
-
- for {
- select {
- case ev := <-input_comm:
- if ev.err != nil {
- return Event{Type: EventError, Err: ev.err}
- }
-
- inbuf = append(inbuf, ev.data...)
- input_comm <- ev
- if extract_raw_event(data, &event) {
- return event
- }
- case <-interrupt_comm:
- event.Type = EventInterrupt
- return event
-
- case <-sigwinch:
- event.Type = EventResize
- event.Width, event.Height = get_term_size(out.Fd())
- return event
- }
- }
-}
-
-// Wait for an event and return it. This is a blocking function call.
-func PollEvent() Event {
- // Constant governing macOS specific behavior. See https://github.com/nsf/termbox-go/issues/132
- // This is an arbitrary delay which hopefully will be enough time for any lagging
- // partial escape sequences to come through.
- const esc_wait_delay = 100 * time.Millisecond
-
- var event Event
- var esc_wait_timer *time.Timer
- var esc_timeout <-chan time.Time
-
- // try to extract event from input buffer, return on success
- event.Type = EventKey
- status := extract_event(inbuf, &event, true)
- if event.N != 0 {
- if event.N > len(inbuf) {
- event.N = len(inbuf)
- }
- copy(inbuf, inbuf[event.N:])
- inbuf = inbuf[:len(inbuf)-event.N]
- }
- if status == event_extracted {
- return event
- } else if status == esc_wait {
- esc_wait_timer = time.NewTimer(esc_wait_delay)
- esc_timeout = esc_wait_timer.C
- }
-
- for {
- select {
- case ev := <-input_comm:
- if esc_wait_timer != nil {
- if !esc_wait_timer.Stop() {
- <-esc_wait_timer.C
- }
- esc_wait_timer = nil
- }
-
- if ev.err != nil {
- return Event{Type: EventError, Err: ev.err}
- }
-
- inbuf = append(inbuf, ev.data...)
- input_comm <- ev
- status := extract_event(inbuf, &event, true)
- if event.N != 0 {
- if event.N > len(inbuf) {
- event.N = len(inbuf)
- }
- copy(inbuf, inbuf[event.N:])
- inbuf = inbuf[:len(inbuf)-event.N]
- }
- if status == event_extracted {
- return event
- } else if status == esc_wait {
- esc_wait_timer = time.NewTimer(esc_wait_delay)
- esc_timeout = esc_wait_timer.C
- }
- case <-esc_timeout:
- esc_wait_timer = nil
-
- status := extract_event(inbuf, &event, false)
- if event.N != 0 {
- if event.N > len(inbuf) {
- event.N = len(inbuf)
- }
- copy(inbuf, inbuf[event.N:])
- inbuf = inbuf[:len(inbuf)-event.N]
- }
- if status == event_extracted {
- return event
- }
- case <-interrupt_comm:
- event.Type = EventInterrupt
- return event
-
- case <-sigwinch:
- event.Type = EventResize
- event.Width, event.Height = get_term_size(out.Fd())
- return event
- }
- }
-}
-
-// Returns the size of the internal back buffer (which is mostly the same as
-// terminal's window size in characters). But it doesn't always match the size
-// of the terminal window, after the terminal size has changed, the internal
-// back buffer will get in sync only after Clear or Flush function calls.
-func Size() (width int, height int) {
- return termw, termh
-}
-
-// Clears the internal back buffer.
-func Clear(fg, bg Attribute) error {
- foreground, background = fg, bg
- err := update_size_maybe()
- back_buffer.clear()
- return err
-}
-
-// Sets termbox input mode. Termbox has two input modes:
-//
-// 1. Esc input mode. When ESC sequence is in the buffer and it doesn't match
-// any known sequence. ESC means KeyEsc. This is the default input mode.
-//
-// 2. Alt input mode. When ESC sequence is in the buffer and it doesn't match
-// any known sequence. ESC enables ModAlt modifier for the next keyboard event.
-//
-// Both input modes can be OR'ed with Mouse mode. Setting Mouse mode bit up will
-// enable mouse button press/release and drag events.
-//
-// If 'mode' is InputCurrent, returns the current input mode. See also Input*
-// constants.
-func SetInputMode(mode InputMode) InputMode {
- if mode == InputCurrent {
- return input_mode
- }
- if mode&(InputEsc|InputAlt) == 0 {
- mode |= InputEsc
- }
- if mode&(InputEsc|InputAlt) == InputEsc|InputAlt {
- mode &^= InputAlt
- }
- if mode&InputMouse != 0 {
- out.WriteString(funcs[t_enter_mouse])
- } else {
- out.WriteString(funcs[t_exit_mouse])
- }
-
- input_mode = mode
- return input_mode
-}
-
-// Sets the termbox output mode. Termbox has four output options:
-//
-// 1. OutputNormal => [1..8]
-// This mode provides 8 different colors:
-// black, red, green, yellow, blue, magenta, cyan, white
-// Shortcut: ColorBlack, ColorRed, ...
-// Attributes: AttrBold, AttrUnderline, AttrReverse
-//
-// Example usage:
-// SetCell(x, y, '@', ColorBlack | AttrBold, ColorRed);
-//
-// 2. Output256 => [1..256]
-// In this mode you can leverage the 256 terminal mode:
-// 0x01 - 0x08: the 8 colors as in OutputNormal
-// 0x09 - 0x10: Color* | AttrBold
-// 0x11 - 0xe8: 216 different colors
-// 0xe9 - 0x1ff: 24 different shades of grey
-//
-// Example usage:
-// SetCell(x, y, '@', 184, 240);
-// SetCell(x, y, '@', 0xb8, 0xf0);
-//
-// 3. Output216 => [1..216]
-// This mode supports the 3rd range of the 256 mode only.
-// But you don't need to provide an offset.
-//
-// 4. OutputGrayscale => [1..26]
-// This mode supports the 4th range of the 256 mode
-// and black and white colors from 3th range of the 256 mode
-// But you don't need to provide an offset.
-//
-// In all modes, 0x00 represents the default color.
-//
-// `go run _demos/output.go` to see its impact on your terminal.
-//
-// If 'mode' is OutputCurrent, it returns the current output mode.
-//
-// Note that this may return a different OutputMode than the one requested,
-// as the requested mode may not be available on the target platform.
-func SetOutputMode(mode OutputMode) OutputMode {
- if mode == OutputCurrent {
- return output_mode
- }
-
- output_mode = mode
- return output_mode
-}
-
-// Sync comes handy when something causes desync between termbox's understanding
-// of a terminal buffer and the reality. Such as a third party process. Sync
-// forces a complete resync between the termbox and a terminal, it may not be
-// visually pretty though.
-func Sync() error {
- front_buffer.clear()
- err := send_clear()
- if err != nil {
- return err
- }
-
- return Flush()
-}
diff --git a/vendor/github.com/awesome-gocui/termbox-go/api_common.go b/vendor/github.com/awesome-gocui/termbox-go/api_common.go
deleted file mode 100644
index 5ca1371a5bb562bc7c93c52c168ce73d0374d05d..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/api_common.go
+++ /dev/null
@@ -1,187 +0,0 @@
-// termbox is a library for creating cross-platform text-based interfaces
-package termbox
-
-// public API, common OS agnostic part
-
-type (
- InputMode int
- OutputMode int
- EventType uint8
- Modifier uint8
- Key uint16
- Attribute uint16
-)
-
-// This type represents a termbox event. The 'Mod', 'Key' and 'Ch' fields are
-// valid if 'Type' is EventKey. The 'Width' and 'Height' fields are valid if
-// 'Type' is EventResize. The 'Err' field is valid if 'Type' is EventError.
-type Event struct {
- Type EventType // one of Event* constants
- Mod Modifier // one of Mod* constants or 0
- Key Key // one of Key* constants, invalid if 'Ch' is not 0
- Ch rune // a unicode character
- Width int // width of the screen
- Height int // height of the screen
- Err error // error in case if input failed
- MouseX int // x coord of mouse
- MouseY int // y coord of mouse
- N int // number of bytes written when getting a raw event
-}
-
-// A cell, single conceptual entity on the screen. The screen is basically a 2d
-// array of cells. 'Ch' is a unicode character, 'Fg' and 'Bg' are foreground
-// and background attributes respectively.
-type Cell struct {
- Ch rune
- Fg Attribute
- Bg Attribute
-}
-
-// To know if termbox has been initialized or not
-var (
- IsInit bool = false
-)
-
-// Key constants, see Event.Key field.
-const (
- KeyF1 Key = 0xFFFF - iota
- KeyF2
- KeyF3
- KeyF4
- KeyF5
- KeyF6
- KeyF7
- KeyF8
- KeyF9
- KeyF10
- KeyF11
- KeyF12
- KeyInsert
- KeyDelete
- KeyHome
- KeyEnd
- KeyPgup
- KeyPgdn
- KeyArrowUp
- KeyArrowDown
- KeyArrowLeft
- KeyArrowRight
- key_min // see terminfo
- MouseLeft
- MouseMiddle
- MouseRight
- MouseRelease
- MouseWheelUp
- MouseWheelDown
-)
-
-const (
- KeyCtrlTilde Key = 0x00
- KeyCtrl2 Key = 0x00
- KeyCtrlSpace Key = 0x00
- KeyCtrlA Key = 0x01
- KeyCtrlB Key = 0x02
- KeyCtrlC Key = 0x03
- KeyCtrlD Key = 0x04
- KeyCtrlE Key = 0x05
- KeyCtrlF Key = 0x06
- KeyCtrlG Key = 0x07
- KeyBackspace Key = 0x08
- KeyCtrlH Key = 0x08
- KeyTab Key = 0x09
- KeyCtrlI Key = 0x09
- KeyCtrlJ Key = 0x0A
- KeyCtrlK Key = 0x0B
- KeyCtrlL Key = 0x0C
- KeyEnter Key = 0x0D
- KeyCtrlM Key = 0x0D
- KeyCtrlN Key = 0x0E
- KeyCtrlO Key = 0x0F
- KeyCtrlP Key = 0x10
- KeyCtrlQ Key = 0x11
- KeyCtrlR Key = 0x12
- KeyCtrlS Key = 0x13
- KeyCtrlT Key = 0x14
- KeyCtrlU Key = 0x15
- KeyCtrlV Key = 0x16
- KeyCtrlW Key = 0x17
- KeyCtrlX Key = 0x18
- KeyCtrlY Key = 0x19
- KeyCtrlZ Key = 0x1A
- KeyEsc Key = 0x1B
- KeyCtrlLsqBracket Key = 0x1B
- KeyCtrl3 Key = 0x1B
- KeyCtrl4 Key = 0x1C
- KeyCtrlBackslash Key = 0x1C
- KeyCtrl5 Key = 0x1D
- KeyCtrlRsqBracket Key = 0x1D
- KeyCtrl6 Key = 0x1E
- KeyCtrl7 Key = 0x1F
- KeyCtrlSlash Key = 0x1F
- KeyCtrlUnderscore Key = 0x1F
- KeySpace Key = 0x20
- KeyBackspace2 Key = 0x7F
- KeyCtrl8 Key = 0x7F
-)
-
-// Alt modifier constant, see Event.Mod field and SetInputMode function.
-const (
- ModAlt Modifier = 1 << iota
- ModMotion
-)
-
-// Cell colors, you can combine a color with multiple attributes using bitwise
-// OR ('|').
-const (
- ColorDefault Attribute = iota
- ColorBlack
- ColorRed
- ColorGreen
- ColorYellow
- ColorBlue
- ColorMagenta
- ColorCyan
- ColorWhite
-)
-
-// Cell attributes, it is possible to use multiple attributes by combining them
-// using bitwise OR ('|'). Although, colors cannot be combined. But you can
-// combine attributes and a single color.
-//
-// It's worth mentioning that some platforms don't support certain attributes.
-// For example windows console doesn't support AttrUnderline. And on some
-// terminals applying AttrBold to background may result in blinking text. Use
-// them with caution and test your code on various terminals.
-const (
- AttrBold Attribute = 1 << (iota + 9)
- AttrUnderline
- AttrReverse
-)
-
-// Input mode. See SetInputMode function.
-const (
- InputEsc InputMode = 1 << iota
- InputAlt
- InputMouse
- InputCurrent InputMode = 0
-)
-
-// Output mode. See SetOutputMode function.
-const (
- OutputCurrent OutputMode = iota
- OutputNormal
- Output256
- Output216
- OutputGrayscale
-)
-
-// Event type. See Event.Type field.
-const (
- EventKey EventType = iota
- EventResize
- EventMouse
- EventError
- EventInterrupt
- EventRaw
- EventNone
-)
diff --git a/vendor/github.com/awesome-gocui/termbox-go/api_windows.go b/vendor/github.com/awesome-gocui/termbox-go/api_windows.go
deleted file mode 100644
index 5c1e388a4232d9442e9caa4dbce1d5ae8174faa0..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/api_windows.go
+++ /dev/null
@@ -1,245 +0,0 @@
-package termbox
-
-import (
- "syscall"
-)
-
-// public API
-
-// Initializes termbox library. This function should be called before any other functions.
-// After successful initialization, the library must be finalized using 'Close' function.
-//
-// Example usage:
-// err := termbox.Init()
-// if err != nil {
-// panic(err)
-// }
-// defer termbox.Close()
-func Init() error {
- var err error
-
- interrupt, err = create_event()
- if err != nil {
- return err
- }
-
- in, err = syscall.Open("CONIN$", syscall.O_RDWR, 0)
- if err != nil {
- return err
- }
- out, err = syscall.Open("CONOUT$", syscall.O_RDWR, 0)
- if err != nil {
- return err
- }
-
- err = get_console_mode(in, &orig_mode)
- if err != nil {
- return err
- }
-
- err = set_console_mode(in, enable_window_input)
- if err != nil {
- return err
- }
-
- orig_size, orig_window = get_term_size(out)
- win_size := get_win_size(out)
-
- err = set_console_screen_buffer_size(out, win_size)
- if err != nil {
- return err
- }
-
- err = fix_win_size(out, win_size)
- if err != nil {
- return err
- }
-
- err = get_console_cursor_info(out, &orig_cursor_info)
- if err != nil {
- return err
- }
-
- show_cursor(false)
- term_size, _ = get_term_size(out)
- back_buffer.init(int(term_size.x), int(term_size.y))
- front_buffer.init(int(term_size.x), int(term_size.y))
- back_buffer.clear()
- front_buffer.clear()
- clear()
-
- diffbuf = make([]diff_msg, 0, 32)
-
- go input_event_producer()
- IsInit = true
- return nil
-}
-
-// Finalizes termbox library, should be called after successful initialization
-// when termbox's functionality isn't required anymore.
-func Close() {
- // we ignore errors here, because we can't really do anything about them
- Clear(0, 0)
- Flush()
-
- // stop event producer
- cancel_comm <- true
- set_event(interrupt)
- select {
- case <-input_comm:
- default:
- }
- <-cancel_done_comm
-
- set_console_screen_buffer_size(out, orig_size)
- set_console_window_info(out, &orig_window)
- set_console_cursor_info(out, &orig_cursor_info)
- set_console_cursor_position(out, coord{})
- set_console_mode(in, orig_mode)
- syscall.Close(in)
- syscall.Close(out)
- syscall.Close(interrupt)
- IsInit = false
-}
-
-// Interrupt an in-progress call to PollEvent by causing it to return
-// EventInterrupt. Note that this function will block until the PollEvent
-// function has successfully been interrupted.
-func Interrupt() {
- interrupt_comm <- struct{}{}
-}
-
-// Synchronizes the internal back buffer with the terminal.
-func Flush() error {
- update_size_maybe()
- prepare_diff_messages()
- for _, diff := range diffbuf {
- r := small_rect{
- left: 0,
- top: diff.pos,
- right: term_size.x - 1,
- bottom: diff.pos + diff.lines - 1,
- }
- write_console_output(out, diff.chars, r)
- }
- if !is_cursor_hidden(cursor_x, cursor_y) {
- move_cursor(cursor_x, cursor_y)
- }
- return nil
-}
-
-// Sets the position of the cursor. See also HideCursor().
-func SetCursor(x, y int) {
- if is_cursor_hidden(cursor_x, cursor_y) && !is_cursor_hidden(x, y) {
- show_cursor(true)
- }
-
- if !is_cursor_hidden(cursor_x, cursor_y) && is_cursor_hidden(x, y) {
- show_cursor(false)
- }
-
- cursor_x, cursor_y = x, y
- if !is_cursor_hidden(cursor_x, cursor_y) {
- move_cursor(cursor_x, cursor_y)
- }
-}
-
-// The shortcut for SetCursor(-1, -1).
-func HideCursor() {
- SetCursor(cursor_hidden, cursor_hidden)
-}
-
-// Changes cell's parameters in the internal back buffer at the specified
-// position.
-func SetCell(x, y int, ch rune, fg, bg Attribute) {
- if x < 0 || x >= back_buffer.width {
- return
- }
- if y < 0 || y >= back_buffer.height {
- return
- }
-
- back_buffer.cells[y*back_buffer.width+x] = Cell{ch, fg, bg}
-}
-
-// Returns a slice into the termbox's back buffer. You can get its dimensions
-// using 'Size' function. The slice remains valid as long as no 'Clear' or
-// 'Flush' function calls were made after call to this function.
-func CellBuffer() []Cell {
- return back_buffer.cells
-}
-
-// Wait for an event and return it. This is a blocking function call.
-func PollEvent() Event {
- select {
- case ev := <-input_comm:
- return ev
- case <-interrupt_comm:
- return Event{Type: EventInterrupt}
- }
-}
-
-// Returns the size of the internal back buffer (which is mostly the same as
-// console's window size in characters). But it doesn't always match the size
-// of the console window, after the console size has changed, the internal back
-// buffer will get in sync only after Clear or Flush function calls.
-func Size() (int, int) {
- return int(term_size.x), int(term_size.y)
-}
-
-// Clears the internal back buffer.
-func Clear(fg, bg Attribute) error {
- foreground, background = fg, bg
- update_size_maybe()
- back_buffer.clear()
- return nil
-}
-
-// Sets termbox input mode. Termbox has two input modes:
-//
-// 1. Esc input mode. When ESC sequence is in the buffer and it doesn't match
-// any known sequence. ESC means KeyEsc. This is the default input mode.
-//
-// 2. Alt input mode. When ESC sequence is in the buffer and it doesn't match
-// any known sequence. ESC enables ModAlt modifier for the next keyboard event.
-//
-// Both input modes can be OR'ed with Mouse mode. Setting Mouse mode bit up will
-// enable mouse button press/release and drag events.
-//
-// If 'mode' is InputCurrent, returns the current input mode. See also Input*
-// constants.
-func SetInputMode(mode InputMode) InputMode {
- if mode == InputCurrent {
- return input_mode
- }
- if mode&InputMouse != 0 {
- err := set_console_mode(in, enable_window_input|enable_mouse_input|enable_extended_flags)
- if err != nil {
- panic(err)
- }
- } else {
- err := set_console_mode(in, enable_window_input)
- if err != nil {
- panic(err)
- }
- }
-
- input_mode = mode
- return input_mode
-}
-
-// Sets the termbox output mode.
-//
-// Windows console does not support extra colour modes,
-// so this will always set and return OutputNormal.
-func SetOutputMode(mode OutputMode) OutputMode {
- return OutputNormal
-}
-
-// Sync comes handy when something causes desync between termbox's understanding
-// of a terminal buffer and the reality. Such as a third party process. Sync
-// forces a complete resync between the termbox and a terminal, it may not be
-// visually pretty though. At the moment on Windows it does nothing.
-func Sync() error {
- return nil
-}
diff --git a/vendor/github.com/awesome-gocui/termbox-go/collect_terminfo.py b/vendor/github.com/awesome-gocui/termbox-go/collect_terminfo.py
deleted file mode 100755
index 5e50975e63ab9300fe8dd3c96bae289c1c1be14e..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/collect_terminfo.py
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/usr/bin/env python
-
-import sys, os, subprocess
-
-def escaped(s):
- return repr(s)[1:-1]
-
-def tput(term, name):
- try:
- return subprocess.check_output(['tput', '-T%s' % term, name]).decode()
- except subprocess.CalledProcessError as e:
- return e.output.decode()
-
-
-def w(s):
- if s == None:
- return
- sys.stdout.write(s)
-
-terminals = {
- 'xterm' : 'xterm',
- 'rxvt-256color' : 'rxvt_256color',
- 'rxvt-unicode' : 'rxvt_unicode',
- 'linux' : 'linux',
- 'Eterm' : 'eterm',
- 'screen' : 'screen'
-}
-
-keys = [
- "F1", "kf1",
- "F2", "kf2",
- "F3", "kf3",
- "F4", "kf4",
- "F5", "kf5",
- "F6", "kf6",
- "F7", "kf7",
- "F8", "kf8",
- "F9", "kf9",
- "F10", "kf10",
- "F11", "kf11",
- "F12", "kf12",
- "INSERT", "kich1",
- "DELETE", "kdch1",
- "HOME", "khome",
- "END", "kend",
- "PGUP", "kpp",
- "PGDN", "knp",
- "KEY_UP", "kcuu1",
- "KEY_DOWN", "kcud1",
- "KEY_LEFT", "kcub1",
- "KEY_RIGHT", "kcuf1"
-]
-
-funcs = [
- "T_ENTER_CA", "smcup",
- "T_EXIT_CA", "rmcup",
- "T_SHOW_CURSOR", "cnorm",
- "T_HIDE_CURSOR", "civis",
- "T_CLEAR_SCREEN", "clear",
- "T_SGR0", "sgr0",
- "T_UNDERLINE", "smul",
- "T_BOLD", "bold",
- "T_BLINK", "blink",
- "T_REVERSE", "rev",
- "T_ENTER_KEYPAD", "smkx",
- "T_EXIT_KEYPAD", "rmkx"
-]
-
-def iter_pairs(iterable):
- iterable = iter(iterable)
- while True:
- yield (next(iterable), next(iterable))
-
-def do_term(term, nick):
- w("// %s\n" % term)
- w("var %s_keys = []string{\n\t" % nick)
- for k, v in iter_pairs(keys):
- w('"')
- w(escaped(tput(term, v)))
- w('",')
- w("\n}\n")
- w("var %s_funcs = []string{\n\t" % nick)
- for k,v in iter_pairs(funcs):
- w('"')
- if v == "sgr":
- w("\\033[3%d;4%dm")
- elif v == "cup":
- w("\\033[%d;%dH")
- else:
- w(escaped(tput(term, v)))
- w('", ')
- w("\n}\n\n")
-
-def do_terms(d):
- w("var terms = []struct {\n")
- w("\tname string\n")
- w("\tkeys []string\n")
- w("\tfuncs []string\n")
- w("}{\n")
- for k, v in d.items():
- w('\t{"%s", %s_keys, %s_funcs},\n' % (k, v, v))
- w("}\n\n")
-
-w("// +build !windows\n\npackage termbox\n\n")
-
-for k,v in terminals.items():
- do_term(k, v)
-
-do_terms(terminals)
-
diff --git a/vendor/github.com/awesome-gocui/termbox-go/escwait.go b/vendor/github.com/awesome-gocui/termbox-go/escwait.go
deleted file mode 100644
index b7bbb891fa30347a4c6f404e398124f5677f45ed..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/escwait.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build !darwin
-
-package termbox
-
-// On all systems other than macOS, disable behavior which will wait before
-// deciding that the escape key was pressed, to account for partially send
-// escape sequences, especially with regard to lengthy mouse sequences.
-// See https://github.com/nsf/termbox-go/issues/132
-func enable_wait_for_escape_sequence() bool {
- return false
-}
diff --git a/vendor/github.com/awesome-gocui/termbox-go/escwait_darwin.go b/vendor/github.com/awesome-gocui/termbox-go/escwait_darwin.go
deleted file mode 100644
index dde69b6cbc96a61e72c58f1649a8b9ab25b3f790..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/escwait_darwin.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package termbox
-
-// On macOS, enable behavior which will wait before deciding that the escape
-// key was pressed, to account for partially send escape sequences, especially
-// with regard to lengthy mouse sequences.
-// See https://github.com/nsf/termbox-go/issues/132
-func enable_wait_for_escape_sequence() bool {
- return true
-}
diff --git a/vendor/github.com/awesome-gocui/termbox-go/syscalls.go b/vendor/github.com/awesome-gocui/termbox-go/syscalls.go
deleted file mode 100644
index 4f52bb9af9a18019abe1d202a13a4fba920edd80..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/syscalls.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// +build ignore
-
-package termbox
-
-/*
-#include
-#include
-*/
-import "C"
-
-type syscall_Termios C.struct_termios
-
-const (
- syscall_IGNBRK = C.IGNBRK
- syscall_BRKINT = C.BRKINT
- syscall_PARMRK = C.PARMRK
- syscall_ISTRIP = C.ISTRIP
- syscall_INLCR = C.INLCR
- syscall_IGNCR = C.IGNCR
- syscall_ICRNL = C.ICRNL
- syscall_IXON = C.IXON
- syscall_OPOST = C.OPOST
- syscall_ECHO = C.ECHO
- syscall_ECHONL = C.ECHONL
- syscall_ICANON = C.ICANON
- syscall_ISIG = C.ISIG
- syscall_IEXTEN = C.IEXTEN
- syscall_CSIZE = C.CSIZE
- syscall_PARENB = C.PARENB
- syscall_CS8 = C.CS8
- syscall_VMIN = C.VMIN
- syscall_VTIME = C.VTIME
-
- // on darwin change these to (on *bsd too?):
- // C.TIOCGETA
- // C.TIOCSETA
- syscall_TCGETS = C.TCGETS
- syscall_TCSETS = C.TCSETS
-)
diff --git a/vendor/github.com/awesome-gocui/termbox-go/syscalls_darwin.go b/vendor/github.com/awesome-gocui/termbox-go/syscalls_darwin.go
deleted file mode 100644
index 25b78f7ab70b26b1d114793d553cfbfe39bde809..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/syscalls_darwin.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Created by cgo -godefs - DO NOT EDIT
-// cgo -godefs syscalls.go
-
-// +build !amd64
-
-package termbox
-
-type syscall_Termios struct {
- Iflag uint32
- Oflag uint32
- Cflag uint32
- Lflag uint32
- Cc [20]uint8
- Ispeed uint32
- Ospeed uint32
-}
-
-const (
- syscall_IGNBRK = 0x1
- syscall_BRKINT = 0x2
- syscall_PARMRK = 0x8
- syscall_ISTRIP = 0x20
- syscall_INLCR = 0x40
- syscall_IGNCR = 0x80
- syscall_ICRNL = 0x100
- syscall_IXON = 0x200
- syscall_OPOST = 0x1
- syscall_ECHO = 0x8
- syscall_ECHONL = 0x10
- syscall_ICANON = 0x100
- syscall_ISIG = 0x80
- syscall_IEXTEN = 0x400
- syscall_CSIZE = 0x300
- syscall_PARENB = 0x1000
- syscall_CS8 = 0x300
- syscall_VMIN = 0x10
- syscall_VTIME = 0x11
-
- syscall_TCGETS = 0x402c7413
- syscall_TCSETS = 0x802c7414
-)
diff --git a/vendor/github.com/awesome-gocui/termbox-go/syscalls_darwin_amd64.go b/vendor/github.com/awesome-gocui/termbox-go/syscalls_darwin_amd64.go
deleted file mode 100644
index 11f25be79a4ba739996c913405234f421dff5a32..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/syscalls_darwin_amd64.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Created by cgo -godefs - DO NOT EDIT
-// cgo -godefs syscalls.go
-
-package termbox
-
-type syscall_Termios struct {
- Iflag uint64
- Oflag uint64
- Cflag uint64
- Lflag uint64
- Cc [20]uint8
- Pad_cgo_0 [4]byte
- Ispeed uint64
- Ospeed uint64
-}
-
-const (
- syscall_IGNBRK = 0x1
- syscall_BRKINT = 0x2
- syscall_PARMRK = 0x8
- syscall_ISTRIP = 0x20
- syscall_INLCR = 0x40
- syscall_IGNCR = 0x80
- syscall_ICRNL = 0x100
- syscall_IXON = 0x200
- syscall_OPOST = 0x1
- syscall_ECHO = 0x8
- syscall_ECHONL = 0x10
- syscall_ICANON = 0x100
- syscall_ISIG = 0x80
- syscall_IEXTEN = 0x400
- syscall_CSIZE = 0x300
- syscall_PARENB = 0x1000
- syscall_CS8 = 0x300
- syscall_VMIN = 0x10
- syscall_VTIME = 0x11
-
- syscall_TCGETS = 0x40487413
- syscall_TCSETS = 0x80487414
-)
diff --git a/vendor/github.com/awesome-gocui/termbox-go/syscalls_dragonfly.go b/vendor/github.com/awesome-gocui/termbox-go/syscalls_dragonfly.go
deleted file mode 100644
index e03624ebc71a7f3a3ed6c0bdbed84363c7e3dc62..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/syscalls_dragonfly.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Created by cgo -godefs - DO NOT EDIT
-// cgo -godefs syscalls.go
-
-package termbox
-
-type syscall_Termios struct {
- Iflag uint32
- Oflag uint32
- Cflag uint32
- Lflag uint32
- Cc [20]uint8
- Ispeed uint32
- Ospeed uint32
-}
-
-const (
- syscall_IGNBRK = 0x1
- syscall_BRKINT = 0x2
- syscall_PARMRK = 0x8
- syscall_ISTRIP = 0x20
- syscall_INLCR = 0x40
- syscall_IGNCR = 0x80
- syscall_ICRNL = 0x100
- syscall_IXON = 0x200
- syscall_OPOST = 0x1
- syscall_ECHO = 0x8
- syscall_ECHONL = 0x10
- syscall_ICANON = 0x100
- syscall_ISIG = 0x80
- syscall_IEXTEN = 0x400
- syscall_CSIZE = 0x300
- syscall_PARENB = 0x1000
- syscall_CS8 = 0x300
- syscall_VMIN = 0x10
- syscall_VTIME = 0x11
-
- syscall_TCGETS = 0x402c7413
- syscall_TCSETS = 0x802c7414
-)
diff --git a/vendor/github.com/awesome-gocui/termbox-go/syscalls_freebsd.go b/vendor/github.com/awesome-gocui/termbox-go/syscalls_freebsd.go
deleted file mode 100644
index e03624ebc71a7f3a3ed6c0bdbed84363c7e3dc62..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/syscalls_freebsd.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Created by cgo -godefs - DO NOT EDIT
-// cgo -godefs syscalls.go
-
-package termbox
-
-type syscall_Termios struct {
- Iflag uint32
- Oflag uint32
- Cflag uint32
- Lflag uint32
- Cc [20]uint8
- Ispeed uint32
- Ospeed uint32
-}
-
-const (
- syscall_IGNBRK = 0x1
- syscall_BRKINT = 0x2
- syscall_PARMRK = 0x8
- syscall_ISTRIP = 0x20
- syscall_INLCR = 0x40
- syscall_IGNCR = 0x80
- syscall_ICRNL = 0x100
- syscall_IXON = 0x200
- syscall_OPOST = 0x1
- syscall_ECHO = 0x8
- syscall_ECHONL = 0x10
- syscall_ICANON = 0x100
- syscall_ISIG = 0x80
- syscall_IEXTEN = 0x400
- syscall_CSIZE = 0x300
- syscall_PARENB = 0x1000
- syscall_CS8 = 0x300
- syscall_VMIN = 0x10
- syscall_VTIME = 0x11
-
- syscall_TCGETS = 0x402c7413
- syscall_TCSETS = 0x802c7414
-)
diff --git a/vendor/github.com/awesome-gocui/termbox-go/syscalls_linux.go b/vendor/github.com/awesome-gocui/termbox-go/syscalls_linux.go
deleted file mode 100644
index b88960de617c3475e96b21190a818d40e05ad87e..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/syscalls_linux.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Created by cgo -godefs - DO NOT EDIT
-// cgo -godefs syscalls.go
-
-package termbox
-
-import "syscall"
-
-type syscall_Termios syscall.Termios
-
-const (
- syscall_IGNBRK = syscall.IGNBRK
- syscall_BRKINT = syscall.BRKINT
- syscall_PARMRK = syscall.PARMRK
- syscall_ISTRIP = syscall.ISTRIP
- syscall_INLCR = syscall.INLCR
- syscall_IGNCR = syscall.IGNCR
- syscall_ICRNL = syscall.ICRNL
- syscall_IXON = syscall.IXON
- syscall_OPOST = syscall.OPOST
- syscall_ECHO = syscall.ECHO
- syscall_ECHONL = syscall.ECHONL
- syscall_ICANON = syscall.ICANON
- syscall_ISIG = syscall.ISIG
- syscall_IEXTEN = syscall.IEXTEN
- syscall_CSIZE = syscall.CSIZE
- syscall_PARENB = syscall.PARENB
- syscall_CS8 = syscall.CS8
- syscall_VMIN = syscall.VMIN
- syscall_VTIME = syscall.VTIME
-
- syscall_TCGETS = syscall.TCGETS
- syscall_TCSETS = syscall.TCSETS
-)
diff --git a/vendor/github.com/awesome-gocui/termbox-go/syscalls_netbsd.go b/vendor/github.com/awesome-gocui/termbox-go/syscalls_netbsd.go
deleted file mode 100644
index 49a3355b9a2dddc38fefdbb4581432bf942bb537..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/syscalls_netbsd.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Created by cgo -godefs - DO NOT EDIT
-// cgo -godefs syscalls.go
-
-package termbox
-
-type syscall_Termios struct {
- Iflag uint32
- Oflag uint32
- Cflag uint32
- Lflag uint32
- Cc [20]uint8
- Ispeed int32
- Ospeed int32
-}
-
-const (
- syscall_IGNBRK = 0x1
- syscall_BRKINT = 0x2
- syscall_PARMRK = 0x8
- syscall_ISTRIP = 0x20
- syscall_INLCR = 0x40
- syscall_IGNCR = 0x80
- syscall_ICRNL = 0x100
- syscall_IXON = 0x200
- syscall_OPOST = 0x1
- syscall_ECHO = 0x8
- syscall_ECHONL = 0x10
- syscall_ICANON = 0x100
- syscall_ISIG = 0x80
- syscall_IEXTEN = 0x400
- syscall_CSIZE = 0x300
- syscall_PARENB = 0x1000
- syscall_CS8 = 0x300
- syscall_VMIN = 0x10
- syscall_VTIME = 0x11
-
- syscall_TCGETS = 0x402c7413
- syscall_TCSETS = 0x802c7414
-)
diff --git a/vendor/github.com/awesome-gocui/termbox-go/syscalls_openbsd.go b/vendor/github.com/awesome-gocui/termbox-go/syscalls_openbsd.go
deleted file mode 100644
index 49a3355b9a2dddc38fefdbb4581432bf942bb537..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/syscalls_openbsd.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Created by cgo -godefs - DO NOT EDIT
-// cgo -godefs syscalls.go
-
-package termbox
-
-type syscall_Termios struct {
- Iflag uint32
- Oflag uint32
- Cflag uint32
- Lflag uint32
- Cc [20]uint8
- Ispeed int32
- Ospeed int32
-}
-
-const (
- syscall_IGNBRK = 0x1
- syscall_BRKINT = 0x2
- syscall_PARMRK = 0x8
- syscall_ISTRIP = 0x20
- syscall_INLCR = 0x40
- syscall_IGNCR = 0x80
- syscall_ICRNL = 0x100
- syscall_IXON = 0x200
- syscall_OPOST = 0x1
- syscall_ECHO = 0x8
- syscall_ECHONL = 0x10
- syscall_ICANON = 0x100
- syscall_ISIG = 0x80
- syscall_IEXTEN = 0x400
- syscall_CSIZE = 0x300
- syscall_PARENB = 0x1000
- syscall_CS8 = 0x300
- syscall_VMIN = 0x10
- syscall_VTIME = 0x11
-
- syscall_TCGETS = 0x402c7413
- syscall_TCSETS = 0x802c7414
-)
diff --git a/vendor/github.com/awesome-gocui/termbox-go/syscalls_windows.go b/vendor/github.com/awesome-gocui/termbox-go/syscalls_windows.go
deleted file mode 100644
index 472d002a56aa69c4cc1d9a290f5aa51eb107fc88..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/syscalls_windows.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Created by cgo -godefs - DO NOT EDIT
-// cgo -godefs -- -DUNICODE syscalls.go
-
-package termbox
-
-const (
- foreground_blue = 0x1
- foreground_green = 0x2
- foreground_red = 0x4
- foreground_intensity = 0x8
- background_blue = 0x10
- background_green = 0x20
- background_red = 0x40
- background_intensity = 0x80
- std_input_handle = -0xa
- std_output_handle = -0xb
- key_event = 0x1
- mouse_event = 0x2
- window_buffer_size_event = 0x4
- enable_window_input = 0x8
- enable_mouse_input = 0x10
- enable_extended_flags = 0x80
-
- vk_f1 = 0x70
- vk_f2 = 0x71
- vk_f3 = 0x72
- vk_f4 = 0x73
- vk_f5 = 0x74
- vk_f6 = 0x75
- vk_f7 = 0x76
- vk_f8 = 0x77
- vk_f9 = 0x78
- vk_f10 = 0x79
- vk_f11 = 0x7a
- vk_f12 = 0x7b
- vk_insert = 0x2d
- vk_delete = 0x2e
- vk_home = 0x24
- vk_end = 0x23
- vk_pgup = 0x21
- vk_pgdn = 0x22
- vk_arrow_up = 0x26
- vk_arrow_down = 0x28
- vk_arrow_left = 0x25
- vk_arrow_right = 0x27
- vk_backspace = 0x8
- vk_tab = 0x9
- vk_enter = 0xd
- vk_esc = 0x1b
- vk_space = 0x20
-
- left_alt_pressed = 0x2
- left_ctrl_pressed = 0x8
- right_alt_pressed = 0x1
- right_ctrl_pressed = 0x4
- shift_pressed = 0x10
-
- generic_read = 0x80000000
- generic_write = 0x40000000
- console_textmode_buffer = 0x1
-)
diff --git a/vendor/github.com/awesome-gocui/termbox-go/termbox.go b/vendor/github.com/awesome-gocui/termbox-go/termbox.go
deleted file mode 100644
index fbe4c3de9d2f80a1945c445d90c54873aa3d8f2b..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/termbox.go
+++ /dev/null
@@ -1,529 +0,0 @@
-// +build !windows
-
-package termbox
-
-import "unicode/utf8"
-import "bytes"
-import "syscall"
-import "unsafe"
-import "strings"
-import "strconv"
-import "os"
-import "io"
-
-// private API
-
-const (
- t_enter_ca = iota
- t_exit_ca
- t_show_cursor
- t_hide_cursor
- t_clear_screen
- t_sgr0
- t_underline
- t_bold
- t_blink
- t_reverse
- t_enter_keypad
- t_exit_keypad
- t_enter_mouse
- t_exit_mouse
- t_max_funcs
-)
-
-const (
- coord_invalid = -2
- attr_invalid = Attribute(0xFFFF)
-)
-
-type input_event struct {
- data []byte
- err error
-}
-
-type extract_event_res int
-
-const (
- event_not_extracted extract_event_res = iota
- event_extracted
- esc_wait
-)
-
-var (
- // term specific sequences
- keys []string
- funcs []string
-
- // termbox inner state
- orig_tios syscall_Termios
- back_buffer cellbuf
- front_buffer cellbuf
- termw int
- termh int
- input_mode = InputEsc
- output_mode = OutputNormal
- out *os.File
- in int
- lastfg = attr_invalid
- lastbg = attr_invalid
- lastx = coord_invalid
- lasty = coord_invalid
- cursor_x = cursor_hidden
- cursor_y = cursor_hidden
- foreground = ColorDefault
- background = ColorDefault
- inbuf = make([]byte, 0, 64)
- outbuf bytes.Buffer
- sigwinch = make(chan os.Signal, 1)
- sigio = make(chan os.Signal, 1)
- quit = make(chan int)
- input_comm = make(chan input_event)
- interrupt_comm = make(chan struct{})
- intbuf = make([]byte, 0, 16)
-
- // grayscale indexes
- grayscale = []Attribute{
- 0, 17, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
- 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 232,
- }
-)
-
-func write_cursor(x, y int) {
- outbuf.WriteString("\033[")
- outbuf.Write(strconv.AppendUint(intbuf, uint64(y+1), 10))
- outbuf.WriteString(";")
- outbuf.Write(strconv.AppendUint(intbuf, uint64(x+1), 10))
- outbuf.WriteString("H")
-}
-
-func write_sgr_fg(a Attribute) {
- switch output_mode {
- case Output256, Output216, OutputGrayscale:
- outbuf.WriteString("\033[38;5;")
- outbuf.Write(strconv.AppendUint(intbuf, uint64(a-1), 10))
- outbuf.WriteString("m")
- default:
- outbuf.WriteString("\033[3")
- outbuf.Write(strconv.AppendUint(intbuf, uint64(a-1), 10))
- outbuf.WriteString("m")
- }
-}
-
-func write_sgr_bg(a Attribute) {
- switch output_mode {
- case Output256, Output216, OutputGrayscale:
- outbuf.WriteString("\033[48;5;")
- outbuf.Write(strconv.AppendUint(intbuf, uint64(a-1), 10))
- outbuf.WriteString("m")
- default:
- outbuf.WriteString("\033[4")
- outbuf.Write(strconv.AppendUint(intbuf, uint64(a-1), 10))
- outbuf.WriteString("m")
- }
-}
-
-func write_sgr(fg, bg Attribute) {
- switch output_mode {
- case Output256, Output216, OutputGrayscale:
- outbuf.WriteString("\033[38;5;")
- outbuf.Write(strconv.AppendUint(intbuf, uint64(fg-1), 10))
- outbuf.WriteString("m")
- outbuf.WriteString("\033[48;5;")
- outbuf.Write(strconv.AppendUint(intbuf, uint64(bg-1), 10))
- outbuf.WriteString("m")
- default:
- outbuf.WriteString("\033[3")
- outbuf.Write(strconv.AppendUint(intbuf, uint64(fg-1), 10))
- outbuf.WriteString(";4")
- outbuf.Write(strconv.AppendUint(intbuf, uint64(bg-1), 10))
- outbuf.WriteString("m")
- }
-}
-
-type winsize struct {
- rows uint16
- cols uint16
- xpixels uint16
- ypixels uint16
-}
-
-func get_term_size(fd uintptr) (int, int) {
- var sz winsize
- _, _, _ = syscall.Syscall(syscall.SYS_IOCTL,
- fd, uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(&sz)))
- return int(sz.cols), int(sz.rows)
-}
-
-func send_attr(fg, bg Attribute) {
- if fg == lastfg && bg == lastbg {
- return
- }
-
- outbuf.WriteString(funcs[t_sgr0])
-
- var fgcol, bgcol Attribute
-
- switch output_mode {
- case Output256:
- fgcol = fg & 0x1FF
- bgcol = bg & 0x1FF
- case Output216:
- fgcol = fg & 0xFF
- bgcol = bg & 0xFF
- if fgcol > 216 {
- fgcol = ColorDefault
- }
- if bgcol > 216 {
- bgcol = ColorDefault
- }
- if fgcol != ColorDefault {
- fgcol += 0x10
- }
- if bgcol != ColorDefault {
- bgcol += 0x10
- }
- case OutputGrayscale:
- fgcol = fg & 0x1F
- bgcol = bg & 0x1F
- if fgcol > 26 {
- fgcol = ColorDefault
- }
- if bgcol > 26 {
- bgcol = ColorDefault
- }
- if fgcol != ColorDefault {
- fgcol = grayscale[fgcol]
- }
- if bgcol != ColorDefault {
- bgcol = grayscale[bgcol]
- }
- default:
- fgcol = fg & 0x0F
- bgcol = bg & 0x0F
- }
-
- if fgcol != ColorDefault {
- if bgcol != ColorDefault {
- write_sgr(fgcol, bgcol)
- } else {
- write_sgr_fg(fgcol)
- }
- } else if bgcol != ColorDefault {
- write_sgr_bg(bgcol)
- }
-
- if fg&AttrBold != 0 {
- outbuf.WriteString(funcs[t_bold])
- }
- if bg&AttrBold != 0 {
- outbuf.WriteString(funcs[t_blink])
- }
- if fg&AttrUnderline != 0 {
- outbuf.WriteString(funcs[t_underline])
- }
- if fg&AttrReverse|bg&AttrReverse != 0 {
- outbuf.WriteString(funcs[t_reverse])
- }
-
- lastfg, lastbg = fg, bg
-}
-
-func send_char(x, y int, ch rune) {
- var buf [8]byte
- n := utf8.EncodeRune(buf[:], ch)
- if x-1 != lastx || y != lasty {
- write_cursor(x, y)
- }
- lastx, lasty = x, y
- outbuf.Write(buf[:n])
-}
-
-func flush() error {
- _, err := io.Copy(out, &outbuf)
- outbuf.Reset()
- return err
-}
-
-func send_clear() error {
- send_attr(foreground, background)
- outbuf.WriteString(funcs[t_clear_screen])
- if !is_cursor_hidden(cursor_x, cursor_y) {
- write_cursor(cursor_x, cursor_y)
- }
-
- // we need to invalidate cursor position too and these two vars are
- // used only for simple cursor positioning optimization, cursor
- // actually may be in the correct place, but we simply discard
- // optimization once and it gives us simple solution for the case when
- // cursor moved
- lastx = coord_invalid
- lasty = coord_invalid
-
- return flush()
-}
-
-func update_size_maybe() error {
- w, h := get_term_size(out.Fd())
- if w != termw || h != termh {
- termw, termh = w, h
- back_buffer.resize(termw, termh)
- front_buffer.resize(termw, termh)
- front_buffer.clear()
- return send_clear()
- }
- return nil
-}
-
-func tcsetattr(fd uintptr, termios *syscall_Termios) error {
- r, _, e := syscall.Syscall(syscall.SYS_IOCTL,
- fd, uintptr(syscall_TCSETS), uintptr(unsafe.Pointer(termios)))
- if r != 0 {
- return os.NewSyscallError("SYS_IOCTL", e)
- }
- return nil
-}
-
-func tcgetattr(fd uintptr, termios *syscall_Termios) error {
- r, _, e := syscall.Syscall(syscall.SYS_IOCTL,
- fd, uintptr(syscall_TCGETS), uintptr(unsafe.Pointer(termios)))
- if r != 0 {
- return os.NewSyscallError("SYS_IOCTL", e)
- }
- return nil
-}
-
-func parse_mouse_event(event *Event, buf string) (int, bool) {
- if strings.HasPrefix(buf, "\033[M") && len(buf) >= 6 {
- // X10 mouse encoding, the simplest one
- // \033 [ M Cb Cx Cy
- b := buf[3] - 32
- switch b & 3 {
- case 0:
- if b&64 != 0 {
- event.Key = MouseWheelUp
- } else {
- event.Key = MouseLeft
- }
- case 1:
- if b&64 != 0 {
- event.Key = MouseWheelDown
- } else {
- event.Key = MouseMiddle
- }
- case 2:
- event.Key = MouseRight
- case 3:
- event.Key = MouseRelease
- default:
- return 6, false
- }
- event.Type = EventMouse // KeyEvent by default
- if b&32 != 0 {
- event.Mod |= ModMotion
- }
-
- // the coord is 1,1 for upper left
- event.MouseX = int(buf[4]) - 1 - 32
- event.MouseY = int(buf[5]) - 1 - 32
- return 6, true
- } else if strings.HasPrefix(buf, "\033[<") || strings.HasPrefix(buf, "\033[") {
- // xterm 1006 extended mode or urxvt 1015 extended mode
- // xterm: \033 [ < Cb ; Cx ; Cy (M or m)
- // urxvt: \033 [ Cb ; Cx ; Cy M
-
- // find the first M or m, that's where we stop
- mi := strings.IndexAny(buf, "Mm")
- if mi == -1 {
- return 0, false
- }
-
- // whether it's a capital M or not
- isM := buf[mi] == 'M'
-
- // whether it's urxvt or not
- isU := false
-
- // buf[2] is safe here, because having M or m found means we have at
- // least 3 bytes in a string
- if buf[2] == '<' {
- buf = buf[3:mi]
- } else {
- isU = true
- buf = buf[2:mi]
- }
-
- s1 := strings.Index(buf, ";")
- s2 := strings.LastIndex(buf, ";")
- // not found or only one ';'
- if s1 == -1 || s2 == -1 || s1 == s2 {
- return 0, false
- }
-
- n1, err := strconv.ParseInt(buf[0:s1], 10, 64)
- if err != nil {
- return 0, false
- }
- n2, err := strconv.ParseInt(buf[s1+1:s2], 10, 64)
- if err != nil {
- return 0, false
- }
- n3, err := strconv.ParseInt(buf[s2+1:], 10, 64)
- if err != nil {
- return 0, false
- }
-
- // on urxvt, first number is encoded exactly as in X10, but we need to
- // make it zero-based, on xterm it is zero-based already
- if isU {
- n1 -= 32
- }
- switch n1 & 3 {
- case 0:
- if n1&64 != 0 {
- event.Key = MouseWheelUp
- } else {
- event.Key = MouseLeft
- }
- case 1:
- if n1&64 != 0 {
- event.Key = MouseWheelDown
- } else {
- event.Key = MouseMiddle
- }
- case 2:
- event.Key = MouseRight
- case 3:
- event.Key = MouseRelease
- default:
- return mi + 1, false
- }
- if !isM {
- // on xterm mouse release is signaled by lowercase m
- event.Key = MouseRelease
- }
-
- event.Type = EventMouse // KeyEvent by default
- if n1&32 != 0 {
- event.Mod |= ModMotion
- }
-
- event.MouseX = int(n2) - 1
- event.MouseY = int(n3) - 1
- return mi + 1, true
- }
-
- return 0, false
-}
-
-func parse_escape_sequence(event *Event, buf []byte) (int, bool) {
- bufstr := string(buf)
- for i, key := range keys {
- if strings.HasPrefix(bufstr, key) {
- event.Ch = 0
- event.Key = Key(0xFFFF - i)
- return len(key), true
- }
- }
-
- // if none of the keys match, let's try mouse sequences
- return parse_mouse_event(event, bufstr)
-}
-
-func extract_raw_event(data []byte, event *Event) bool {
- if len(inbuf) == 0 {
- return false
- }
-
- n := len(data)
- if n == 0 {
- return false
- }
-
- n = copy(data, inbuf)
- copy(inbuf, inbuf[n:])
- inbuf = inbuf[:len(inbuf)-n]
-
- event.N = n
- event.Type = EventRaw
- return true
-}
-
-func extract_event(inbuf []byte, event *Event, allow_esc_wait bool) extract_event_res {
- if len(inbuf) == 0 {
- event.N = 0
- return event_not_extracted
- }
-
- if inbuf[0] == '\033' {
- // possible escape sequence
- if n, ok := parse_escape_sequence(event, inbuf); n != 0 {
- event.N = n
- if ok {
- return event_extracted
- } else {
- return event_not_extracted
- }
- }
-
- // possible partially read escape sequence; trigger a wait if appropriate
- if enable_wait_for_escape_sequence() && allow_esc_wait {
- event.N = 0
- return esc_wait
- }
-
- // it's not escape sequence, then it's Alt or Esc, check input_mode
- switch {
- case input_mode&InputEsc != 0:
- // if we're in escape mode, fill Esc event, pop buffer, return success
- event.Ch = 0
- event.Key = KeyEsc
- event.Mod = 0
- event.N = 1
- return event_extracted
- case input_mode&InputAlt != 0:
- // if we're in alt mode, set Alt modifier to event and redo parsing
- event.Mod = ModAlt
- status := extract_event(inbuf[1:], event, false)
- if status == event_extracted {
- event.N++
- } else {
- event.N = 0
- }
- return status
- default:
- panic("unreachable")
- }
- }
-
- // if we're here, this is not an escape sequence and not an alt sequence
- // so, it's a FUNCTIONAL KEY or a UNICODE character
-
- // first of all check if it's a functional key
- if Key(inbuf[0]) <= KeySpace || Key(inbuf[0]) == KeyBackspace2 {
- // fill event, pop buffer, return success
- event.Ch = 0
- event.Key = Key(inbuf[0])
- event.N = 1
- return event_extracted
- }
-
- // the only possible option is utf8 rune
- if r, n := utf8.DecodeRune(inbuf); r != utf8.RuneError {
- event.Ch = r
- event.Key = 0
- event.N = n
- return event_extracted
- }
-
- return event_not_extracted
-}
-
-func fcntl(fd int, cmd int, arg int) (val int, err error) {
- r, _, e := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), uintptr(cmd),
- uintptr(arg))
- val = int(r)
- if e != 0 {
- err = e
- }
- return
-}
diff --git a/vendor/github.com/awesome-gocui/termbox-go/termbox_common.go b/vendor/github.com/awesome-gocui/termbox-go/termbox_common.go
deleted file mode 100644
index c3355cc25e38f7e84ece4b87a1e0488cc682ee1d..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/termbox_common.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package termbox
-
-// private API, common OS agnostic part
-
-type cellbuf struct {
- width int
- height int
- cells []Cell
-}
-
-func (this *cellbuf) init(width, height int) {
- this.width = width
- this.height = height
- this.cells = make([]Cell, width*height)
-}
-
-func (this *cellbuf) resize(width, height int) {
- if this.width == width && this.height == height {
- return
- }
-
- oldw := this.width
- oldh := this.height
- oldcells := this.cells
-
- this.init(width, height)
- this.clear()
-
- minw, minh := oldw, oldh
-
- if width < minw {
- minw = width
- }
- if height < minh {
- minh = height
- }
-
- for i := 0; i < minh; i++ {
- srco, dsto := i*oldw, i*width
- src := oldcells[srco : srco+minw]
- dst := this.cells[dsto : dsto+minw]
- copy(dst, src)
- }
-}
-
-func (this *cellbuf) clear() {
- for i := range this.cells {
- c := &this.cells[i]
- c.Ch = ' '
- c.Fg = foreground
- c.Bg = background
- }
-}
-
-const cursor_hidden = -1
-
-func is_cursor_hidden(x, y int) bool {
- return x == cursor_hidden || y == cursor_hidden
-}
diff --git a/vendor/github.com/awesome-gocui/termbox-go/termbox_windows.go b/vendor/github.com/awesome-gocui/termbox-go/termbox_windows.go
deleted file mode 100644
index 22e0f9ea054220256083986e50965c30bbcc6676..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/termbox_windows.go
+++ /dev/null
@@ -1,948 +0,0 @@
-package termbox
-
-import "math"
-import "syscall"
-import "unsafe"
-import "unicode/utf16"
-import "github.com/mattn/go-runewidth"
-
-type (
- wchar uint16
- short int16
- dword uint32
- word uint16
- char_info struct {
- char wchar
- attr word
- }
- coord struct {
- x short
- y short
- }
- small_rect struct {
- left short
- top short
- right short
- bottom short
- }
- console_screen_buffer_info struct {
- size coord
- cursor_position coord
- attributes word
- window small_rect
- maximum_window_size coord
- }
- console_cursor_info struct {
- size dword
- visible int32
- }
- input_record struct {
- event_type word
- _ [2]byte
- event [16]byte
- }
- key_event_record struct {
- key_down int32
- repeat_count word
- virtual_key_code word
- virtual_scan_code word
- unicode_char wchar
- control_key_state dword
- }
- window_buffer_size_record struct {
- size coord
- }
- mouse_event_record struct {
- mouse_pos coord
- button_state dword
- control_key_state dword
- event_flags dword
- }
- console_font_info struct {
- font uint32
- font_size coord
- }
-)
-
-const (
- mouse_lmb = 0x1
- mouse_rmb = 0x2
- mouse_mmb = 0x4 | 0x8 | 0x10
- SM_CXMIN = 28
- SM_CYMIN = 29
-)
-
-func (this coord) uintptr() uintptr {
- return uintptr(*(*int32)(unsafe.Pointer(&this)))
-}
-
-func (this *small_rect) uintptr() uintptr {
- return uintptr(unsafe.Pointer(this))
-}
-
-var kernel32 = syscall.NewLazyDLL("kernel32.dll")
-var moduser32 = syscall.NewLazyDLL("user32.dll")
-var is_cjk = runewidth.IsEastAsian()
-
-var (
- proc_set_console_active_screen_buffer = kernel32.NewProc("SetConsoleActiveScreenBuffer")
- proc_set_console_screen_buffer_size = kernel32.NewProc("SetConsoleScreenBufferSize")
- proc_set_console_window_info = kernel32.NewProc("SetConsoleWindowInfo")
- proc_create_console_screen_buffer = kernel32.NewProc("CreateConsoleScreenBuffer")
- proc_get_console_screen_buffer_info = kernel32.NewProc("GetConsoleScreenBufferInfo")
- proc_write_console_output = kernel32.NewProc("WriteConsoleOutputW")
- proc_write_console_output_character = kernel32.NewProc("WriteConsoleOutputCharacterW")
- proc_write_console_output_attribute = kernel32.NewProc("WriteConsoleOutputAttribute")
- proc_set_console_cursor_info = kernel32.NewProc("SetConsoleCursorInfo")
- proc_set_console_cursor_position = kernel32.NewProc("SetConsoleCursorPosition")
- proc_get_console_cursor_info = kernel32.NewProc("GetConsoleCursorInfo")
- proc_read_console_input = kernel32.NewProc("ReadConsoleInputW")
- proc_get_console_mode = kernel32.NewProc("GetConsoleMode")
- proc_set_console_mode = kernel32.NewProc("SetConsoleMode")
- proc_fill_console_output_character = kernel32.NewProc("FillConsoleOutputCharacterW")
- proc_fill_console_output_attribute = kernel32.NewProc("FillConsoleOutputAttribute")
- proc_create_event = kernel32.NewProc("CreateEventW")
- proc_wait_for_multiple_objects = kernel32.NewProc("WaitForMultipleObjects")
- proc_set_event = kernel32.NewProc("SetEvent")
- proc_get_current_console_font = kernel32.NewProc("GetCurrentConsoleFont")
- get_system_metrics = moduser32.NewProc("GetSystemMetrics")
-)
-
-func set_console_active_screen_buffer(h syscall.Handle) (err error) {
- r0, _, e1 := syscall.Syscall(proc_set_console_active_screen_buffer.Addr(),
- 1, uintptr(h), 0, 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func set_console_screen_buffer_size(h syscall.Handle, size coord) (err error) {
- r0, _, e1 := syscall.Syscall(proc_set_console_screen_buffer_size.Addr(),
- 2, uintptr(h), size.uintptr(), 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func set_console_window_info(h syscall.Handle, window *small_rect) (err error) {
- var absolute uint32
- absolute = 1
- r0, _, e1 := syscall.Syscall(proc_set_console_window_info.Addr(),
- 3, uintptr(h), uintptr(absolute), window.uintptr())
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func create_console_screen_buffer() (h syscall.Handle, err error) {
- r0, _, e1 := syscall.Syscall6(proc_create_console_screen_buffer.Addr(),
- 5, uintptr(generic_read|generic_write), 0, 0, console_textmode_buffer, 0, 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return syscall.Handle(r0), err
-}
-
-func get_console_screen_buffer_info(h syscall.Handle, info *console_screen_buffer_info) (err error) {
- r0, _, e1 := syscall.Syscall(proc_get_console_screen_buffer_info.Addr(),
- 2, uintptr(h), uintptr(unsafe.Pointer(info)), 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func write_console_output(h syscall.Handle, chars []char_info, dst small_rect) (err error) {
- tmp_coord = coord{dst.right - dst.left + 1, dst.bottom - dst.top + 1}
- tmp_rect = dst
- r0, _, e1 := syscall.Syscall6(proc_write_console_output.Addr(),
- 5, uintptr(h), uintptr(unsafe.Pointer(&chars[0])), tmp_coord.uintptr(),
- tmp_coord0.uintptr(), uintptr(unsafe.Pointer(&tmp_rect)), 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func write_console_output_character(h syscall.Handle, chars []wchar, pos coord) (err error) {
- r0, _, e1 := syscall.Syscall6(proc_write_console_output_character.Addr(),
- 5, uintptr(h), uintptr(unsafe.Pointer(&chars[0])), uintptr(len(chars)),
- pos.uintptr(), uintptr(unsafe.Pointer(&tmp_arg)), 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func write_console_output_attribute(h syscall.Handle, attrs []word, pos coord) (err error) {
- r0, _, e1 := syscall.Syscall6(proc_write_console_output_attribute.Addr(),
- 5, uintptr(h), uintptr(unsafe.Pointer(&attrs[0])), uintptr(len(attrs)),
- pos.uintptr(), uintptr(unsafe.Pointer(&tmp_arg)), 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func set_console_cursor_info(h syscall.Handle, info *console_cursor_info) (err error) {
- r0, _, e1 := syscall.Syscall(proc_set_console_cursor_info.Addr(),
- 2, uintptr(h), uintptr(unsafe.Pointer(info)), 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func get_console_cursor_info(h syscall.Handle, info *console_cursor_info) (err error) {
- r0, _, e1 := syscall.Syscall(proc_get_console_cursor_info.Addr(),
- 2, uintptr(h), uintptr(unsafe.Pointer(info)), 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func set_console_cursor_position(h syscall.Handle, pos coord) (err error) {
- r0, _, e1 := syscall.Syscall(proc_set_console_cursor_position.Addr(),
- 2, uintptr(h), pos.uintptr(), 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func read_console_input(h syscall.Handle, record *input_record) (err error) {
- r0, _, e1 := syscall.Syscall6(proc_read_console_input.Addr(),
- 4, uintptr(h), uintptr(unsafe.Pointer(record)), 1, uintptr(unsafe.Pointer(&tmp_arg)), 0, 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func get_console_mode(h syscall.Handle, mode *dword) (err error) {
- r0, _, e1 := syscall.Syscall(proc_get_console_mode.Addr(),
- 2, uintptr(h), uintptr(unsafe.Pointer(mode)), 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func set_console_mode(h syscall.Handle, mode dword) (err error) {
- r0, _, e1 := syscall.Syscall(proc_set_console_mode.Addr(),
- 2, uintptr(h), uintptr(mode), 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func fill_console_output_character(h syscall.Handle, char wchar, n int) (err error) {
- tmp_coord = coord{0, 0}
- r0, _, e1 := syscall.Syscall6(proc_fill_console_output_character.Addr(),
- 5, uintptr(h), uintptr(char), uintptr(n), tmp_coord.uintptr(),
- uintptr(unsafe.Pointer(&tmp_arg)), 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func fill_console_output_attribute(h syscall.Handle, attr word, n int) (err error) {
- tmp_coord = coord{0, 0}
- r0, _, e1 := syscall.Syscall6(proc_fill_console_output_attribute.Addr(),
- 5, uintptr(h), uintptr(attr), uintptr(n), tmp_coord.uintptr(),
- uintptr(unsafe.Pointer(&tmp_arg)), 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func create_event() (out syscall.Handle, err error) {
- r0, _, e1 := syscall.Syscall6(proc_create_event.Addr(),
- 4, 0, 0, 0, 0, 0, 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return syscall.Handle(r0), err
-}
-
-func wait_for_multiple_objects(objects []syscall.Handle) (err error) {
- r0, _, e1 := syscall.Syscall6(proc_wait_for_multiple_objects.Addr(),
- 4, uintptr(len(objects)), uintptr(unsafe.Pointer(&objects[0])),
- 0, 0xFFFFFFFF, 0, 0)
- if uint32(r0) == 0xFFFFFFFF {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func set_event(ev syscall.Handle) (err error) {
- r0, _, e1 := syscall.Syscall(proc_set_event.Addr(),
- 1, uintptr(ev), 0, 0)
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-func get_current_console_font(h syscall.Handle, info *console_font_info) (err error) {
- r0, _, e1 := syscall.Syscall(proc_get_current_console_font.Addr(),
- 3, uintptr(h), 0, uintptr(unsafe.Pointer(info)))
- if int(r0) == 0 {
- if e1 != 0 {
- err = error(e1)
- } else {
- err = syscall.EINVAL
- }
- }
- return
-}
-
-type diff_msg struct {
- pos short
- lines short
- chars []char_info
-}
-
-type input_event struct {
- event Event
- err error
-}
-
-var (
- orig_cursor_info console_cursor_info
- orig_size coord
- orig_window small_rect
- orig_mode dword
- orig_screen syscall.Handle
- back_buffer cellbuf
- front_buffer cellbuf
- term_size coord
- input_mode = InputEsc
- cursor_x = cursor_hidden
- cursor_y = cursor_hidden
- foreground = ColorDefault
- background = ColorDefault
- in syscall.Handle
- out syscall.Handle
- interrupt syscall.Handle
- charbuf []char_info
- diffbuf []diff_msg
- beg_x = -1
- beg_y = -1
- beg_i = -1
- input_comm = make(chan Event)
- interrupt_comm = make(chan struct{})
- cancel_comm = make(chan bool, 1)
- cancel_done_comm = make(chan bool)
- alt_mode_esc = false
-
- // these ones just to prevent heap allocs at all costs
- tmp_info console_screen_buffer_info
- tmp_arg dword
- tmp_coord0 = coord{0, 0}
- tmp_coord = coord{0, 0}
- tmp_rect = small_rect{0, 0, 0, 0}
- tmp_finfo console_font_info
-)
-
-func get_cursor_position(out syscall.Handle) coord {
- err := get_console_screen_buffer_info(out, &tmp_info)
- if err != nil {
- panic(err)
- }
- return tmp_info.cursor_position
-}
-
-func get_term_size(out syscall.Handle) (coord, small_rect) {
- err := get_console_screen_buffer_info(out, &tmp_info)
- if err != nil {
- panic(err)
- }
- return tmp_info.size, tmp_info.window
-}
-
-func get_win_min_size(out syscall.Handle) coord {
- x, _, err := get_system_metrics.Call(SM_CXMIN)
- y, _, err := get_system_metrics.Call(SM_CYMIN)
-
- if x == 0 || y == 0 {
- if err != nil {
- panic(err)
- }
- }
-
- err1 := get_current_console_font(out, &tmp_finfo)
- if err1 != nil {
- panic(err1)
- }
-
- return coord{
- x: short(math.Ceil(float64(x) / float64(tmp_finfo.font_size.x))),
- y: short(math.Ceil(float64(y) / float64(tmp_finfo.font_size.y))),
- }
-}
-
-func get_win_size(out syscall.Handle) coord {
- err := get_console_screen_buffer_info(out, &tmp_info)
- if err != nil {
- panic(err)
- }
-
- min_size := get_win_min_size(out)
-
- size := coord{
- x: tmp_info.window.right - tmp_info.window.left + 1,
- y: tmp_info.window.bottom - tmp_info.window.top + 1,
- }
-
- if size.x < min_size.x {
- size.x = min_size.x
- }
-
- if size.y < min_size.y {
- size.y = min_size.y
- }
-
- return size
-}
-
-func fix_win_size(out syscall.Handle, size coord) (err error) {
- window := small_rect{}
- window.top = 0
- window.bottom = size.y - 1
- window.left = 0
- window.right = size.x - 1
- return set_console_window_info(out, &window)
-}
-
-func update_size_maybe() {
- size := get_win_size(out)
- if size.x != term_size.x || size.y != term_size.y {
- set_console_screen_buffer_size(out, size)
- fix_win_size(out, size)
- term_size = size
- back_buffer.resize(int(size.x), int(size.y))
- front_buffer.resize(int(size.x), int(size.y))
- front_buffer.clear()
- clear()
-
- area := int(size.x) * int(size.y)
- if cap(charbuf) < area {
- charbuf = make([]char_info, 0, area)
- }
- }
-}
-
-var color_table_bg = []word{
- 0, // default (black)
- 0, // black
- background_red,
- background_green,
- background_red | background_green, // yellow
- background_blue,
- background_red | background_blue, // magenta
- background_green | background_blue, // cyan
- background_red | background_blue | background_green, // white
-}
-
-var color_table_fg = []word{
- foreground_red | foreground_blue | foreground_green, // default (white)
- 0,
- foreground_red,
- foreground_green,
- foreground_red | foreground_green, // yellow
- foreground_blue,
- foreground_red | foreground_blue, // magenta
- foreground_green | foreground_blue, // cyan
- foreground_red | foreground_blue | foreground_green, // white
-}
-
-const (
- replacement_char = '\uFFFD'
- max_rune = '\U0010FFFF'
- surr1 = 0xd800
- surr2 = 0xdc00
- surr3 = 0xe000
- surr_self = 0x10000
-)
-
-func append_diff_line(y int) int {
- n := 0
- for x := 0; x < front_buffer.width; {
- cell_offset := y*front_buffer.width + x
- back := &back_buffer.cells[cell_offset]
- front := &front_buffer.cells[cell_offset]
- attr, char := cell_to_char_info(*back)
- charbuf = append(charbuf, char_info{attr: attr, char: char[0]})
- *front = *back
- n++
- w := runewidth.RuneWidth(back.Ch)
- if w == 0 || w == 2 && runewidth.IsAmbiguousWidth(back.Ch) {
- w = 1
- }
- x += w
- // If not CJK, fill trailing space with whitespace
- if !is_cjk && w == 2 {
- charbuf = append(charbuf, char_info{attr: attr, char: ' '})
- }
- }
- return n
-}
-
-// compares 'back_buffer' with 'front_buffer' and prepares all changes in the form of
-// 'diff_msg's in the 'diff_buf'
-func prepare_diff_messages() {
- // clear buffers
- diffbuf = diffbuf[:0]
- charbuf = charbuf[:0]
-
- var diff diff_msg
- gbeg := 0
- for y := 0; y < front_buffer.height; y++ {
- same := true
- line_offset := y * front_buffer.width
- for x := 0; x < front_buffer.width; x++ {
- cell_offset := line_offset + x
- back := &back_buffer.cells[cell_offset]
- front := &front_buffer.cells[cell_offset]
- if *back != *front {
- same = false
- break
- }
- }
- if same && diff.lines > 0 {
- diffbuf = append(diffbuf, diff)
- diff = diff_msg{}
- }
- if !same {
- beg := len(charbuf)
- end := beg + append_diff_line(y)
- if diff.lines == 0 {
- diff.pos = short(y)
- gbeg = beg
- }
- diff.lines++
- diff.chars = charbuf[gbeg:end]
- }
- }
- if diff.lines > 0 {
- diffbuf = append(diffbuf, diff)
- diff = diff_msg{}
- }
-}
-
-func get_ct(table []word, idx int) word {
- idx = idx & 0x0F
- if idx >= len(table) {
- idx = len(table) - 1
- }
- return table[idx]
-}
-
-func cell_to_char_info(c Cell) (attr word, wc [2]wchar) {
- attr = get_ct(color_table_fg, int(c.Fg)) | get_ct(color_table_bg, int(c.Bg))
- if c.Fg&AttrReverse|c.Bg&AttrReverse != 0 {
- attr = (attr&0xF0)>>4 | (attr&0x0F)<<4
- }
- if c.Fg&AttrBold != 0 {
- attr |= foreground_intensity
- }
- if c.Bg&AttrBold != 0 {
- attr |= background_intensity
- }
-
- r0, r1 := utf16.EncodeRune(c.Ch)
- if r0 == 0xFFFD {
- wc[0] = wchar(c.Ch)
- wc[1] = ' '
- } else {
- wc[0] = wchar(r0)
- wc[1] = wchar(r1)
- }
- return
-}
-
-func move_cursor(x, y int) {
- err := set_console_cursor_position(out, coord{short(x), short(y)})
- if err != nil {
- panic(err)
- }
-}
-
-func show_cursor(visible bool) {
- var v int32
- if visible {
- v = 1
- }
-
- var info console_cursor_info
- info.size = 100
- info.visible = v
- err := set_console_cursor_info(out, &info)
- if err != nil {
- panic(err)
- }
-}
-
-func clear() {
- var err error
- attr, char := cell_to_char_info(Cell{
- ' ',
- foreground,
- background,
- })
-
- area := int(term_size.x) * int(term_size.y)
- err = fill_console_output_attribute(out, attr, area)
- if err != nil {
- panic(err)
- }
- err = fill_console_output_character(out, char[0], area)
- if err != nil {
- panic(err)
- }
- if !is_cursor_hidden(cursor_x, cursor_y) {
- move_cursor(cursor_x, cursor_y)
- }
-}
-
-func key_event_record_to_event(r *key_event_record) (Event, bool) {
- if r.key_down == 0 {
- return Event{}, false
- }
-
- e := Event{Type: EventKey}
- if input_mode&InputAlt != 0 {
- if alt_mode_esc {
- e.Mod = ModAlt
- alt_mode_esc = false
- }
- if r.control_key_state&(left_alt_pressed|right_alt_pressed) != 0 {
- e.Mod = ModAlt
- }
- }
-
- ctrlpressed := r.control_key_state&(left_ctrl_pressed|right_ctrl_pressed) != 0
-
- if r.virtual_key_code >= vk_f1 && r.virtual_key_code <= vk_f12 {
- switch r.virtual_key_code {
- case vk_f1:
- e.Key = KeyF1
- case vk_f2:
- e.Key = KeyF2
- case vk_f3:
- e.Key = KeyF3
- case vk_f4:
- e.Key = KeyF4
- case vk_f5:
- e.Key = KeyF5
- case vk_f6:
- e.Key = KeyF6
- case vk_f7:
- e.Key = KeyF7
- case vk_f8:
- e.Key = KeyF8
- case vk_f9:
- e.Key = KeyF9
- case vk_f10:
- e.Key = KeyF10
- case vk_f11:
- e.Key = KeyF11
- case vk_f12:
- e.Key = KeyF12
- default:
- panic("unreachable")
- }
-
- return e, true
- }
-
- if r.virtual_key_code <= vk_delete {
- switch r.virtual_key_code {
- case vk_insert:
- e.Key = KeyInsert
- case vk_delete:
- e.Key = KeyDelete
- case vk_home:
- e.Key = KeyHome
- case vk_end:
- e.Key = KeyEnd
- case vk_pgup:
- e.Key = KeyPgup
- case vk_pgdn:
- e.Key = KeyPgdn
- case vk_arrow_up:
- e.Key = KeyArrowUp
- case vk_arrow_down:
- e.Key = KeyArrowDown
- case vk_arrow_left:
- e.Key = KeyArrowLeft
- case vk_arrow_right:
- e.Key = KeyArrowRight
- case vk_backspace:
- if ctrlpressed {
- e.Key = KeyBackspace2
- } else {
- e.Key = KeyBackspace
- }
- case vk_tab:
- e.Key = KeyTab
- case vk_enter:
- e.Key = KeyEnter
- case vk_esc:
- switch {
- case input_mode&InputEsc != 0:
- e.Key = KeyEsc
- case input_mode&InputAlt != 0:
- alt_mode_esc = true
- return Event{}, false
- }
- case vk_space:
- if ctrlpressed {
- // manual return here, because KeyCtrlSpace is zero
- e.Key = KeyCtrlSpace
- return e, true
- } else {
- e.Key = KeySpace
- }
- }
-
- if e.Key != 0 {
- return e, true
- }
- }
-
- if ctrlpressed {
- if Key(r.unicode_char) >= KeyCtrlA && Key(r.unicode_char) <= KeyCtrlRsqBracket {
- e.Key = Key(r.unicode_char)
- if input_mode&InputAlt != 0 && e.Key == KeyEsc {
- alt_mode_esc = true
- return Event{}, false
- }
- return e, true
- }
- switch r.virtual_key_code {
- case 192, 50:
- // manual return here, because KeyCtrl2 is zero
- e.Key = KeyCtrl2
- return e, true
- case 51:
- if input_mode&InputAlt != 0 {
- alt_mode_esc = true
- return Event{}, false
- }
- e.Key = KeyCtrl3
- case 52:
- e.Key = KeyCtrl4
- case 53:
- e.Key = KeyCtrl5
- case 54:
- e.Key = KeyCtrl6
- case 189, 191, 55:
- e.Key = KeyCtrl7
- case 8, 56:
- e.Key = KeyCtrl8
- }
-
- if e.Key != 0 {
- return e, true
- }
- }
-
- if r.unicode_char != 0 {
- e.Ch = rune(r.unicode_char)
- return e, true
- }
-
- return Event{}, false
-}
-
-func input_event_producer() {
- var r input_record
- var err error
- var last_button Key
- var last_button_pressed Key
- var last_state = dword(0)
- var last_x, last_y = -1, -1
- handles := []syscall.Handle{in, interrupt}
- for {
- err = wait_for_multiple_objects(handles)
- if err != nil {
- input_comm <- Event{Type: EventError, Err: err}
- }
-
- select {
- case <-cancel_comm:
- cancel_done_comm <- true
- return
- default:
- }
-
- err = read_console_input(in, &r)
- if err != nil {
- input_comm <- Event{Type: EventError, Err: err}
- }
-
- switch r.event_type {
- case key_event:
- kr := (*key_event_record)(unsafe.Pointer(&r.event))
- ev, ok := key_event_record_to_event(kr)
- if ok {
- for i := 0; i < int(kr.repeat_count); i++ {
- input_comm <- ev
- }
- }
- case window_buffer_size_event:
- sr := *(*window_buffer_size_record)(unsafe.Pointer(&r.event))
- input_comm <- Event{
- Type: EventResize,
- Width: int(sr.size.x),
- Height: int(sr.size.y),
- }
- case mouse_event:
- mr := *(*mouse_event_record)(unsafe.Pointer(&r.event))
- ev := Event{Type: EventMouse}
- switch mr.event_flags {
- case 0, 2:
- // single or double click
- cur_state := mr.button_state
- switch {
- case last_state&mouse_lmb == 0 && cur_state&mouse_lmb != 0:
- last_button = MouseLeft
- last_button_pressed = last_button
- case last_state&mouse_rmb == 0 && cur_state&mouse_rmb != 0:
- last_button = MouseRight
- last_button_pressed = last_button
- case last_state&mouse_mmb == 0 && cur_state&mouse_mmb != 0:
- last_button = MouseMiddle
- last_button_pressed = last_button
- case last_state&mouse_lmb != 0 && cur_state&mouse_lmb == 0:
- last_button = MouseRelease
- case last_state&mouse_rmb != 0 && cur_state&mouse_rmb == 0:
- last_button = MouseRelease
- case last_state&mouse_mmb != 0 && cur_state&mouse_mmb == 0:
- last_button = MouseRelease
- default:
- last_state = cur_state
- continue
- }
- last_state = cur_state
- ev.Key = last_button
- last_x, last_y = int(mr.mouse_pos.x), int(mr.mouse_pos.y)
- ev.MouseX = last_x
- ev.MouseY = last_y
- case 1:
- // mouse motion
- x, y := int(mr.mouse_pos.x), int(mr.mouse_pos.y)
- if last_state != 0 && (last_x != x || last_y != y) {
- ev.Key = last_button_pressed
- ev.Mod = ModMotion
- ev.MouseX = x
- ev.MouseY = y
- last_x, last_y = x, y
- } else {
- ev.Type = EventNone
- }
- case 4:
- // mouse wheel
- n := int16(mr.button_state >> 16)
- if n > 0 {
- ev.Key = MouseWheelUp
- } else {
- ev.Key = MouseWheelDown
- }
- last_x, last_y = int(mr.mouse_pos.x), int(mr.mouse_pos.y)
- ev.MouseX = last_x
- ev.MouseY = last_y
- default:
- ev.Type = EventNone
- }
- if ev.Type != EventNone {
- input_comm <- ev
- }
- }
- }
-}
diff --git a/vendor/github.com/awesome-gocui/termbox-go/terminfo.go b/vendor/github.com/awesome-gocui/termbox-go/terminfo.go
deleted file mode 100644
index ab2e7a19891a29e9d4d81b1bd9d86acbc137ffea..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/terminfo.go
+++ /dev/null
@@ -1,232 +0,0 @@
-// +build !windows
-// This file contains a simple and incomplete implementation of the terminfo
-// database. Information was taken from the ncurses manpages term(5) and
-// terminfo(5). Currently, only the string capabilities for special keys and for
-// functions without parameters are actually used. Colors are still done with
-// ANSI escape sequences. Other special features that are not (yet?) supported
-// are reading from ~/.terminfo, the TERMINFO_DIRS variable, Berkeley database
-// format and extended capabilities.
-
-package termbox
-
-import (
- "bytes"
- "encoding/binary"
- "encoding/hex"
- "errors"
- "fmt"
- "io/ioutil"
- "os"
- "strings"
-)
-
-const (
- ti_magic = 0432
- ti_header_length = 12
- ti_mouse_enter = "\x1b[?1000h\x1b[?1002h\x1b[?1015h\x1b[?1006h"
- ti_mouse_leave = "\x1b[?1006l\x1b[?1015l\x1b[?1002l\x1b[?1000l"
-)
-
-func load_terminfo() ([]byte, error) {
- var data []byte
- var err error
-
- term := os.Getenv("TERM")
- if term == "" {
- return nil, fmt.Errorf("termbox: TERM not set")
- }
-
- // The following behaviour follows the one described in terminfo(5) as
- // distributed by ncurses.
-
- terminfo := os.Getenv("TERMINFO")
- if terminfo != "" {
- // if TERMINFO is set, no other directory should be searched
- return ti_try_path(terminfo)
- }
-
- // next, consider ~/.terminfo
- home := os.Getenv("HOME")
- if home != "" {
- data, err = ti_try_path(home + "/.terminfo")
- if err == nil {
- return data, nil
- }
- }
-
- // next, TERMINFO_DIRS
- dirs := os.Getenv("TERMINFO_DIRS")
- if dirs != "" {
- for _, dir := range strings.Split(dirs, ":") {
- if dir == "" {
- // "" -> "/usr/share/terminfo"
- dir = "/usr/share/terminfo"
- }
- data, err = ti_try_path(dir)
- if err == nil {
- return data, nil
- }
- }
- }
-
- // next, /lib/terminfo
- data, err = ti_try_path("/lib/terminfo")
- if err == nil {
- return data, nil
- }
-
- // fall back to /usr/share/terminfo
- return ti_try_path("/usr/share/terminfo")
-}
-
-func ti_try_path(path string) (data []byte, err error) {
- // load_terminfo already made sure it is set
- term := os.Getenv("TERM")
-
- // first try, the typical *nix path
- terminfo := path + "/" + term[0:1] + "/" + term
- data, err = ioutil.ReadFile(terminfo)
- if err == nil {
- return
- }
-
- // fallback to darwin specific dirs structure
- terminfo = path + "/" + hex.EncodeToString([]byte(term[:1])) + "/" + term
- data, err = ioutil.ReadFile(terminfo)
- return
-}
-
-func setup_term_builtin() error {
- name := os.Getenv("TERM")
- if name == "" {
- return errors.New("termbox: TERM environment variable not set")
- }
-
- for _, t := range terms {
- if t.name == name {
- keys = t.keys
- funcs = t.funcs
- return nil
- }
- }
-
- compat_table := []struct {
- partial string
- keys []string
- funcs []string
- }{
- {"xterm", xterm_keys, xterm_funcs},
- {"rxvt", rxvt_unicode_keys, rxvt_unicode_funcs},
- {"linux", linux_keys, linux_funcs},
- {"Eterm", eterm_keys, eterm_funcs},
- {"screen", screen_keys, screen_funcs},
- // let's assume that 'cygwin' is xterm compatible
- {"cygwin", xterm_keys, xterm_funcs},
- {"st", xterm_keys, xterm_funcs},
- }
-
- // try compatibility variants
- for _, it := range compat_table {
- if strings.Contains(name, it.partial) {
- keys = it.keys
- funcs = it.funcs
- return nil
- }
- }
-
- return errors.New("termbox: unsupported terminal")
-}
-
-func setup_term() (err error) {
- var data []byte
- var header [6]int16
- var str_offset, table_offset int16
-
- data, err = load_terminfo()
- if err != nil {
- return setup_term_builtin()
- }
-
- rd := bytes.NewReader(data)
- // 0: magic number, 1: size of names section, 2: size of boolean section, 3:
- // size of numbers section (in integers), 4: size of the strings section (in
- // integers), 5: size of the string table
-
- err = binary.Read(rd, binary.LittleEndian, header[:])
- if err != nil {
- return
- }
-
- number_sec_len := int16(2)
- if header[0] == 542 { // doc says it should be octal 0542, but what I see it terminfo files is 542, learn to program please... thank you..
- number_sec_len = 4
- }
-
- if (header[1]+header[2])%2 != 0 {
- // old quirk to align everything on word boundaries
- header[2] += 1
- }
- str_offset = ti_header_length + header[1] + header[2] + number_sec_len*header[3]
- table_offset = str_offset + 2*header[4]
-
- keys = make([]string, 0xFFFF-key_min)
- for i, _ := range keys {
- keys[i], err = ti_read_string(rd, str_offset+2*ti_keys[i], table_offset)
- if err != nil {
- return
- }
- }
- funcs = make([]string, t_max_funcs)
- // the last two entries are reserved for mouse. because the table offset is
- // not there, the two entries have to fill in manually
- for i, _ := range funcs[:len(funcs)-2] {
- funcs[i], err = ti_read_string(rd, str_offset+2*ti_funcs[i], table_offset)
- if err != nil {
- return
- }
- }
- funcs[t_max_funcs-2] = ti_mouse_enter
- funcs[t_max_funcs-1] = ti_mouse_leave
- return nil
-}
-
-func ti_read_string(rd *bytes.Reader, str_off, table int16) (string, error) {
- var off int16
-
- _, err := rd.Seek(int64(str_off), 0)
- if err != nil {
- return "", err
- }
- err = binary.Read(rd, binary.LittleEndian, &off)
- if err != nil {
- return "", err
- }
- _, err = rd.Seek(int64(table+off), 0)
- if err != nil {
- return "", err
- }
- var bs []byte
- for {
- b, err := rd.ReadByte()
- if err != nil {
- return "", err
- }
- if b == byte(0x00) {
- break
- }
- bs = append(bs, b)
- }
- return string(bs), nil
-}
-
-// "Maps" the function constants from termbox.go to the number of the respective
-// string capability in the terminfo file. Taken from (ncurses) term.h.
-var ti_funcs = []int16{
- 28, 40, 16, 13, 5, 39, 36, 27, 26, 34, 89, 88,
-}
-
-// Same as above for the special keys.
-var ti_keys = []int16{
- 66, 68 /* apparently not a typo; 67 is F10 for whatever reason */, 69, 70,
- 71, 72, 73, 74, 75, 67, 216, 217, 77, 59, 76, 164, 82, 81, 87, 61, 79, 83,
-}
diff --git a/vendor/github.com/awesome-gocui/termbox-go/terminfo_builtin.go b/vendor/github.com/awesome-gocui/termbox-go/terminfo_builtin.go
deleted file mode 100644
index a94866067baed2fc2ea1a175f76dfc35a04b80a0..0000000000000000000000000000000000000000
--- a/vendor/github.com/awesome-gocui/termbox-go/terminfo_builtin.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// +build !windows
-
-package termbox
-
-// Eterm
-var eterm_keys = []string{
- "\x1b[11~", "\x1b[12~", "\x1b[13~", "\x1b[14~", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[7~", "\x1b[8~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C",
-}
-var eterm_funcs = []string{
- "\x1b7\x1b[?47h", "\x1b[2J\x1b[?47l\x1b8", "\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[2J", "\x1b[m\x0f", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "", "", "", "",
-}
-
-// screen
-var screen_keys = []string{
- "\x1bOP", "\x1bOQ", "\x1bOR", "\x1bOS", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[1~", "\x1b[4~", "\x1b[5~", "\x1b[6~", "\x1bOA", "\x1bOB", "\x1bOD", "\x1bOC",
-}
-var screen_funcs = []string{
- "\x1b[?1049h", "\x1b[?1049l", "\x1b[34h\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[J", "\x1b[m\x0f", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "\x1b[?1h\x1b=", "\x1b[?1l\x1b>", ti_mouse_enter, ti_mouse_leave,
-}
-
-// xterm
-var xterm_keys = []string{
- "\x1bOP", "\x1bOQ", "\x1bOR", "\x1bOS", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1bOH", "\x1bOF", "\x1b[5~", "\x1b[6~", "\x1bOA", "\x1bOB", "\x1bOD", "\x1bOC",
-}
-var xterm_funcs = []string{
- "\x1b[?1049h", "\x1b[?1049l", "\x1b[?12l\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[2J", "\x1b(B\x1b[m", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "\x1b[?1h\x1b=", "\x1b[?1l\x1b>", ti_mouse_enter, ti_mouse_leave,
-}
-
-// rxvt-unicode
-var rxvt_unicode_keys = []string{
- "\x1b[11~", "\x1b[12~", "\x1b[13~", "\x1b[14~", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[7~", "\x1b[8~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C",
-}
-var rxvt_unicode_funcs = []string{
- "\x1b[?1049h", "\x1b[r\x1b[?1049l", "\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[2J", "\x1b[m\x1b(B", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "\x1b=", "\x1b>", ti_mouse_enter, ti_mouse_leave,
-}
-
-// linux
-var linux_keys = []string{
- "\x1b[[A", "\x1b[[B", "\x1b[[C", "\x1b[[D", "\x1b[[E", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[1~", "\x1b[4~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C",
-}
-var linux_funcs = []string{
- "", "", "\x1b[?25h\x1b[?0c", "\x1b[?25l\x1b[?1c", "\x1b[H\x1b[J", "\x1b[0;10m", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "", "", "", "",
-}
-
-// rxvt-256color
-var rxvt_256color_keys = []string{
- "\x1b[11~", "\x1b[12~", "\x1b[13~", "\x1b[14~", "\x1b[15~", "\x1b[17~", "\x1b[18~", "\x1b[19~", "\x1b[20~", "\x1b[21~", "\x1b[23~", "\x1b[24~", "\x1b[2~", "\x1b[3~", "\x1b[7~", "\x1b[8~", "\x1b[5~", "\x1b[6~", "\x1b[A", "\x1b[B", "\x1b[D", "\x1b[C",
-}
-var rxvt_256color_funcs = []string{
- "\x1b7\x1b[?47h", "\x1b[2J\x1b[?47l\x1b8", "\x1b[?25h", "\x1b[?25l", "\x1b[H\x1b[2J", "\x1b[m\x0f", "\x1b[4m", "\x1b[1m", "\x1b[5m", "\x1b[7m", "\x1b=", "\x1b>", ti_mouse_enter, ti_mouse_leave,
-}
-
-var terms = []struct {
- name string
- keys []string
- funcs []string
-}{
- {"Eterm", eterm_keys, eterm_funcs},
- {"screen", screen_keys, screen_funcs},
- {"xterm", xterm_keys, xterm_funcs},
- {"rxvt-unicode", rxvt_unicode_keys, rxvt_unicode_funcs},
- {"linux", linux_keys, linux_funcs},
- {"rxvt-256color", rxvt_256color_keys, rxvt_256color_funcs},
-}
diff --git a/vendor/github.com/blang/semver/.travis.yml b/vendor/github.com/blang/semver/.travis.yml
deleted file mode 100644
index 7319bdeaea35a2a4d8262799b2f7f276abdd70ba..0000000000000000000000000000000000000000
--- a/vendor/github.com/blang/semver/.travis.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-language: go
-matrix:
- include:
- - go: 1.4.x
- - go: 1.5.x
- - go: 1.6.x
- - go: 1.7.x
- - go: 1.8.x
- - go: 1.9.x
- - go: 1.10.x
- - go: 1.11.x
- - go: tip
- allow_failures:
- - go: tip
-install:
-- go get golang.org/x/tools/cmd/cover
-- go get github.com/mattn/goveralls
-script:
-- echo "Test and track coverage" ; $HOME/gopath/bin/goveralls -package "." -service=travis-ci
- -repotoken=$COVERALLS_TOKEN
-- echo "Build examples" ; cd examples && go build
-- echo "Check if gofmt'd" ; diff -u <(echo -n) <(gofmt -d -s .)
-env:
- global:
- secure: HroGEAUQpVq9zX1b1VIkraLiywhGbzvNnTZq2TMxgK7JHP8xqNplAeF1izrR2i4QLL9nsY+9WtYss4QuPvEtZcVHUobw6XnL6radF7jS1LgfYZ9Y7oF+zogZ2I5QUMRLGA7rcxQ05s7mKq3XZQfeqaNts4bms/eZRefWuaFZbkw=
diff --git a/vendor/github.com/blang/semver/LICENSE b/vendor/github.com/blang/semver/LICENSE
deleted file mode 100644
index 5ba5c86fcb025c66e2843adbcce48e458deda5eb..0000000000000000000000000000000000000000
--- a/vendor/github.com/blang/semver/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License
-
-Copyright (c) 2014 Benedikt Lang
-
-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/blang/semver/README.md b/vendor/github.com/blang/semver/README.md
deleted file mode 100644
index e05f98651801ad62f29dcf583d596c5c0ae78125..0000000000000000000000000000000000000000
--- a/vendor/github.com/blang/semver/README.md
+++ /dev/null
@@ -1,194 +0,0 @@
-semver for golang [](https://travis-ci.org/blang/semver) [](https://godoc.org/github.com/blang/semver) [](https://coveralls.io/r/blang/semver?branch=master) [](https://goreportcard.com/report/github.com/blang/semver)
-======
-
-semver is a [Semantic Versioning](http://semver.org/) library written in golang. It fully covers spec version `2.0.0`.
-
-Usage
------
-```bash
-$ go get github.com/blang/semver
-```
-Note: Always vendor your dependencies or fix on a specific version tag.
-
-```go
-import github.com/blang/semver
-v1, err := semver.Make("1.0.0-beta")
-v2, err := semver.Make("2.0.0-beta")
-v1.Compare(v2)
-```
-
-Also check the [GoDocs](http://godoc.org/github.com/blang/semver).
-
-Why should I use this lib?
------
-
-- Fully spec compatible
-- No reflection
-- No regex
-- Fully tested (Coverage >99%)
-- Readable parsing/validation errors
-- Fast (See [Benchmarks](#benchmarks))
-- Only Stdlib
-- Uses values instead of pointers
-- Many features, see below
-
-
-Features
------
-
-- Parsing and validation at all levels
-- Comparator-like comparisons
-- Compare Helper Methods
-- InPlace manipulation
-- Ranges `>=1.0.0 <2.0.0 || >=3.0.0 !3.0.1-beta.1`
-- Wildcards `>=1.x`, `<=2.5.x`
-- Sortable (implements sort.Interface)
-- database/sql compatible (sql.Scanner/Valuer)
-- encoding/json compatible (json.Marshaler/Unmarshaler)
-
-Ranges
-------
-
-A `Range` is a set of conditions which specify which versions satisfy the range.
-
-A condition is composed of an operator and a version. The supported operators are:
-
-- `<1.0.0` Less than `1.0.0`
-- `<=1.0.0` Less than or equal to `1.0.0`
-- `>1.0.0` Greater than `1.0.0`
-- `>=1.0.0` Greater than or equal to `1.0.0`
-- `1.0.0`, `=1.0.0`, `==1.0.0` Equal to `1.0.0`
-- `!1.0.0`, `!=1.0.0` Not equal to `1.0.0`. Excludes version `1.0.0`.
-
-Note that spaces between the operator and the version will be gracefully tolerated.
-
-A `Range` can link multiple `Ranges` separated by space:
-
-Ranges can be linked by logical AND:
-
- - `>1.0.0 <2.0.0` would match between both ranges, so `1.1.1` and `1.8.7` but not `1.0.0` or `2.0.0`
- - `>1.0.0 <3.0.0 !2.0.3-beta.2` would match every version between `1.0.0` and `3.0.0` except `2.0.3-beta.2`
-
-Ranges can also be linked by logical OR:
-
- - `<2.0.0 || >=3.0.0` would match `1.x.x` and `3.x.x` but not `2.x.x`
-
-AND has a higher precedence than OR. It's not possible to use brackets.
-
-Ranges can be combined by both AND and OR
-
- - `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1`
-
-Range usage:
-
-```
-v, err := semver.Parse("1.2.3")
-expectedRange, err := semver.ParseRange(">1.0.0 <2.0.0 || >=3.0.0")
-if expectedRange(v) {
- //valid
-}
-
-```
-
-Example
------
-
-Have a look at full examples in [examples/main.go](examples/main.go)
-
-```go
-import github.com/blang/semver
-
-v, err := semver.Make("0.0.1-alpha.preview+123.github")
-fmt.Printf("Major: %d\n", v.Major)
-fmt.Printf("Minor: %d\n", v.Minor)
-fmt.Printf("Patch: %d\n", v.Patch)
-fmt.Printf("Pre: %s\n", v.Pre)
-fmt.Printf("Build: %s\n", v.Build)
-
-// Prerelease versions array
-if len(v.Pre) > 0 {
- fmt.Println("Prerelease versions:")
- for i, pre := range v.Pre {
- fmt.Printf("%d: %q\n", i, pre)
- }
-}
-
-// Build meta data array
-if len(v.Build) > 0 {
- fmt.Println("Build meta data:")
- for i, build := range v.Build {
- fmt.Printf("%d: %q\n", i, build)
- }
-}
-
-v001, err := semver.Make("0.0.1")
-// Compare using helpers: v.GT(v2), v.LT, v.GTE, v.LTE
-v001.GT(v) == true
-v.LT(v001) == true
-v.GTE(v) == true
-v.LTE(v) == true
-
-// Or use v.Compare(v2) for comparisons (-1, 0, 1):
-v001.Compare(v) == 1
-v.Compare(v001) == -1
-v.Compare(v) == 0
-
-// Manipulate Version in place:
-v.Pre[0], err = semver.NewPRVersion("beta")
-if err != nil {
- fmt.Printf("Error parsing pre release version: %q", err)
-}
-
-fmt.Println("\nValidate versions:")
-v.Build[0] = "?"
-
-err = v.Validate()
-if err != nil {
- fmt.Printf("Validation failed: %s\n", err)
-}
-```
-
-
-Benchmarks
------
-
- BenchmarkParseSimple-4 5000000 390 ns/op 48 B/op 1 allocs/op
- BenchmarkParseComplex-4 1000000 1813 ns/op 256 B/op 7 allocs/op
- BenchmarkParseAverage-4 1000000 1171 ns/op 163 B/op 4 allocs/op
- BenchmarkStringSimple-4 20000000 119 ns/op 16 B/op 1 allocs/op
- BenchmarkStringLarger-4 10000000 206 ns/op 32 B/op 2 allocs/op
- BenchmarkStringComplex-4 5000000 324 ns/op 80 B/op 3 allocs/op
- BenchmarkStringAverage-4 5000000 273 ns/op 53 B/op 2 allocs/op
- BenchmarkValidateSimple-4 200000000 9.33 ns/op 0 B/op 0 allocs/op
- BenchmarkValidateComplex-4 3000000 469 ns/op 0 B/op 0 allocs/op
- BenchmarkValidateAverage-4 5000000 256 ns/op 0 B/op 0 allocs/op
- BenchmarkCompareSimple-4 100000000 11.8 ns/op 0 B/op 0 allocs/op
- BenchmarkCompareComplex-4 50000000 30.8 ns/op 0 B/op 0 allocs/op
- BenchmarkCompareAverage-4 30000000 41.5 ns/op 0 B/op 0 allocs/op
- BenchmarkSort-4 3000000 419 ns/op 256 B/op 2 allocs/op
- BenchmarkRangeParseSimple-4 2000000 850 ns/op 192 B/op 5 allocs/op
- BenchmarkRangeParseAverage-4 1000000 1677 ns/op 400 B/op 10 allocs/op
- BenchmarkRangeParseComplex-4 300000 5214 ns/op 1440 B/op 30 allocs/op
- BenchmarkRangeMatchSimple-4 50000000 25.6 ns/op 0 B/op 0 allocs/op
- BenchmarkRangeMatchAverage-4 30000000 56.4 ns/op 0 B/op 0 allocs/op
- BenchmarkRangeMatchComplex-4 10000000 153 ns/op 0 B/op 0 allocs/op
-
-See benchmark cases at [semver_test.go](semver_test.go)
-
-
-Motivation
------
-
-I simply couldn't find any lib supporting the full spec. Others were just wrong or used reflection and regex which i don't like.
-
-
-Contribution
------
-
-Feel free to make a pull request. For bigger changes create a issue first to discuss about it.
-
-
-License
------
-
-See [LICENSE](LICENSE) file.
diff --git a/vendor/github.com/blang/semver/go.mod b/vendor/github.com/blang/semver/go.mod
deleted file mode 100644
index d0083058efbf65b9c41e19479f9d2d47891ff2b3..0000000000000000000000000000000000000000
--- a/vendor/github.com/blang/semver/go.mod
+++ /dev/null
@@ -1 +0,0 @@
-module github.com/blang/semver
diff --git a/vendor/github.com/blang/semver/json.go b/vendor/github.com/blang/semver/json.go
deleted file mode 100644
index a74bf7c449400e31606c63ec583aa3eab70592d2..0000000000000000000000000000000000000000
--- a/vendor/github.com/blang/semver/json.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package semver
-
-import (
- "encoding/json"
-)
-
-// MarshalJSON implements the encoding/json.Marshaler interface.
-func (v Version) MarshalJSON() ([]byte, error) {
- return json.Marshal(v.String())
-}
-
-// UnmarshalJSON implements the encoding/json.Unmarshaler interface.
-func (v *Version) UnmarshalJSON(data []byte) (err error) {
- var versionString string
-
- if err = json.Unmarshal(data, &versionString); err != nil {
- return
- }
-
- *v, err = Parse(versionString)
-
- return
-}
diff --git a/vendor/github.com/blang/semver/package.json b/vendor/github.com/blang/semver/package.json
deleted file mode 100644
index 1cf8ebdd9c18169f99695cd86397b7c49faed518..0000000000000000000000000000000000000000
--- a/vendor/github.com/blang/semver/package.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "author": "blang",
- "bugs": {
- "URL": "https://github.com/blang/semver/issues",
- "url": "https://github.com/blang/semver/issues"
- },
- "gx": {
- "dvcsimport": "github.com/blang/semver"
- },
- "gxVersion": "0.10.0",
- "language": "go",
- "license": "MIT",
- "name": "semver",
- "releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
- "version": "3.5.1"
-}
-
diff --git a/vendor/github.com/blang/semver/range.go b/vendor/github.com/blang/semver/range.go
deleted file mode 100644
index 95f7139b97705153afdd774ff24dde53380a63e9..0000000000000000000000000000000000000000
--- a/vendor/github.com/blang/semver/range.go
+++ /dev/null
@@ -1,416 +0,0 @@
-package semver
-
-import (
- "fmt"
- "strconv"
- "strings"
- "unicode"
-)
-
-type wildcardType int
-
-const (
- noneWildcard wildcardType = iota
- majorWildcard wildcardType = 1
- minorWildcard wildcardType = 2
- patchWildcard wildcardType = 3
-)
-
-func wildcardTypefromInt(i int) wildcardType {
- switch i {
- case 1:
- return majorWildcard
- case 2:
- return minorWildcard
- case 3:
- return patchWildcard
- default:
- return noneWildcard
- }
-}
-
-type comparator func(Version, Version) bool
-
-var (
- compEQ comparator = func(v1 Version, v2 Version) bool {
- return v1.Compare(v2) == 0
- }
- compNE = func(v1 Version, v2 Version) bool {
- return v1.Compare(v2) != 0
- }
- compGT = func(v1 Version, v2 Version) bool {
- return v1.Compare(v2) == 1
- }
- compGE = func(v1 Version, v2 Version) bool {
- return v1.Compare(v2) >= 0
- }
- compLT = func(v1 Version, v2 Version) bool {
- return v1.Compare(v2) == -1
- }
- compLE = func(v1 Version, v2 Version) bool {
- return v1.Compare(v2) <= 0
- }
-)
-
-type versionRange struct {
- v Version
- c comparator
-}
-
-// rangeFunc creates a Range from the given versionRange.
-func (vr *versionRange) rangeFunc() Range {
- return Range(func(v Version) bool {
- return vr.c(v, vr.v)
- })
-}
-
-// Range represents a range of versions.
-// A Range can be used to check if a Version satisfies it:
-//
-// range, err := semver.ParseRange(">1.0.0 <2.0.0")
-// range(semver.MustParse("1.1.1") // returns true
-type Range func(Version) bool
-
-// OR combines the existing Range with another Range using logical OR.
-func (rf Range) OR(f Range) Range {
- return Range(func(v Version) bool {
- return rf(v) || f(v)
- })
-}
-
-// AND combines the existing Range with another Range using logical AND.
-func (rf Range) AND(f Range) Range {
- return Range(func(v Version) bool {
- return rf(v) && f(v)
- })
-}
-
-// ParseRange parses a range and returns a Range.
-// If the range could not be parsed an error is returned.
-//
-// Valid ranges are:
-// - "<1.0.0"
-// - "<=1.0.0"
-// - ">1.0.0"
-// - ">=1.0.0"
-// - "1.0.0", "=1.0.0", "==1.0.0"
-// - "!1.0.0", "!=1.0.0"
-//
-// A Range can consist of multiple ranges separated by space:
-// Ranges can be linked by logical AND:
-// - ">1.0.0 <2.0.0" would match between both ranges, so "1.1.1" and "1.8.7" but not "1.0.0" or "2.0.0"
-// - ">1.0.0 <3.0.0 !2.0.3-beta.2" would match every version between 1.0.0 and 3.0.0 except 2.0.3-beta.2
-//
-// Ranges can also be linked by logical OR:
-// - "<2.0.0 || >=3.0.0" would match "1.x.x" and "3.x.x" but not "2.x.x"
-//
-// AND has a higher precedence than OR. It's not possible to use brackets.
-//
-// Ranges can be combined by both AND and OR
-//
-// - `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1`
-func ParseRange(s string) (Range, error) {
- parts := splitAndTrim(s)
- orParts, err := splitORParts(parts)
- if err != nil {
- return nil, err
- }
- expandedParts, err := expandWildcardVersion(orParts)
- if err != nil {
- return nil, err
- }
- var orFn Range
- for _, p := range expandedParts {
- var andFn Range
- for _, ap := range p {
- opStr, vStr, err := splitComparatorVersion(ap)
- if err != nil {
- return nil, err
- }
- vr, err := buildVersionRange(opStr, vStr)
- if err != nil {
- return nil, fmt.Errorf("Could not parse Range %q: %s", ap, err)
- }
- rf := vr.rangeFunc()
-
- // Set function
- if andFn == nil {
- andFn = rf
- } else { // Combine with existing function
- andFn = andFn.AND(rf)
- }
- }
- if orFn == nil {
- orFn = andFn
- } else {
- orFn = orFn.OR(andFn)
- }
-
- }
- return orFn, nil
-}
-
-// splitORParts splits the already cleaned parts by '||'.
-// Checks for invalid positions of the operator and returns an
-// error if found.
-func splitORParts(parts []string) ([][]string, error) {
- var ORparts [][]string
- last := 0
- for i, p := range parts {
- if p == "||" {
- if i == 0 {
- return nil, fmt.Errorf("First element in range is '||'")
- }
- ORparts = append(ORparts, parts[last:i])
- last = i + 1
- }
- }
- if last == len(parts) {
- return nil, fmt.Errorf("Last element in range is '||'")
- }
- ORparts = append(ORparts, parts[last:])
- return ORparts, nil
-}
-
-// buildVersionRange takes a slice of 2: operator and version
-// and builds a versionRange, otherwise an error.
-func buildVersionRange(opStr, vStr string) (*versionRange, error) {
- c := parseComparator(opStr)
- if c == nil {
- return nil, fmt.Errorf("Could not parse comparator %q in %q", opStr, strings.Join([]string{opStr, vStr}, ""))
- }
- v, err := Parse(vStr)
- if err != nil {
- return nil, fmt.Errorf("Could not parse version %q in %q: %s", vStr, strings.Join([]string{opStr, vStr}, ""), err)
- }
-
- return &versionRange{
- v: v,
- c: c,
- }, nil
-
-}
-
-// inArray checks if a byte is contained in an array of bytes
-func inArray(s byte, list []byte) bool {
- for _, el := range list {
- if el == s {
- return true
- }
- }
- return false
-}
-
-// splitAndTrim splits a range string by spaces and cleans whitespaces
-func splitAndTrim(s string) (result []string) {
- last := 0
- var lastChar byte
- excludeFromSplit := []byte{'>', '<', '='}
- for i := 0; i < len(s); i++ {
- if s[i] == ' ' && !inArray(lastChar, excludeFromSplit) {
- if last < i-1 {
- result = append(result, s[last:i])
- }
- last = i + 1
- } else if s[i] != ' ' {
- lastChar = s[i]
- }
- }
- if last < len(s)-1 {
- result = append(result, s[last:])
- }
-
- for i, v := range result {
- result[i] = strings.Replace(v, " ", "", -1)
- }
-
- // parts := strings.Split(s, " ")
- // for _, x := range parts {
- // if s := strings.TrimSpace(x); len(s) != 0 {
- // result = append(result, s)
- // }
- // }
- return
-}
-
-// splitComparatorVersion splits the comparator from the version.
-// Input must be free of leading or trailing spaces.
-func splitComparatorVersion(s string) (string, string, error) {
- i := strings.IndexFunc(s, unicode.IsDigit)
- if i == -1 {
- return "", "", fmt.Errorf("Could not get version from string: %q", s)
- }
- return strings.TrimSpace(s[0:i]), s[i:], nil
-}
-
-// getWildcardType will return the type of wildcard that the
-// passed version contains
-func getWildcardType(vStr string) wildcardType {
- parts := strings.Split(vStr, ".")
- nparts := len(parts)
- wildcard := parts[nparts-1]
-
- possibleWildcardType := wildcardTypefromInt(nparts)
- if wildcard == "x" {
- return possibleWildcardType
- }
-
- return noneWildcard
-}
-
-// createVersionFromWildcard will convert a wildcard version
-// into a regular version, replacing 'x's with '0's, handling
-// special cases like '1.x.x' and '1.x'
-func createVersionFromWildcard(vStr string) string {
- // handle 1.x.x
- vStr2 := strings.Replace(vStr, ".x.x", ".x", 1)
- vStr2 = strings.Replace(vStr2, ".x", ".0", 1)
- parts := strings.Split(vStr2, ".")
-
- // handle 1.x
- if len(parts) == 2 {
- return vStr2 + ".0"
- }
-
- return vStr2
-}
-
-// incrementMajorVersion will increment the major version
-// of the passed version
-func incrementMajorVersion(vStr string) (string, error) {
- parts := strings.Split(vStr, ".")
- i, err := strconv.Atoi(parts[0])
- if err != nil {
- return "", err
- }
- parts[0] = strconv.Itoa(i + 1)
-
- return strings.Join(parts, "."), nil
-}
-
-// incrementMajorVersion will increment the minor version
-// of the passed version
-func incrementMinorVersion(vStr string) (string, error) {
- parts := strings.Split(vStr, ".")
- i, err := strconv.Atoi(parts[1])
- if err != nil {
- return "", err
- }
- parts[1] = strconv.Itoa(i + 1)
-
- return strings.Join(parts, "."), nil
-}
-
-// expandWildcardVersion will expand wildcards inside versions
-// following these rules:
-//
-// * when dealing with patch wildcards:
-// >= 1.2.x will become >= 1.2.0
-// <= 1.2.x will become < 1.3.0
-// > 1.2.x will become >= 1.3.0
-// < 1.2.x will become < 1.2.0
-// != 1.2.x will become < 1.2.0 >= 1.3.0
-//
-// * when dealing with minor wildcards:
-// >= 1.x will become >= 1.0.0
-// <= 1.x will become < 2.0.0
-// > 1.x will become >= 2.0.0
-// < 1.0 will become < 1.0.0
-// != 1.x will become < 1.0.0 >= 2.0.0
-//
-// * when dealing with wildcards without
-// version operator:
-// 1.2.x will become >= 1.2.0 < 1.3.0
-// 1.x will become >= 1.0.0 < 2.0.0
-func expandWildcardVersion(parts [][]string) ([][]string, error) {
- var expandedParts [][]string
- for _, p := range parts {
- var newParts []string
- for _, ap := range p {
- if strings.Contains(ap, "x") {
- opStr, vStr, err := splitComparatorVersion(ap)
- if err != nil {
- return nil, err
- }
-
- versionWildcardType := getWildcardType(vStr)
- flatVersion := createVersionFromWildcard(vStr)
-
- var resultOperator string
- var shouldIncrementVersion bool
- switch opStr {
- case ">":
- resultOperator = ">="
- shouldIncrementVersion = true
- case ">=":
- resultOperator = ">="
- case "<":
- resultOperator = "<"
- case "<=":
- resultOperator = "<"
- shouldIncrementVersion = true
- case "", "=", "==":
- newParts = append(newParts, ">="+flatVersion)
- resultOperator = "<"
- shouldIncrementVersion = true
- case "!=", "!":
- newParts = append(newParts, "<"+flatVersion)
- resultOperator = ">="
- shouldIncrementVersion = true
- }
-
- var resultVersion string
- if shouldIncrementVersion {
- switch versionWildcardType {
- case patchWildcard:
- resultVersion, _ = incrementMinorVersion(flatVersion)
- case minorWildcard:
- resultVersion, _ = incrementMajorVersion(flatVersion)
- }
- } else {
- resultVersion = flatVersion
- }
-
- ap = resultOperator + resultVersion
- }
- newParts = append(newParts, ap)
- }
- expandedParts = append(expandedParts, newParts)
- }
-
- return expandedParts, nil
-}
-
-func parseComparator(s string) comparator {
- switch s {
- case "==":
- fallthrough
- case "":
- fallthrough
- case "=":
- return compEQ
- case ">":
- return compGT
- case ">=":
- return compGE
- case "<":
- return compLT
- case "<=":
- return compLE
- case "!":
- fallthrough
- case "!=":
- return compNE
- }
-
- return nil
-}
-
-// MustParseRange is like ParseRange but panics if the range cannot be parsed.
-func MustParseRange(s string) Range {
- r, err := ParseRange(s)
- if err != nil {
- panic(`semver: ParseRange(` + s + `): ` + err.Error())
- }
- return r
-}
diff --git a/vendor/github.com/blang/semver/semver.go b/vendor/github.com/blang/semver/semver.go
deleted file mode 100644
index 4165bc791e811cf9b5a1cc3efcea760e0a5f26c5..0000000000000000000000000000000000000000
--- a/vendor/github.com/blang/semver/semver.go
+++ /dev/null
@@ -1,455 +0,0 @@
-package semver
-
-import (
- "errors"
- "fmt"
- "strconv"
- "strings"
-)
-
-const (
- numbers string = "0123456789"
- alphas = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"
- alphanum = alphas + numbers
-)
-
-// SpecVersion is the latest fully supported spec version of semver
-var SpecVersion = Version{
- Major: 2,
- Minor: 0,
- Patch: 0,
-}
-
-// Version represents a semver compatible version
-type Version struct {
- Major uint64
- Minor uint64
- Patch uint64
- Pre []PRVersion
- Build []string //No Precedence
-}
-
-// Version to string
-func (v Version) String() string {
- b := make([]byte, 0, 5)
- b = strconv.AppendUint(b, v.Major, 10)
- b = append(b, '.')
- b = strconv.AppendUint(b, v.Minor, 10)
- b = append(b, '.')
- b = strconv.AppendUint(b, v.Patch, 10)
-
- if len(v.Pre) > 0 {
- b = append(b, '-')
- b = append(b, v.Pre[0].String()...)
-
- for _, pre := range v.Pre[1:] {
- b = append(b, '.')
- b = append(b, pre.String()...)
- }
- }
-
- if len(v.Build) > 0 {
- b = append(b, '+')
- b = append(b, v.Build[0]...)
-
- for _, build := range v.Build[1:] {
- b = append(b, '.')
- b = append(b, build...)
- }
- }
-
- return string(b)
-}
-
-// Equals checks if v is equal to o.
-func (v Version) Equals(o Version) bool {
- return (v.Compare(o) == 0)
-}
-
-// EQ checks if v is equal to o.
-func (v Version) EQ(o Version) bool {
- return (v.Compare(o) == 0)
-}
-
-// NE checks if v is not equal to o.
-func (v Version) NE(o Version) bool {
- return (v.Compare(o) != 0)
-}
-
-// GT checks if v is greater than o.
-func (v Version) GT(o Version) bool {
- return (v.Compare(o) == 1)
-}
-
-// GTE checks if v is greater than or equal to o.
-func (v Version) GTE(o Version) bool {
- return (v.Compare(o) >= 0)
-}
-
-// GE checks if v is greater than or equal to o.
-func (v Version) GE(o Version) bool {
- return (v.Compare(o) >= 0)
-}
-
-// LT checks if v is less than o.
-func (v Version) LT(o Version) bool {
- return (v.Compare(o) == -1)
-}
-
-// LTE checks if v is less than or equal to o.
-func (v Version) LTE(o Version) bool {
- return (v.Compare(o) <= 0)
-}
-
-// LE checks if v is less than or equal to o.
-func (v Version) LE(o Version) bool {
- return (v.Compare(o) <= 0)
-}
-
-// Compare compares Versions v to o:
-// -1 == v is less than o
-// 0 == v is equal to o
-// 1 == v is greater than o
-func (v Version) Compare(o Version) int {
- if v.Major != o.Major {
- if v.Major > o.Major {
- return 1
- }
- return -1
- }
- if v.Minor != o.Minor {
- if v.Minor > o.Minor {
- return 1
- }
- return -1
- }
- if v.Patch != o.Patch {
- if v.Patch > o.Patch {
- return 1
- }
- return -1
- }
-
- // Quick comparison if a version has no prerelease versions
- if len(v.Pre) == 0 && len(o.Pre) == 0 {
- return 0
- } else if len(v.Pre) == 0 && len(o.Pre) > 0 {
- return 1
- } else if len(v.Pre) > 0 && len(o.Pre) == 0 {
- return -1
- }
-
- i := 0
- for ; i < len(v.Pre) && i < len(o.Pre); i++ {
- if comp := v.Pre[i].Compare(o.Pre[i]); comp == 0 {
- continue
- } else if comp == 1 {
- return 1
- } else {
- return -1
- }
- }
-
- // If all pr versions are the equal but one has further prversion, this one greater
- if i == len(v.Pre) && i == len(o.Pre) {
- return 0
- } else if i == len(v.Pre) && i < len(o.Pre) {
- return -1
- } else {
- return 1
- }
-
-}
-
-// IncrementPatch increments the patch version
-func (v *Version) IncrementPatch() error {
- if v.Major == 0 {
- return fmt.Errorf("Patch version can not be incremented for %q", v.String())
- }
- v.Patch += 1
- return nil
-}
-
-// IncrementMinor increments the minor version
-func (v *Version) IncrementMinor() error {
- if v.Major == 0 {
- return fmt.Errorf("Minor version can not be incremented for %q", v.String())
- }
- v.Minor += 1
- v.Patch = 0
- return nil
-}
-
-// IncrementMajor increments the major version
-func (v *Version) IncrementMajor() error {
- if v.Major == 0 {
- return fmt.Errorf("Major version can not be incremented for %q", v.String())
- }
- v.Major += 1
- v.Minor = 0
- v.Patch = 0
- return nil
-}
-
-// Validate validates v and returns error in case
-func (v Version) Validate() error {
- // Major, Minor, Patch already validated using uint64
-
- for _, pre := range v.Pre {
- if !pre.IsNum { //Numeric prerelease versions already uint64
- if len(pre.VersionStr) == 0 {
- return fmt.Errorf("Prerelease can not be empty %q", pre.VersionStr)
- }
- if !containsOnly(pre.VersionStr, alphanum) {
- return fmt.Errorf("Invalid character(s) found in prerelease %q", pre.VersionStr)
- }
- }
- }
-
- for _, build := range v.Build {
- if len(build) == 0 {
- return fmt.Errorf("Build meta data can not be empty %q", build)
- }
- if !containsOnly(build, alphanum) {
- return fmt.Errorf("Invalid character(s) found in build meta data %q", build)
- }
- }
-
- return nil
-}
-
-// New is an alias for Parse and returns a pointer, parses version string and returns a validated Version or error
-func New(s string) (vp *Version, err error) {
- v, err := Parse(s)
- vp = &v
- return
-}
-
-// Make is an alias for Parse, parses version string and returns a validated Version or error
-func Make(s string) (Version, error) {
- return Parse(s)
-}
-
-// ParseTolerant allows for certain version specifications that do not strictly adhere to semver
-// specs to be parsed by this library. It does so by normalizing versions before passing them to
-// Parse(). It currently trims spaces, removes a "v" prefix, adds a 0 patch number to versions
-// with only major and minor components specified, and removes leading 0s.
-func ParseTolerant(s string) (Version, error) {
- s = strings.TrimSpace(s)
- s = strings.TrimPrefix(s, "v")
-
- // Split into major.minor.(patch+pr+meta)
- parts := strings.SplitN(s, ".", 3)
- // Remove leading zeros.
- for i, p := range parts {
- if len(p) > 1 {
- parts[i] = strings.TrimPrefix(p, "0")
- }
- }
- // Fill up shortened versions.
- if len(parts) < 3 {
- if strings.ContainsAny(parts[len(parts)-1], "+-") {
- return Version{}, errors.New("Short version cannot contain PreRelease/Build meta data")
- }
- for len(parts) < 3 {
- parts = append(parts, "0")
- }
- }
- s = strings.Join(parts, ".")
-
- return Parse(s)
-}
-
-// Parse parses version string and returns a validated Version or error
-func Parse(s string) (Version, error) {
- if len(s) == 0 {
- return Version{}, errors.New("Version string empty")
- }
-
- // Split into major.minor.(patch+pr+meta)
- parts := strings.SplitN(s, ".", 3)
- if len(parts) != 3 {
- return Version{}, errors.New("No Major.Minor.Patch elements found")
- }
-
- // Major
- if !containsOnly(parts[0], numbers) {
- return Version{}, fmt.Errorf("Invalid character(s) found in major number %q", parts[0])
- }
- if hasLeadingZeroes(parts[0]) {
- return Version{}, fmt.Errorf("Major number must not contain leading zeroes %q", parts[0])
- }
- major, err := strconv.ParseUint(parts[0], 10, 64)
- if err != nil {
- return Version{}, err
- }
-
- // Minor
- if !containsOnly(parts[1], numbers) {
- return Version{}, fmt.Errorf("Invalid character(s) found in minor number %q", parts[1])
- }
- if hasLeadingZeroes(parts[1]) {
- return Version{}, fmt.Errorf("Minor number must not contain leading zeroes %q", parts[1])
- }
- minor, err := strconv.ParseUint(parts[1], 10, 64)
- if err != nil {
- return Version{}, err
- }
-
- v := Version{}
- v.Major = major
- v.Minor = minor
-
- var build, prerelease []string
- patchStr := parts[2]
-
- if buildIndex := strings.IndexRune(patchStr, '+'); buildIndex != -1 {
- build = strings.Split(patchStr[buildIndex+1:], ".")
- patchStr = patchStr[:buildIndex]
- }
-
- if preIndex := strings.IndexRune(patchStr, '-'); preIndex != -1 {
- prerelease = strings.Split(patchStr[preIndex+1:], ".")
- patchStr = patchStr[:preIndex]
- }
-
- if !containsOnly(patchStr, numbers) {
- return Version{}, fmt.Errorf("Invalid character(s) found in patch number %q", patchStr)
- }
- if hasLeadingZeroes(patchStr) {
- return Version{}, fmt.Errorf("Patch number must not contain leading zeroes %q", patchStr)
- }
- patch, err := strconv.ParseUint(patchStr, 10, 64)
- if err != nil {
- return Version{}, err
- }
-
- v.Patch = patch
-
- // Prerelease
- for _, prstr := range prerelease {
- parsedPR, err := NewPRVersion(prstr)
- if err != nil {
- return Version{}, err
- }
- v.Pre = append(v.Pre, parsedPR)
- }
-
- // Build meta data
- for _, str := range build {
- if len(str) == 0 {
- return Version{}, errors.New("Build meta data is empty")
- }
- if !containsOnly(str, alphanum) {
- return Version{}, fmt.Errorf("Invalid character(s) found in build meta data %q", str)
- }
- v.Build = append(v.Build, str)
- }
-
- return v, nil
-}
-
-// MustParse is like Parse but panics if the version cannot be parsed.
-func MustParse(s string) Version {
- v, err := Parse(s)
- if err != nil {
- panic(`semver: Parse(` + s + `): ` + err.Error())
- }
- return v
-}
-
-// PRVersion represents a PreRelease Version
-type PRVersion struct {
- VersionStr string
- VersionNum uint64
- IsNum bool
-}
-
-// NewPRVersion creates a new valid prerelease version
-func NewPRVersion(s string) (PRVersion, error) {
- if len(s) == 0 {
- return PRVersion{}, errors.New("Prerelease is empty")
- }
- v := PRVersion{}
- if containsOnly(s, numbers) {
- if hasLeadingZeroes(s) {
- return PRVersion{}, fmt.Errorf("Numeric PreRelease version must not contain leading zeroes %q", s)
- }
- num, err := strconv.ParseUint(s, 10, 64)
-
- // Might never be hit, but just in case
- if err != nil {
- return PRVersion{}, err
- }
- v.VersionNum = num
- v.IsNum = true
- } else if containsOnly(s, alphanum) {
- v.VersionStr = s
- v.IsNum = false
- } else {
- return PRVersion{}, fmt.Errorf("Invalid character(s) found in prerelease %q", s)
- }
- return v, nil
-}
-
-// IsNumeric checks if prerelease-version is numeric
-func (v PRVersion) IsNumeric() bool {
- return v.IsNum
-}
-
-// Compare compares two PreRelease Versions v and o:
-// -1 == v is less than o
-// 0 == v is equal to o
-// 1 == v is greater than o
-func (v PRVersion) Compare(o PRVersion) int {
- if v.IsNum && !o.IsNum {
- return -1
- } else if !v.IsNum && o.IsNum {
- return 1
- } else if v.IsNum && o.IsNum {
- if v.VersionNum == o.VersionNum {
- return 0
- } else if v.VersionNum > o.VersionNum {
- return 1
- } else {
- return -1
- }
- } else { // both are Alphas
- if v.VersionStr == o.VersionStr {
- return 0
- } else if v.VersionStr > o.VersionStr {
- return 1
- } else {
- return -1
- }
- }
-}
-
-// PreRelease version to string
-func (v PRVersion) String() string {
- if v.IsNum {
- return strconv.FormatUint(v.VersionNum, 10)
- }
- return v.VersionStr
-}
-
-func containsOnly(s string, set string) bool {
- return strings.IndexFunc(s, func(r rune) bool {
- return !strings.ContainsRune(set, r)
- }) == -1
-}
-
-func hasLeadingZeroes(s string) bool {
- return len(s) > 1 && s[0] == '0'
-}
-
-// NewBuildVersion creates a new valid build version
-func NewBuildVersion(s string) (string, error) {
- if len(s) == 0 {
- return "", errors.New("Buildversion is empty")
- }
- if !containsOnly(s, alphanum) {
- return "", fmt.Errorf("Invalid character(s) found in build meta data %q", s)
- }
- return s, nil
-}
diff --git a/vendor/github.com/blang/semver/sort.go b/vendor/github.com/blang/semver/sort.go
deleted file mode 100644
index e18f880826ab734d06bab57ae8486ccbea889212..0000000000000000000000000000000000000000
--- a/vendor/github.com/blang/semver/sort.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package semver
-
-import (
- "sort"
-)
-
-// Versions represents multiple versions.
-type Versions []Version
-
-// Len returns length of version collection
-func (s Versions) Len() int {
- return len(s)
-}
-
-// Swap swaps two versions inside the collection by its indices
-func (s Versions) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-// Less checks if version at index i is less than version at index j
-func (s Versions) Less(i, j int) bool {
- return s[i].LT(s[j])
-}
-
-// Sort sorts a slice of versions
-func Sort(versions []Version) {
- sort.Sort(Versions(versions))
-}
diff --git a/vendor/github.com/blang/semver/sql.go b/vendor/github.com/blang/semver/sql.go
deleted file mode 100644
index db958134f3b4b5a34d9cf79c56fa30b93e8d9327..0000000000000000000000000000000000000000
--- a/vendor/github.com/blang/semver/sql.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package semver
-
-import (
- "database/sql/driver"
- "fmt"
-)
-
-// Scan implements the database/sql.Scanner interface.
-func (v *Version) Scan(src interface{}) (err error) {
- var str string
- switch src := src.(type) {
- case string:
- str = src
- case []byte:
- str = string(src)
- default:
- return fmt.Errorf("version.Scan: cannot convert %T to string", src)
- }
-
- if t, err := Parse(str); err == nil {
- *v = t
- }
-
- return
-}
-
-// Value implements the database/sql/driver.Valuer interface.
-func (v Version) Value() (driver.Value, error) {
- return v.String(), nil
-}
diff --git a/vendor/github.com/cheekybits/genny/LICENSE b/vendor/github.com/cheekybits/genny/LICENSE
deleted file mode 100644
index 519d7f22729b6de9d3cb464577e8a129ee4015e3..0000000000000000000000000000000000000000
--- a/vendor/github.com/cheekybits/genny/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 cheekybits
-
-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/cheekybits/genny/generic/doc.go b/vendor/github.com/cheekybits/genny/generic/doc.go
deleted file mode 100644
index 3bd6c869c0f666b541e0426c0ee7dd781e394347..0000000000000000000000000000000000000000
--- a/vendor/github.com/cheekybits/genny/generic/doc.go
+++ /dev/null
@@ -1,2 +0,0 @@
-// Package generic contains the generic marker types.
-package generic
diff --git a/vendor/github.com/cheekybits/genny/generic/generic.go b/vendor/github.com/cheekybits/genny/generic/generic.go
deleted file mode 100644
index 04a2306cbf18bca46194805b9d207c4474786a7f..0000000000000000000000000000000000000000
--- a/vendor/github.com/cheekybits/genny/generic/generic.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package generic
-
-// Type is the placeholder type that indicates a generic value.
-// When genny is executed, variables of this type will be replaced with
-// references to the specific types.
-// var GenericType generic.Type
-type Type interface{}
-
-// Number is the placehoder type that indiccates a generic numerical value.
-// When genny is executed, variables of this type will be replaced with
-// references to the specific types.
-// var GenericType generic.Number
-type Number float64
diff --git a/vendor/github.com/corpix/uarand/.gitignore b/vendor/github.com/corpix/uarand/.gitignore
deleted file mode 100644
index 4f59364bc9291b350934667804afdb018669f663..0000000000000000000000000000000000000000
--- a/vendor/github.com/corpix/uarand/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/build
-/vendor
-*~
diff --git a/vendor/github.com/corpix/uarand/.go-makefile.json b/vendor/github.com/corpix/uarand/.go-makefile.json
deleted file mode 100644
index b111df4e27a9f3590cb4c9a3e02e1b4131e38ec6..0000000000000000000000000000000000000000
--- a/vendor/github.com/corpix/uarand/.go-makefile.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "build_id_generator": "0x$(shell echo $(version) | sha1sum | awk '{print $$1}')",
- "host": "github.com",
- "include": ["useragents.mk"],
- "kind": "package",
- "name": "uarand",
- "tool": [],
- "user": "corpix",
- "version_generator": "$(shell git rev-list --count HEAD).$(shell git rev-parse --short HEAD)",
- "version_variable": "cli.version"
-}
diff --git a/vendor/github.com/corpix/uarand/.travis.yml b/vendor/github.com/corpix/uarand/.travis.yml
deleted file mode 100644
index 0d9e6e633069dabfb5821f7ded74fd0105fc3435..0000000000000000000000000000000000000000
--- a/vendor/github.com/corpix/uarand/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: go
-
-go:
- - 1.6
- - 1.7
- - 1.8
- - master
-
-script: make test
diff --git a/vendor/github.com/corpix/uarand/LICENSE b/vendor/github.com/corpix/uarand/LICENSE
deleted file mode 100644
index e70c2b1f3821668baa95ac7ab309133ae520abd1..0000000000000000000000000000000000000000
--- a/vendor/github.com/corpix/uarand/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright © 2017 Dmitry Moskowski
-
-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/corpix/uarand/Makefile b/vendor/github.com/corpix/uarand/Makefile
deleted file mode 100644
index d96582158c16c37076d9417e91c1b28ae6d9446c..0000000000000000000000000000000000000000
--- a/vendor/github.com/corpix/uarand/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-.DEFAULT_GOAL = all
-
-numcpus := $(shell cat /proc/cpuinfo | grep '^processor\s*:' | wc -l)
-version := $(shell git rev-list --count HEAD).$(shell git rev-parse --short HEAD)
-
-name := uarand
-package := github.com/corpix/$(name)
-
-.PHONY: all
-all:: dependencies
-
-.PHONY: tools
-tools::
- @if [ ! -e "$(GOPATH)"/bin/glide ]; then go get github.com/Masterminds/glide; fi
- @if [ ! -e "$(GOPATH)"/bin/glide-cleanup ]; then go get github.com/ngdinhtoan/glide-cleanup; fi
- @if [ ! -e "$(GOPATH)"/bin/glide-vc ]; then go get github.com/sgotti/glide-vc; fi
- @if [ ! -e "$(GOPATH)"/bin/godef ]; then go get github.com/rogpeppe/godef; fi
- @if [ ! -e "$(GOPATH)"/bin/gocode ]; then go get github.com/nsf/gocode; fi
- @if [ ! -e "$(GOPATH)"/bin/gometalinter ]; then go get github.com/alecthomas/gometalinter && gometalinter --install; fi
- @if [ ! -e "$(GOPATH)"/src/github.com/stretchr/testify/assert ]; then go get github.com/stretchr/testify/assert; fi
-
-.PHONY: dependencies
-dependencies:: tools
- glide install
-
-.PHONY: clean
-clean:: tools
- glide cache-clear
-
-.PHONY: test
-test:: dependencies
- go test -v \
- $(shell glide novendor)
-
-.PHONY: bench
-bench:: dependencies
- go test \
- -bench=. -v \
- $(shell glide novendor)
-
-.PHONY: lint
-lint:: dependencies
- go vet $(shell glide novendor)
- gometalinter \
- --deadline=5m \
- --concurrency=$(numcpus) \
- $(shell glide novendor)
-
-.PHONY: check
-check:: lint test
-
-include useragents.mk
diff --git a/vendor/github.com/corpix/uarand/README.md b/vendor/github.com/corpix/uarand/README.md
deleted file mode 100644
index d79b5c29b68e2a3280b39f1b45c5cad7b0d44deb..0000000000000000000000000000000000000000
--- a/vendor/github.com/corpix/uarand/README.md
+++ /dev/null
@@ -1,38 +0,0 @@
-uarand
-----------------
-
-[](https://travis-ci.org/corpix/uarand)
-
-Random user-agent producer for go.
-
-## Example
-
-``` go
-package main
-
-import (
- "fmt"
-
- "github.com/corpix/uarand"
-)
-
-func main() {
- fmt.Println(uarand.GetRandom())
-}
-```
-
-Save it to `snippet.go` and run:
-
-``` shell
-go run snippet.go
-```
-
-Which should produce something similar to:
-
-``` text
-Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36
-```
-
-## License
-
-MIT
diff --git a/vendor/github.com/corpix/uarand/glide.lock b/vendor/github.com/corpix/uarand/glide.lock
deleted file mode 100644
index abb3ec579795530bb0e1a7143f1959a2f8aebe71..0000000000000000000000000000000000000000
--- a/vendor/github.com/corpix/uarand/glide.lock
+++ /dev/null
@@ -1,16 +0,0 @@
-hash: 400dee10adae21284f2563cb7178f4b5a30e69c9ed3954a5a32a8a618d5bdfeb
-updated: 2017-07-12T21:00:19.452016303Z
-imports: []
-testImports:
-- name: github.com/davecgh/go-spew
- version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9
- subpackages:
- - spew
-- name: github.com/pmezard/go-difflib
- version: d8ed2627bdf02c080bf22230dbb337003b7aba2d
- subpackages:
- - difflib
-- name: github.com/stretchr/testify
- version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0
- subpackages:
- - assert
diff --git a/vendor/github.com/corpix/uarand/glide.yaml b/vendor/github.com/corpix/uarand/glide.yaml
deleted file mode 100644
index 037ee2450e39f3920692e9ade73a46aa5273525e..0000000000000000000000000000000000000000
--- a/vendor/github.com/corpix/uarand/glide.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-package: github.com/corpix/uarand
-import: []
-testImport:
-- package: github.com/stretchr/testify
- version: v1.1.4
- subpackages:
- - assert
diff --git a/vendor/github.com/corpix/uarand/uarand.go b/vendor/github.com/corpix/uarand/uarand.go
deleted file mode 100644
index 04f9247c2c3d9a3c5a8dd64429af9f874f21d613..0000000000000000000000000000000000000000
--- a/vendor/github.com/corpix/uarand/uarand.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package uarand
-
-import (
- "math/rand"
- "time"
-)
-
-var (
- // Default is the UARand with default settings.
- Default = New(
- rand.New(
- rand.NewSource(time.Now().UnixNano()),
- ),
- )
-)
-
-// Randomizer represents some entity which could provide us an entropy.
-type Randomizer interface {
- Seed(n int64)
- Intn(n int) int
-}
-
-// UARand describes the user agent randomizer settings.
-type UARand struct {
- Randomizer
-}
-
-// GetRandom returns a random user agent from UserAgents slice.
-func (u *UARand) GetRandom() string {
- return UserAgents[u.Intn(len(UserAgents))]
-}
-
-// GetRandom returns a random user agent from UserAgents slice.
-// This version is driven by Default configuration.
-func GetRandom() string {
- return Default.GetRandom()
-}
-
-func New(r Randomizer) *UARand {
- return &UARand{r}
-}
diff --git a/vendor/github.com/corpix/uarand/useragents.go b/vendor/github.com/corpix/uarand/useragents.go
deleted file mode 100644
index aa8e44cc95c64829c7283d1a8b1d60c7b96d4f24..0000000000000000000000000000000000000000
--- a/vendor/github.com/corpix/uarand/useragents.go
+++ /dev/null
@@ -1,829 +0,0 @@
-package uarand
-
-var (
- // UserAgents is a list of browser and bots user agents.
- UserAgents = []string{
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/527 (KHTML, like Gecko, Safari/419.3) Arora/0.6 (Change: )",
- "Avant Browser/1.2.789rel1 (http://www.avantbrowser.com)",
- "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.0 Safari/532.5",
- "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.310.0 Safari/532.9",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.514.0 Safari/534.7",
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.14 (KHTML, like Gecko) Chrome/9.0.601.0 Safari/534.14",
- "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.14 (KHTML, like Gecko) Chrome/10.0.601.0 Safari/534.14",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.27 (KHTML, like Gecko) Chrome/12.0.712.0 Safari/534.27",
- "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.36 Safari/535.7",
- "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/18.6.872.0 Safari/535.2 UNTRUSTED/1.0 3gpp-gba UNTRUSTED/1.0",
- "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1061.1 Safari/536.3",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1092.0 Safari/536.6",
- "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1",
- "Mozilla/5.0 (Windows; U; Windows NT 6.0 x64; en-US; rv:1.9pre) Gecko/2008072421 Minefield/3.0.2pre",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10",
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)",
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6 GTB5",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 ( .NET CLR 3.5.30729; .NET4.0E)",
- "Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
- "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
- "Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a2) Gecko/20110622 Firefox/6.0a2",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1",
- "Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120403211507 Firefox/12.0",
- "Mozilla/5.0 (Windows NT 6.0; rv:14.0) Gecko/20100101 Firefox/14.0.1",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120427 Firefox/15.0a1",
- "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:16.0) Gecko/16.0 Firefox/16.0",
- "Mozilla/5.0 (Windows NT 6.2; rv:19.0) Gecko/20121129 Firefox/19.0",
- "Mozilla/5.0 (Windows NT 6.2; rv:20.0) Gecko/20121202 Firefox/20.0",
- "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Maxthon 2.0)",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b4pre) Gecko/20100815 Minefield/4.0b4pre",
- "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0 )",
- "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)",
- "Mozilla/5.0 (Windows; U; Windows XP) Gecko MultiZilla/1.6.1.0a",
- "Mozilla/2.02E (Win95; U)",
- "Mozilla/3.01Gold (Win95; I)",
- "Mozilla/4.8 [en] (Windows NT 5.1; U)",
- "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko Netscape/7.1 (ax)",
- "Opera/7.50 (Windows XP; U)",
- "Opera/7.50 (Windows ME; U) [en]",
- "Opera/7.51 (Windows NT 5.1; U) [en]",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; en) Opera 8.0",
- "Opera/9.25 (Windows NT 6.0; U; en)",
- "Opera/9.80 (Windows NT 5.2; U; en) Presto/2.2.15 Version/10.10",
- "Opera/9.80 (Windows NT 5.1; U; zh-tw) Presto/2.8.131 Version/11.10",
- "Opera/9.80 (Windows NT 6.1; U; en) Presto/2.7.62 Version/11.01",
- "Opera/9.80 (Windows NT 6.1; U; es-ES) Presto/2.9.181 Version/12.00",
- "Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14",
- "Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2b) Gecko/20021001 Phoenix/0.2",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090825 SeaMonkey/1.1.18",
- "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.17) Gecko/20110123 (like Firefox/3.x) SeaMonkey/2.0.12",
- "Mozilla/5.0 (Windows NT 5.2; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1",
- "Mozilla/5.0 (Windows; U; ; en-NZ) AppleWebKit/527 (KHTML, like Gecko, Safari/419.3) Arora/0.8.0",
- "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser; Avant Browser; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.8 (KHTML, like Gecko) Beamrise/17.2.0.9 Chrome/17.0.939.0 Safari/535.8",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/28.0.1469.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/28.0.1469.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36",
- "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36",
- "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2869.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 AOL/11.0 AOLBUILD/11.0.1305 Safari/537.36",
- "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3191.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0",
- "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240",
- "Mozilla/5.0 (MSIE 9.0; Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14931",
- "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063",
- "Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20130401 Firefox/21.0",
- "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0",
- "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/29.0",
- "Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0",
- "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:35.0) Gecko/20100101 Firefox/35.0",
- "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0",
- "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0",
- "Mozilla/5.0 (Windows NT 6.0; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0",
- "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0",
- "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0",
- "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0",
- "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0",
- "iTunes/9.0.2 (Windows; N)",
- "Mozilla/5.0 (compatible; Konqueror/4.5; Windows) KHTML/4.5.4 (like Gecko)",
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.1 (KHTML, like Gecko) Maxthon/3.0.8.2 Safari/533.1",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML like Gecko) Maxthon/4.0.0.2000 Chrome/22.0.1229.79 Safari/537.1",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.6.1000 Chrome/30.0.1599.101 Safari/537.36",
- "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/5.0.4.3000 Chrome/47.0.2526.73 Safari/537.36",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)",
- "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)",
- "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)",
- "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)",
- "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0)",
- "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)",
- "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.0)",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.2; Trident/5.0)",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.2; WOW64; Trident/5.0)",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; Zune 4.7)",
- "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
- "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/6.0)",
- "Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko",
- "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko",
- "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C)",
- "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) MxBrowser/4.5.10.7000 Chrome/30.0.1551.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; MATBJS; rv:11.0) like Gecko",
- "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; MALNJS; rv:11.0) like Gecko",
- "Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.16",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.12 Safari/537.36 OPR/14.0.1116.4",
- "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.29 Safari/537.36 OPR/15.0.1147.24 (Edition Next)",
- "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36 OPR/18.0.1284.49",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.76 Safari/537.36 OPR/19.0.1326.56",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36 OPR/20.0.1387.91",
- "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.76 Safari/537.36 OPR/28.0.1750.40",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.155 Safari/537.36 OPR/31.0.1889.174",
- "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 OPR/36.0.2130.46",
- "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36 OPR/47.0.2631.55",
- "Mozilla/5.0 (Windows NT 10.0; rv:45.9) Gecko/20100101 Goanna/3.2 Firefox/45.9 PaleMoon/27.4.0",
- "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8",
- "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5",
- "Mozilla/5.0 (Windows; U; Windows NT 6.2; es-US ) AppleWebKit/540.0 (KHTML like Gecko) Version/6.0 Safari/8900.00",
- "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.71 (KHTML like Gecko) WebVideo/1.0.1.10 Version/7.0 Safari/537.71",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120422 Firefox/12.0 SeaMonkey/2.9",
- "Mozilla/5.0 (Windows NT 6.0; rv:36.0) Gecko/20100101 Firefox/36.0 SeaMonkey/2.33.1",
- "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 UBrowser/5.6.13705.206 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.89 Vivaldi/1.0.94.2 Safari/537.36",
- "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.90 Safari/537.36 Vivaldi/1.4.589.11",
- "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.91 Safari/537.36 Vivaldi/1.92.917.39",
- "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 YaBrowser/17.3.0.1785 Yowser/2.5 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Camino/2.2.1",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre Camino/2.2a1pre",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/532.8 (KHTML, like Gecko) Chrome/4.0.302.2 Safari/532.8",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.464.0 Safari/534.3",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.15 Safari/534.13",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.186 Safari/535.1",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.54 Safari/535.2",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.36 Safari/535.7",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/536.3 (KHTML, like Gecko) Chrome/19.0.1063.0 Safari/536.3",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.4 (KHTML like Gecko) Chrome/22.0.1229.79 Safari/537.4",
- "Mozilla/5.0 (Macintosh; U; Mac OS X Mach-O; en-US; rv:2.0a) Gecko/20040614 Firefox/3.0.0",
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv:1.9.0.3) Gecko/2008092414 Firefox/3.0.3",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.14) Gecko/20110218 AlexaToolbar/alxf-2.0 Firefox/3.6.14",
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20100101 Firefox/5.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2; rv:10.0.1) Gecko/20100101 Firefox/10.0.1",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20120813 Firefox/16.0",
- "Mozilla/4.0 (compatible; MSIE 5.15; Mac_PowerPC)",
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/125.4 (KHTML, like Gecko, Safari) OmniWeb/v563.15",
- "Opera/9.0 (Macintosh; PPC Mac OS X; U; en)",
- "Opera/9.20 (Macintosh; Intel Mac OS X; U; en)",
- "Opera/9.64 (Macintosh; PPC Mac OS X; U; en) Presto/2.1.1",
- "Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.6.30 Version/10.61",
- "Opera/9.80 (Macintosh; Intel Mac OS X 10.4.11; U; en) Presto/2.7.62 Version/11.00",
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/85.8",
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.8",
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; fr-fr) AppleWebKit/312.5 (KHTML, like Gecko) Safari/312.3",
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.8 (KHTML, like Gecko) Safari/419.3",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.31 (KHTML like Gecko) Chrome/26.0.1410.63 Safari/537.31",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 1083) AppleWebKit/537.36 (KHTML like Gecko) Chrome/28.0.1469.0 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2859.0 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.49 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:20.0) Gecko/20100101 Firefox/20.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:25.0) Gecko/20100101 Firefox/25.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:35.0) Gecko/20100101 Firefox/35.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) Gecko/20100101 Firefox/40.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:47.0) Gecko/20100101 Firefox/47.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:49.0) Gecko/20100101 Firefox/49.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:55.0) Gecko/20100101 Firefox/55.0",
- "iTunes/4.2 (Macintosh; U; PPC Mac OS X 10.2)",
- "iTunes/9.0.3 (Macintosh; U; Intel Mac OS X 10_6_2; en-ca)",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Maxthon/4.5.2",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US) AppleWebKit/528.16 (KHTML, like Gecko, Safari/528.16) OmniWeb/v622.8.0.112941",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-US) AppleWebKit/528.16 (KHTML, like Gecko, Safari/528.16) OmniWeb/v622.8.0",
- "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36 OPR/28.0.1750.51",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.82 Safari/537.36 OPR/29.0.1795.41",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; de-de) AppleWebKit/534.15 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_7; en-us) AppleWebKit/534.20.8 (KHTML, like Gecko) Version/5.1 Safari/534.20.8",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.3 Safari/534.53.10",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/536.26.17 (KHTML like Gecko) Version/6.0.2 Safari/536.26.17",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.78.1 (KHTML like Gecko) Version/7.0.6 Safari/537.78.1",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11) AppleWebKit/601.1.56 (KHTML, like Gecko) Version/9.0 Safari/601.1.56",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.8 (KHTML, like Gecko) Version/10.1 Safari/603.1.30",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.13.81_10003810) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.105 Safari/537.36 Vivaldi/1.0.162.9",
- "ELinks (0.4pre5; Linux 2.6.10-ac7 i686; 80x33)",
- "ELinks/0.9.3 (textmode; Linux 2.6.9-kanotix-8 i686; 127x41)",
- "ELinks/0.12~pre5-4",
- "Links/0.9.1 (Linux 2.4.24; i386;)",
- "Links (2.1pre15; Linux 2.4.26 i686; 158x61)",
- "Links (2.3pre1; Linux 2.6.38-8-generic x86_64; 170x48)",
- "Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/0.8.12",
- "w3m/0.5.1",
- "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.4 (KHTML, like Gecko) Chrome/4.0.237.0 Safari/532.4 Debian",
- "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.8 (KHTML, like Gecko) Chrome/4.0.277.0 Safari/532.8",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.309.0 Safari/532.9",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.514.0 Safari/534.7",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/540.0 (KHTML, like Gecko) Ubuntu/10.10 Chrome/9.1.0.0 Safari/540.0",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.15 (KHTML, like Gecko) Chrome/10.0.613.0 Safari/534.15",
- "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.15 (KHTML, like Gecko) Ubuntu/10.10 Chromium/10.0.613.0 Chrome/10.0.613.0 Safari/534.15",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Ubuntu/10.10 Chromium/12.0.703.0 Chrome/12.0.703.0 Safari/534.24",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.20 Safari/535.1",
- "Mozilla/5.0 Slackware/13.37 (X11; U; Linux x86_64; en-US) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41",
- "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Ubuntu/11.04 Chromium/14.0.825.0 Chrome/14.0.825.0 Safari/535.1",
- "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.874.120 Chrome/15.0.874.120 Safari/535.2",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.9 Safari/536.5",
- "Mozilla/5.0 (X11; U; Linux; i686; en-US; rv:1.6) Gecko Epiphany/1.2.5",
- "Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.3) Gecko/20040924 Epiphany/1.4.4 (Ubuntu)",
- "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040614 Firefox/0.8",
- "Mozilla/5.0 (X11; U; Linux x86_64; sv-SE; rv:1.8.1.12) Gecko/20080207 Ubuntu/7.10 (gutsy) Firefox/2.0.0.12",
- "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.11) Gecko/2009060309 Ubuntu/9.10 (karmic) Firefox/3.0.11",
- "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.2) Gecko/20090803 Ubuntu/9.04 (jaunty) Shiretoko/3.5.2",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091107 Firefox/3.5.5",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20091020 Linux Mint/8 (Helena) Firefox/3.5.3",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100915 Gentoo Firefox/3.6.9",
- "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.0.2) Gecko/20121223 Ubuntu/9.25 (jaunty) Firefox/3.8",
- "Mozilla/5.0 (X11; Linux i686; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre",
- "Mozilla/5.0 (X11; Linux i686 on x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
- "Mozilla/5.0 (X11; Linux i686; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
- "Mozilla/5.0 (X11; Linux x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
- "Mozilla/5.0 (X11; Linux x86_64; rv:2.2a1pre) Gecko/20100101 Firefox/4.2a1pre",
- "Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20100101 Firefox/5.0",
- "Mozilla/5.0 (X11; Linux i686; rv:6.0) Gecko/20100101 Firefox/6.0",
- "Mozilla/5.0 (X11; Linux x86_64; rv:7.0a1) Gecko/20110623 Firefox/7.0a1",
- "Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20100101 Firefox/8.0",
- "Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1",
- "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20120421 Gecko Firefox/11.0",
- "Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0",
- "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:14.0) Gecko/20100101 Firefox/14.0.1",
- "Mozilla/5.0 (X11; U; Linux; i686; en-US; rv:1.6) Gecko Galeon/1.3.14",
- "Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.8.1.13) Gecko/20080313 Iceape/1.1.9 (Debian-1.1.9-5)",
- "Mozilla/5.0 (X11; U; Linux i686; pt-PT; rv:1.9.2.3) Gecko/20100402 Iceweasel/3.6.3 (like Firefox/3.6.3) GTB7.0",
- "Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0 Iceweasel/5.0",
- "Mozilla/5.0 (X11; Linux i686; rv:6.0a2) Gecko/20110615 Firefox/6.0a2 Iceweasel/6.0a2",
- "Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20100101 Firefox/14.0.1 Iceweasel/14.0.1",
- "Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120724 Debian Iceweasel/15.02",
- "Konqueror/3.0-rc4; (Konqueror/3.0-rc4; i686 Linux;;datecode)",
- "Mozilla/5.0 (compatible; Konqueror/3.3; Linux 2.6.8-gentoo-r3; X11;",
- "Mozilla/5.0 (compatible; Konqueror/3.5; Linux 2.6.30-7.dmz.1-liquorix-686; X11) KHTML/3.5.10 (like Gecko) (Debian package 4:3.5.10.dfsg.1-1 b1)",
- "Mozilla/5.0 (compatible; Konqueror/3.5; Linux; en_US) KHTML/3.5.6 (like Gecko) (Kubuntu)",
- "Mozilla/5.0 (X11; Linux x86_64; en-US; rv:2.0b2pre) Gecko/20100712 Minefield/4.0b2pre",
- "Mozilla/5.0 (X11; U; Linux; i686; en-US; rv:1.6) Gecko Debian/1.6-7",
- "MSIE (MSIE 6.0; X11; Linux; i686) Opera 7.23",
- "Opera/9.64 (X11; Linux i686; U; Linux Mint; nb) Presto/2.1.1",
- "Opera/9.80 (X11; Linux i686; U; en) Presto/2.2.15 Version/10.10",
- "Opera/9.80 (X11; Linux x86_64; U; pl) Presto/2.7.62 Version/11.00",
- "Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.34 (KHTML, like Gecko) QupZilla/1.2.0 Safari/534.34",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.17) Gecko/20110123 SeaMonkey/2.0.12",
- "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061024 Firefox/2.0 (Swiftfox)",
- "Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/527 (KHTML, like Gecko, Safari/419.3) Arora/0.10.1",
- "Mozilla/5.0 (X11; CrOS i686 2268.111.0) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML like Gecko) Chrome/22.0.1229.56 Safari/537.4",
- "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1478.0 Safari/537.36",
- "Mozilla/5.0 (X11; CrOS x86_64 5841.83.0) AppleWebKit/537.36 (KHTML like Gecko) Chrome/36.0.1985.138 Safari/537.36",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/36.0.1985.125 Safari/537.36",
- "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2166.2 Safari/537.36",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Safari/537.36",
- "Mozilla/5.0 (X11; Linux i686 (x86_64)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.130 Safari/537.36",
- "Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2876.0 Safari/537.36",
- "Mozilla/5.0 (X11; Linux i686 (x86_64)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3187.0 Safari/537.366",
- "Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3178.0 Safari/537.36",
- "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.22 (KHTML like Gecko) Ubuntu Chromium/25.0.1364.160 Chrome/25.0.1364.160 Safari/537.22",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/33.0.1750.152 Chrome/33.0.1750.152 Safari/537.36",
- "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/51.0.2704.79 Chrome/51.0.2704.79 Safari/537.36",
- "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/60.0.3112.78 Chrome/60.0.3112.78 Safari/537.36",
- "Mozilla/4.0 (compatible; Dillo 3.0)",
- "Mozilla/5.0 (X11; U; Linux i686; en-us) AppleWebKit/528.5 (KHTML, like Gecko, Safari/528.5 ) lt-GtkLauncher",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.32 (KHTML, like Gecko) Chromium/25.0.1349.2 Chrome/25.0.1349.2 Safari/537.32 Epiphany/3.8.2",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/604.1 (KHTML, like Gecko) Version/11.0 Safari/604.1 Ubuntu/17.04 (3.24.1-0ubuntu1) Epiphany/3.24.1",
- "Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20100101 Firefox/16.0",
- "Mozilla/5.0 (X11; U; Linux i686; rv:19.0) Gecko/20100101 Slackware/13 Firefox/19.0",
- "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0",
- "Mozilla/5.0 (X11; Linux i686; rv:20.0) Gecko/20100101 Firefox/20.0",
- "Mozilla/5.0 (X11; Linux i686; rv:25.0) Gecko/20100101 Firefox/25.0",
- "Mozilla/5.0 (X11; Linux i686; rv:28.0) Gecko/20100101 Firefox/28.0",
- "Mozilla/5.0 (X11; Linux i686; rv:32.0) Gecko/20100101 Firefox/32.0",
- "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0",
- "Mozilla/5.0 (X11; CentOS; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0",
- "Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0",
- "Mozilla/5.0 (X11; Linux i686; rv:40.0) Gecko/20100101 Firefox/40.0",
- "Mozilla/5.0 (X11; Linux i686; rv:43.0) Gecko/20100101 Firefox/43.0",
- "Mozilla/5.0 (X11; Linux i686; rv:46.0) Gecko/20100101 Firefox/46.0",
- "Mozilla/5.0 (X11; Linux i686; rv:49.0) Gecko/20100101 Firefox/49.0",
- "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0",
- "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0",
- "Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0",
- "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0",
- "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) Gecko Galeon/2.0.6 (Ubuntu 2.0.6-2)",
- "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.16) Gecko/20080716 (Gentoo) Galeon/2.0.6",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.13) Gecko/20100916 Iceape/2.0.8",
- "Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0 Iceweasel/19.0.2",
- "Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.2.1",
- "Mozilla/5.0 (compatible; Konqueror/4.2; Linux) KHTML/4.2.4 (like Gecko) Slackware/13.0",
- "Mozilla/5.0 (compatible; Konqueror/4.3; Linux) KHTML/4.3.1 (like Gecko) Fedora/4.3.1-3.fc11",
- "Mozilla/5.0 (compatible; Konqueror/4.4; Linux) KHTML/4.4.1 (like Gecko) Fedora/4.4.1-1.fc12",
- "Mozilla/5.0 (compatible; Konqueror/4.4; Linux 2.6.32-22-generic; X11; en_US) KHTML/4.4.3 (like Gecko) Kubuntu",
- "Mozilla/5.0 (compatible; Konqueror/4.4; Linux 2.6.32-22-generic; X11; en_US) KHTML/4.4.3 (like Gecko) Kubuntu",
- "Mozilla/5.0 (X11; Linux 3.8-6.dmz.1-liquorix-686) KHTML/4.8.4 (like Gecko) Konqueror/4.8",
- "Mozilla/5.0 (X11; Linux) KHTML/4.9.1 (like Gecko) Konqueror/4.9",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.21 (KHTML, like Gecko) konqueror/4.14.10 Safari/537.21",
- "Midori/0.1.10 (X11; Linux i686; U; en-us) WebKit/(531).(2)",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.3) Gecko/2008092814 (Debian-3.0.1-1)",
- "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a3pre) Gecko/20070330",
- "Opera/9.80 (X11; Linux i686) Presto/2.12.388 Version/12.16",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.166 Safari/537.36 OPR/20.0.1396.73172",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.166 Safari/537.36 OPR/20.0.1396.73172",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36 OPR/32.0.1948.25",
- "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.101 Safari/537.36 OPR/40.0.2308.62",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36 Puffin/4.8.0.2965AT",
- "Mozilla/5.0 (X11; Linux i686) AppleWebKit/538.1 (KHTML, like Gecko) QupZilla/1.8.6 Safari/538.1",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) QupZilla/1.9.0 Safari/538.1",
- "Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1",
- "Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120502 Firefox/12.0 SeaMonkey/2.9.1",
- "Mozilla/5.0 (Windows NT 5.1; rv:38.0) Gecko/20100101 Firefox/38.0 SeaMonkey/2.35",
- "Mozilla/5.0 (X11; Linux i686; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46",
- "Mozilla/5.0 (X11; U; Linux x86_64; us; rv:1.9.1.19) Gecko/20110430 shadowfox/7.0 (like Firefox/7.0",
- "Mozilla/5.0 (X11; U; Linux i686; it; rv:1.9.2.3) Gecko/20100406 Firefox/3.6.3 (Swiftfox)",
- "Uzbl (Webkit 1.3) (Linux i686 [i686])",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36 Vivaldi/1.0.344.37",
- "ELinks (0.4.3; NetBSD 3.0.2PATCH sparc64; 141x19)",
- "Links (2.1pre15; FreeBSD 5.3-RELEASE i386; 196x84)",
- "Lynx/2.8.7dev.4 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.8d",
- "w3m/0.5.1",
- "Mozilla/5.0 (X11; U; FreeBSD i386; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.207.0 Safari/532.0",
- "Mozilla/5.0 (X11; U; OpenBSD i386; en-US) AppleWebKit/533.3 (KHTML, like Gecko) Chrome/5.0.359.0 Safari/533.3",
- "Mozilla/5.0 (X11; U; FreeBSD x86_64; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16",
- "Mozilla/5.0 (X11; U; SunOS sun4m; en-US; rv:1.4b) Gecko/20030517 Mozilla Firebird/0.6",
- "Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.1b3) Gecko/20090429 Firefox/3.1b3",
- "Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.9.1) Gecko/20090702 Firefox/3.5",
- "Mozilla/5.0 (X11; U; FreeBSD i386; de-CH; rv:1.9.2.8) Gecko/20100729 Firefox/3.6.8",
- "Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20100101 Firefox/5.0",
- "Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6) Gecko/20040406 Galeon/1.3.15",
- "Mozilla/5.0 (compatible; Konqueror/3.5; NetBSD 4.0_RC3; X11) KHTML/3.5.7 (like Gecko)",
- "Mozilla/5.0 (compatible; Konqueror/3.5; SunOS) KHTML/3.5.1 (like Gecko)",
- "Mozilla/5.0 (X11; U; FreeBSD; i386; en-US; rv:1.7) Gecko",
- "Mozilla/4.77 [en] (X11; I; IRIX;64 6.5 IP30)",
- "Mozilla/4.8 [en] (X11; U; SunOS; 5.7 sun4u)",
- "Mozilla/5.0 (Unknown; U; UNIX BSD/SYSV system; C -) AppleWebKit/527 (KHTML, like Gecko, Safari/419.3) Arora/0.10.2",
- "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/536.5 (KHTML like Gecko) Chrome/19.0.1084.56 Safari/536.5",
- "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.4 (KHTML like Gecko) Chrome/22.0.1229.79 Safari/537.4",
- "Mozilla/5.0 (X11; NetBSD) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36",
- "Mozilla/5.0 (X11; OpenBSD i386) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36",
- "Mozilla/5.0 (X11; NetBSD x86; en-us) AppleWebKit/666.6+ (KHTML, like Gecko) Chromium/20.0.0000.00 Chrome/20.0.0000.00 Safari/666.6+",
- "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/535.22+ (KHTML, like Gecko) Chromium/17.0.963.56 Chrome/17.0.963.56 Safari/535.22+ Epiphany/2.30.6",
- "Mozilla/5.0 (X11; U; OpenBSD arm; en-us) AppleWebKit/531.2 (KHTML, like Gecko) Safari/531.2 Epiphany/2.30.0",
- "Mozilla/5.0 (X11; NetBSD amd64; rv:16.0) Gecko/20121102 Firefox/16.0",
- "Mozilla/5.0 (X11; OpenBSD amd64; rv:28.0) Gecko/20100101 Firefox/28.0",
- "Mozilla/5.0 (X11; NetBSD amd64; rv:30.0) Gecko/20100101 Firefox/30.0",
- "Mozilla/5.0 (X11; OpenBSD amd64; rv:30.0) Gecko/20100101 Firefox/30.0",
- "Mozilla/5.0 (X11; FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36",
- "Mozilla/5.0 (X11; FreeBSD amd64; rv:54.0) Gecko/20100101 Firefox/54.0",
- "Mozilla/5.0 (compatible; Konqueror/4.1; DragonFly) KHTML/4.1.4 (like Gecko)",
- "Mozilla/5.0 (compatible; Konqueror/4.1; OpenBSD) KHTML/4.1.4 (like Gecko)",
- "Mozilla/5.0 (compatible; Konqueror/4.5; NetBSD 5.0.2; X11; amd64; en_US) KHTML/4.5.4 (like Gecko)",
- "Mozilla/5.0 (compatible; Konqueror/4.5; FreeBSD) KHTML/4.5.4 (like Gecko)",
- "Mozilla/5.0 (X11; U; NetBSD amd64; en-US; rv:1.9.2.15) Gecko/20110308 Namoroka/3.6.15",
- "NetSurf/1.2 (NetBSD; amd64)",
- "Opera/9.80 (X11; FreeBSD 8.1-RELEASE i386; Edition Next) Presto/2.12.388 Version/12.10",
- "Mozilla/5.0 (Unknown; UNIX BSD/SYSV system) AppleWebKit/538.1 (KHTML, like Gecko) QupZilla/1.7.0 Safari/538.1",
- "Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.8.1.12) Gecko/20080303 SeaMonkey/1.1.8",
- "Mozilla/5.0 (X11; FreeBSD i386; rv:28.0) Gecko/20100101 Firefox/28.0 SeaMonkey/2.25",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; BOLT/2.800) AppleWebKit/534.6 (KHTML, like Gecko) Version/5.0 Safari/534.6.3",
- "Mozilla/5.0 (Linux; Android 4.4.2; SAMSUNG-SM-T537A Build/KOT49H) AppleWebKit/537.36 (KHTML like Gecko) Chrome/35.0.1916.141 Safari/537.36",
- "Mozilla/5.0 (Linux; Android 8.0.0; Pixel XL Build/OPR6.170623.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.107 Mobile Safari/537.36",
- "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Mobile Safari/537.36 Edge/12.0",
- "Mozilla/5.0 (Android; Mobile; rv:35.0) Gecko/35.0 Firefox/35.0",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 6.12; Microsoft ZuneHD 4.3)",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11)",
- "Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0) Asus;Galaxy6",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)",
- "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch)",
- "Mozilla/1.22 (compatible; MSIE 5.01; PalmOS 3.0) EudoraWeb 2.1",
- "Mozilla/5.0 (WindowsCE 6.0; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
- "Mozilla/5.0 (X11; U; Linux armv61; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1",
- "Mozilla/5.0 (Maemo; Linux armv7l; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1",
- "Mozilla/5.0 (Maemo; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1",
- "Mozilla/5.0 (Android 6.0.1; Mobile; rv:48.0) Gecko/48.0 Firefox/48.0",
- "Mozilla/5.0 (Windows; U; Windows CE 5.1; rv:1.8.1a3) Gecko/20060610 Minimo/0.016",
- "Mozilla/5.0 (X11; U; Linux armv6l; rv 1.8.1.5pre) Gecko/20070619 Minimo/0.020",
- "Mozilla/5.0 (X11; U; Linux arm7tdmi; rv:1.8.1.11) Gecko/20071130 Minimo/0.025",
- "Mozilla/4.0 (PDA; PalmOS/sony/model prmr/Revision:1.1.54 (en)) NetFront/3.0",
- "Opera/9.51 Beta (Microsoft Windows; PPC; Opera Mobi/1718; U; en)",
- "Opera/9.60 (J2ME/MIDP; Opera Mini/4.1.11320/608; U; en) Presto/2.2.0",
- "Opera/9.60 (J2ME/MIDP; Opera Mini/4.2.14320/554; U; cs) Presto/2.2.0",
- "Opera/9.80 (S60; SymbOS; Opera Mobi/499; U; ru) Presto/2.4.18 Version/10.00",
- "Opera/10.61 (J2ME/MIDP; Opera Mini/5.1.21219/19.999; en-US; rv:1.9.3a5) WebKit/534.5 Presto/2.6.30",
- "Opera/9.80 (Android; Opera Mini/7.5.33361/31.1543; U; en) Presto/2.8.119 Version/11.1010",
- "Opera/9.80 (J2ME/MIDP; Opera Mini/8.0.35626/37.8918; U; en) Presto/2.12.423 Version/12.16",
- "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 7 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.78 Safari/537.36 OPR/30.0.1856.93524",
- "Opera/9.80 (Android; Opera Mini/9.0.1829/66.318; U; en) Presto/2.12.423 Version/12.16",
- "Opera/9.80 (Linux i686; Opera Mobi/1040; U; en) Presto/2.5.24 Version/10.00",
- "POLARIS/6.01 (BREW 3.1.5; U; en-us; LG; LX265; POLARIS/6.01/WAP) MMP/2.0 profile/MIDP-2.1 Configuration/CLDC-1.1",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-gb) AppleWebKit/534.35 (KHTML, like Gecko) Chrome/11.0.696.65 Safari/534.35 Puffin/2.9174AP",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/534.35 (KHTML, like Gecko) Chrome/11.0.696.65 Safari/534.35 Puffin/2.9174AT",
- "Mozilla/5.0 (iPod; U; CPU iPhone OS 6_1 like Mac OS X; en-HK) AppleWebKit/534.35 (KHTML, like Gecko) Chrome/11.0.696.65 Safari/534.35 Puffin/3.9174IP Mobile",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-AU) AppleWebKit/534.35 (KHTML, like Gecko) Chrome/11.0.696.65 Safari/534.35 Puffin/3.9174IT",
- "Mozilla/5.0 (X11; U; Linux i686; en-gb) AppleWebKit/534.35 (KHTML, like Gecko) Chrome/11.0.696.65 Safari/534.35 Puffin/2.0.5603M",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36 Puffin/4.5.0IT",
- "Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17",
- "Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5",
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; da-dk) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5",
- "Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; XBLWP7; ZuneWP7) UCBrowser/2.9.0.263",
- "Mozilla/5.0 (Linux; U; Android 2.3.3; en-us ; LS670 Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1/UCBrowser/8.6.1.262/145/355",
- "Mozilla/5.0 (Linux; U; Android 3.0.1; fr-fr; A500 Build/HRI66) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13",
- "Mozilla/5.0 (Linux; U; Android 4.1; en-us; sdk Build/MR1) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.1 Safari/534.30",
- "Mozilla/5.0 (Linux; U; Android 4.2; en-us; sdk Build/MR1) AppleWebKit/535.19 (KHTML, like Gecko) Version/4.2 Safari/535.19",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/534.35 (KHTML, like Gecko) Chrome/11.0.696.65 Safari/534.35 Puffin/2.9174AT",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-AU) AppleWebKit/534.35 (KHTML, like Gecko) Chrome/11.0.696.65 Safari/534.35 Puffin/3.9174IT",
- "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10",
- "Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5",
- "Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F190 Safari/6533.18.5",
- "Mozilla/5.0 (iPad; CPU OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko ) Version/5.1 Mobile/9B176 Safari/7534.48.3",
- "Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25",
- "Mozilla/5.0 (iPad; CPU OS 8_0_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML like Gecko) Mobile/12A405 Version/7.0 Safari/9537.53",
- "Mozilla/5.0 (iPad; CPU OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H321 Safari/600.1.4",
- "Mozilla/5.0 (iPad; CPU OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13F69 Safari/601.1",
- "Mozilla/5.0 (iPad; CPU OS 10_0 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/49.0.2623.109 Mobile/14A5335b Safari/601.1.46",
- "Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5362a Safari/604.1",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36 Puffin/4.5.0IT",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7;en-us) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17",
- "Mozilla/5.0 (hp-tablet; Linux; hpwOS/3.0.2; U; de-DE) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/234.40.1 Safari/534.6 TouchPad/1.0",
- "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.1 Mobile Safari/535.19 Silk-Accelerated=true",
- "Mozilla/5.0 (Linux; Android 4.4.2; LG-V410 Build/KOT49I.V41010d) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.103 Safari/537.36",
- "Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/525.10 (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2",
- "Mozilla/5.0 (Linux; Android 4.0.4; BNTV400 Build/IMM76L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.111 Safari/537.36",
- "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+",
- "Mozilla/5.0 (Linux; U; Android 1.5; de-de; Galaxy Build/CUPCAKE) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "Mozilla/5.0 (Linux; U; Android 2.2; en-ca; GT-P1000M Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
- "Mozilla/5.0 (Linux; U; Android 2.2; en-us; SCH-I800 Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
- "Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; GT-P5210 Build/KOT49H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30",
- "Mozilla/5.0 (Linux; U; Android 3.0.1; en-us; GT-P7100 Build/HRI83) AppleWebkit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13",
- "Mozilla/5.0 (Linux; Android 5.0.2; SAMSUNG SM-T530NU Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.2 Chrome/38.0.2125.102 Safari/537.36",
- "Mozilla/5.0 (Linux; U; Android 3.0.1; fr-fr; A500 Build/HRI66) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13",
- "Mozilla/4.0 (compatible; Linux 2.6.22) NetFront/3.4 Kindle/2.0 (screen 600x800)",
- "Mozilla/5.0 (Linux U; en-US) AppleWebKit/528.5 (KHTML, like Gecko, Safari/528.5 ) Version/4.0 Kindle/3.0 (screen 600x800; rotate)",
- "Mozilla/5.0 (X11; U; Linux armv7l like Android; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/533.2+ Kindle/3.0+",
- "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.1 Mobile Safari/535.19 Silk-Accelerated=true",
- "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10",
- "Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5",
- "Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F190 Safari/6533.18.5",
- "Mozilla/5.0 (iPad; U; CPU iPad OS 5_0_1 like Mac OS X; en-us) AppleWebKit/535.1+ (KHTML like Gecko) Version/7.2.0.0 Safari/6533.18.5",
- "Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25",
- "Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) CriOS/30.0.1599.12 Mobile/11A465 Safari/8536.25 (3B92C18B-D9DE-4CB7-A02A-22FD2AF17C8F)",
- "Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53",
- "Mozilla/5.0 (iPad; CPU OS 8_0_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML like Gecko) Mobile/12A405 Version/7.0 Safari/9537.53",
- "Mozilla/5.0 (iPad; CPU OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H321 Safari/600.1.4",
- "Mozilla/5.0 (iPad; CPU OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13F69 Safari/601.1",
- "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36 Puffin/4.5.0IT",
- "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420 (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3",
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_0 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5A347 Safari/525.200",
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16",
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/531.22.7",
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; da-dk) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5",
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; da-dk) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25",
- "UCWEB/8.8 (iPhone; CPU OS_6; en-US)AppleWebKit/534.1 U3/3.0.0 Mobile",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12F70 Safari/600.1.4",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) GSA/8.0.57838 Mobile/12H321 Safari/600.1.4",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14A346 Safari/602.1",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) GSA/18.0.130791545 Mobile/14A5345a Safari/600.1.4",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5362a Safari/604.1",
- "Mozilla/5.0 (iPod; U; CPU iPhone OS 2_2_1 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5H11a Safari/525.20",
- "Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1_1 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7C145",
- "Mozilla/5.0 (iPod touch; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML like Gecko) Version/7.0 Mobile/11D167 Safari/123E71C",
- "Mozilla/5.0 (iPod; CPU iPhone OS 8_4 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) CriOS/44.0.2403.67 Mobile/12H143 Safari/600.1.4",
- "nook browser/1.0",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7;en-us) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17",
- "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; BNTV250 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Safari/533.1",
- "Mozilla/5.0 (Linux; Android 4.0.4; BNTV400 Build/IMM76L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.111 Safari/537.36",
- "BlackBerry7100i/4.1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/103",
- "BlackBerry8300/4.2.2 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/107 UP.Link/6.2.3.15.0",
- "BlackBerry8320/4.2.2 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/100",
- "BlackBerry8330/4.3.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/105",
- "BlackBerry9000/4.6.0.167 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102",
- "BlackBerry9530/4.7.0.167 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102 UP.Link/6.3.1.20.0",
- "BlackBerry9700/5.0.0.351 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/123",
- "Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en) AppleWebKit/534.1 (KHTML, Like Gecko) Version/6.0.0.141 Mobile Safari/534.1",
- "Mozilla/5.0 (BlackBerry; U; BlackBerry 9930; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.267 Mobile Safari/534.11+",
- "Mozilla/5.0 (Linux; Android 7.1.1; BBB100-1 Build/NMF26F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537.36",
- "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/7.2.1.0 Safari/536.2+",
- "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.1.0.2342 Mobile Safari/537.10+",
- "Mozilla/5.0 (Linux; Android 5.1.1; Coolpad 3622A Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 7.1.1; Coolpad 3632A Build/NMF26F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; U; Android 1.5; en-us; sdk Build/CUPCAKE) AppleWebkit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "Mozilla/5.0 (Linux; U; Android 2.1; en-us; Nexus One Build/ERD62) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17",
- "Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
- "Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/BuildID) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 6.0; Nexus 5X Build/MDB08L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.124 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 7.1.2; Nexus 6P Build/N2G48C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.107 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 4.4.4; Nexus 7 Build/KTU84P) AppleWebKit/537.36 (KHTML like Gecko) Chrome/36.0.1985.135 Safari/537.36",
- "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 7 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.78 Safari/537.36 OPR/30.0.1856.93524",
- "Mozilla/5.0 (Linux; Android 7.0; Nexus 9 Build/NRD90R) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.124 Safari/537.36",
- "Mozilla/5.0 (Linux; Android 7.1.2; Pixel Build/NHG47N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 8.0.0; Pixel XL Build/OPR6.170623.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.107 Mobile Safari/537.36",
- "Mozilla/5.0 (hp-tablet; Linux; hpwOS/3.0.2; U; de-DE) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/234.40.1 Safari/534.6 TouchPad/1.0",
- "Mozilla/5.0 (Linux; webOS/2.2.4; U; en-US) AppleWebKit/534.6 (KHTML, like Gecko) webOSBrowser/221.56 Safari/534.6 Pre/3.0",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11) Sprint:PPC6800",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11) XV6800",
- "Mozilla/5.0 (Linux; U; Android 1.5; en-us; htc_bahamas Build/CRB17) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "Mozilla/5.0 (Linux; U; Android 2.1-update1; de-de; HTC Desire 1.19.161.5 Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17",
- "HTC_Dream Mozilla/5.0 (Linux; U; Android 1.5; en-ca; Build/CUPCAKE) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "Mozilla/5.0 (Linux; U; Android 2.2; en-us; Sprint APA9292KT Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
- "Mozilla/5.0 (Linux; U; Android 1.5; de-ch; HTC Hero Build/CUPCAKE) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "Mozilla/5.0 (Linux; U; Android 2.2; en-us; ADR6300 Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
- "Mozilla/5.0 (Linux; U; Android 2.1; en-us; HTC Legend Build/cupcake) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17",
- "Mozilla/5.0 (Linux; U; Android 1.5; de-de; HTC Magic Build/PLAT-RC33) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1 FirePHP/0.3",
- "Mozilla/5.0 (Linux; Android 6.0; HTC One M9 Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
- "HTC-ST7377/1.59.502.3 (67150) Opera/9.50 (Windows NT 5.1; U; en) UP.Link/6.3.1.17.0",
- "Mozilla/5.0 (Linux; U; Android 1.6; en-us; HTC_TATTOO_A3288 Build/DRC79) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "Mozilla/5.0 (Linux; Android 6.0; ALE-L21 Build/HuaweiALE-L21) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.89 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 5.1; C6740N Build/LMY47O) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.111 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; LG-P870/P87020d Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
- "LG-LX550 AU-MIC-LX550/2.0 MMP/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "Mozilla/5.0 (Linux; Android 6.0; LG-D850 Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.97 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 7.0; LG-H918 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 7.0; LGL84VL Build/NRD90U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 7.0; LGUS997 Build/NRD90U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 4.4.2; LGMS323 Build/KOT49I.MS32310b) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.103 Mobile Safari/537.36",
- "POLARIS/6.01(BREW 3.1.5;U;en-us;LG;LX265;POLARIS/6.01/WAP;)MMP/2.0 profile/MIDP-201 Configuration /CLDC-1.1",
- "LG-GC900/V10a Obigo/WAP2.0 Profile/MIDP-2.1 Configuration/CLDC-1.1",
- "Mozilla/5.0 (Linux; Android 4.4.2; LG-V410 Build/KOT49I.V41010d) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.103 Safari/537.36",
- "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; MDA Pro/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1)",
- "Mozilla/5.0 (Linux; U; Android 1.0; en-us; dream) AppleWebKit/525.10 (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2",
- "Mozilla/5.0 (Linux; U; Android 1.5; en-us; T-Mobile G1 Build/CRB43) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari 525.20.1",
- "Mozilla/5.0 (Linux; U; Android 1.5; en-gb; T-Mobile_G2_Touch Build/CUPCAKE) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17",
- "Mozilla/5.0 (Linux; U; Android 2.2; en-us; Droid Build/FRG22D) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
- "MOT-L7v/08.B7.5DR MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.3.0.0.0",
- "Mozilla/5.0 (Linux; U; Android 2.0; en-us; Milestone Build/ SHOLS_U2_01.03.1) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17",
- "Mozilla/5.0 (Linux; U; Android 2.0.1; de-de; Milestone Build/SHOLS_U2_01.14.0) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17",
- "Mozilla/5.0 (Linux; Android 7.0; Moto G (5) Plus Build/NPNS25.137-35-5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.107 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 7.1.1; XT1710-02 Build/NDS26.74-36) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537.36",
- "MOT-V9mm/00.62 UP.Browser/6.2.3.4.c.1.123 (GUI) MMP/2.0",
- "MOTORIZR-Z8/46.00.00 Mozilla/4.0 (compatible; MSIE 6.0; Symbian OS; 356) Opera 8.65 [it] UP.Link/6.3.0.0.0",
- "MOT-V177/0.1.75 UP.Browser/6.2.3.9.c.12 (GUI) MMP/2.0 UP.Link/6.3.1.13.0",
- "Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/525.10 (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2",
- "Mozilla/5.0 (Linux; Android 4.4.4; XT1032 Build/KXB21.14-L1.61) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.94 Mobile Safari/537.36",
- "portalmmm/2.0 N410i(c20;TB)",
- "Nokia3230/2.0 (5.0614.0) SymbianOS/7.0s Series60/2.1 Profile/MIDP-2.0 Configuration/CLDC-1.0",
- "Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 Nokia5700/3.27; Profile/MIDP-2.0 Configuration/CLDC-1.1) AppleWebKit/413 (KHTML, like Gecko) Safari/413",
- "Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 Nokia6120c/3.70; Profile/MIDP-2.0 Configuration/CLDC-1.1) AppleWebKit/413 (KHTML, like Gecko) Safari/413",
- "Nokia6230/2.0 (04.44) Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "Nokia6230i/2.0 (03.80) Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "Mozilla/4.1 (compatible; MSIE 5.0; Symbian OS; Nokia 6600;452) Opera 6.20 [en-US]",
- "Nokia6630/1.0 (2.39.15) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "Nokia7250/1.0 (3.14) Profile/MIDP-1.0 Configuration/CLDC-1.0",
- "Mozilla/4.0 (compatible; MSIE 5.0; Series80/2.0 Nokia9500/4.51 Profile/MIDP-2.0 Configuration/CLDC-1.1)",
- "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaC6-01/011.010; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.7.2 3gpp-gba",
- "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaC7-00/012.003; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.7.3 3gpp-gba",
- "Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413 es50",
- "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaE6-00/021.002; Profile/MIDP-2.1 Configuration/CLDC-1.1) AppleWebKit/533.4 (KHTML, like Gecko) NokiaBrowser/7.3.1.16 Mobile Safari/533.4 3gpp-gba",
- "UCWEB/8.8 (SymbianOS/9.2; U; en-US; NokiaE63) AppleWebKit/534.1 UCBrowser/8.8.0.245 Mobile",
- "Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413 es65",
- "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaE7-00/010.016; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.7.3 3gpp-gba",
- "Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413 es70",
- "Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE90-1/07.24.0.3; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413 UP.Link/6.2.3.18.0",
- "Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 530) like Gecko",
- "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)",
- "Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 630) like Gecko",
- "Mozilla/5.0 (Windows NT 6.2; ARM; Trident/7.0; Touch; rv:11.0; WPDesktop; NOKIA; Lumia 635) like Gecko",
- "Mozilla/5.0 (Windows NT 6.2; ARM; Trident/7.0; Touch; rv:11.0; WPDesktop; NOKIA; Lumia 920) like Geckoo",
- "Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 920) like Gecko",
- "NokiaN70-1/5.0609.2.0.1 Series60/2.8 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.3.1.13.0",
- "Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413",
- "NokiaN73-1/3.0649.0.0.1 Series60/3.0 Profile/MIDP2.0 Configuration/CLDC-1.1",
- "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaN8-00/014.002; Profile/MIDP-2.1 Configuration/CLDC-1.1; en-us) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.6.4 3gpp-gba",
- "Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413",
- "Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",
- "Mozilla/5.0 (SymbianOS/9.1; U; de) AppleWebKit/413 (KHTML, like Gecko) Safari/413",
- "Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95/10.0.018; Profile/MIDP-2.0 Configuration/CLDC-1.1) AppleWebKit/413 (KHTML, like Gecko) Safari/413 UP.Link/6.3.0.0.0",
- "Mozilla/5.0 (MeeGo; NokiaN950-00/00) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",
- "Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 NokiaN97-1/10.0.012; Profile/MIDP-2.1 Configuration/CLDC-1.1; en-us) AppleWebKit/525 (KHTML, like Gecko) WicKed/7.1.12344",
- "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaX7-00/021.004; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/533.4 (KHTML, like Gecko) NokiaBrowser/7.3.1.21 Mobile Safari/533.4 3gpp-gba",
- "Mozilla/5.0 (webOS/1.3; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Desktop/1.0",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; PalmSource/hspr-H102; Blazer/4.0) 16;320x320",
- "SEC-SGHE900/1.0 NetFront/3.2 Profile/MIDP-2.0 Configuration/CLDC-1.1 Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1378; nl; U; ssr)",
- "Mozilla/5.0 (Linux; U; Android 1.5; de-de; Galaxy Build/CUPCAKE) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "Mozilla/5.0 (Linux; U; Android 2.2; en-ca; GT-P1000M Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
- "Mozilla/5.0 (Linux; U; Android 2.2; en-us; SCH-I800 Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
- "Mozilla/5.0 (Linux; U; Android 4.0.3; de-de; Galaxy S II Build/GRJ22) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
- "Mozilla/5.0 (Linux; Android 4.3; SPH-L710 Build/JSS15J) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.99 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 5.0.1; SCH-R970 Build/LRX22C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.84 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 4.4.2; SAMSUNG-SM-G900A Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.94 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; GT-P5210 Build/KOT49H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30",
- "Mozilla/5.0 (Linux; U; Android 3.0.1; en-us; GT-P7100 Build/HRI83) AppleWebkit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13",
- "SAMSUNG-S8000/S8000XXIF3 SHP/VPP/R5 Jasmine/1.0 Nextreaming SMM-MMS/1.2.0 profile/MIDP-2.1 configuration/CLDC-1.1 FirePHP/0.3",
- "Mozilla/5.0 (Linux; U; Android 1.5; en-us; SPH-M900 Build/CUPCAKE) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "SAMSUNG-SGH-A867/A867UCHJ3 SHP/VPP/R5 NetFront/35 SMM-MMS/1.2.0 profile/MIDP-2.0 configuration/CLDC-1.1 UP.Link/6.3.0.0.0",
- "SEC-SGHX210/1.0 UP.Link/6.3.1.13.0",
- "Mozilla/5.0 (Linux; Android 6.0.1; SM-G900H Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-G925R6 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/5.4 Chrome/51.0.2704.106 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 4.4.2; SAMSUNG-SM-T537A Build/KOT49H) AppleWebKit/537.36 (KHTML like Gecko) Chrome/35.0.1916.141 Safari/537.36",
- "Mozilla/5.0 (Linux; U; Android 1.5; fr-fr; GT-I5700 Build/CUPCAKE) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "SEC-SGHX820/1.0 NetFront/3.2 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "SonyEricssonK310iv/R4DA Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.3.1.13.0",
- "SonyEricssonK550i/R1JD Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "SonyEricssonK610i/R1CB Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "SonyEricssonK750i/R1CA Browser/SEMC-Browser/4.2 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "Opera/9.80 (J2ME/MIDP; Opera Mini/5.0.16823/1428; U; en) Presto/2.2.0",
- "SonyEricssonK800i/R1CB Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.3.0.0.0",
- "SonyEricssonK810i/R1KG Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "Opera/8.01 (J2ME/MIDP; Opera Mini/1.0.1479/HiFi; SonyEricsson P900; no; U; ssr)",
- "SonyEricssonS500i/R6BC Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0 SonyEricssonP100/01; Profile/MIDP-2.1 Configuration/CLDC-1.1) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 Safari/525",
- "SonyEricssonT68/R201A",
- "SonyEricssonT100/R101",
- "SonyEricssonT610/R201 Profile/MIDP-1.0 Configuration/CLDC-1.0",
- "SonyEricssonT650i/R7AA Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "SonyEricssonW580i/R6BC Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "SonyEricssonW660i/R6AD Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "SonyEricssonW810i/R4EA Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.3.0.0.0",
- "SonyEricssonW850i/R1ED Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "SonyEricssonW950i/R100 Mozilla/4.0 (compatible; MSIE 6.0; Symbian OS; 323) Opera 8.60 [en-US]",
- "SonyEricssonW995/R1EA Profile/MIDP-2.1 Configuration/CLDC-1.1 UNTRUSTED/1.0",
- "Mozilla/5.0 (Linux; U; Android 1.6; es-es; SonyEricssonX10i Build/R1FA016) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "Mozilla/5.0 (Linux; U; Android 1.6; en-us; SonyEricssonX10i Build/R1AA056) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "Opera/9.5 (Microsoft Windows; PPC; Opera Mobi; U) SonyEricssonX1i/R2AA Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "SonyEricssonZ800/R1Y Browser/SEMC-Browser/4.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Link/6.3.0.0.0",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 6.12; Microsoft ZuneHD 4.3)",
- "Opera/9.80 (Android; Opera Mini/7.5.33361/31.1543; U; en) Presto/2.8.119 Version/11.1010",
- "Mozilla/5.0 (Android; Mobile; rv:35.0) Gecko/35.0 Firefox/35.0",
- "Mozilla/5.0 (Android 6.0.1; Mobile; rv:48.0) Gecko/48.0 Firefox/48.0",
- "Mozilla/5.0 (Linux; U; Android 0.5; en-us) AppleWebKit/522 (KHTML, like Gecko) Safari/419.3",
- "Mozilla/5.0 (Linux; U; Android 1.1; en-gb; dream) AppleWebKit/525.10 (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2",
- "HTC_Dream Mozilla/5.0 (Linux; U; Android 1.5; en-ca; Build/CUPCAKE) AppleWebKit/528.5 (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- "Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17",
- "Mozilla/5.0 (Linux; U; Android 2.1; en-us; Nexus One Build/ERD62) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17",
- "Mozilla/5.0 (Linux; U; Android 2.2; en-us; Sprint APA9292KT Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
- "Mozilla/5.0 (Linux; U; Android 2.2; en-us; ADR6300 Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
- "Mozilla/5.0 (Linux; U; Android 2.2; en-ca; GT-P1000M Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
- "Mozilla/5.0 (Android; Linux armv7l; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1",
- "Mozilla/5.0 (Linux; U; Android 3.0.1; fr-fr; A500 Build/HRI66) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13",
- "Mozilla/5.0 (Linux; U; Android 3.0; en-us; Xoom Build/HRI39) AppleWebKit/525.10 (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2",
- "Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
- "Mozilla/5.0 (Linux; U; Android 4.0.3; de-de; Galaxy S II Build/GRJ22) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30",
- "Opera/9.80 (Android 4.0.4; Linux; Opera Mobi/ADR-1205181138; U; pl) Presto/2.10.254 Version/12.00",
- "Mozilla/5.0 (Android; Linux armv7l; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 Fennec/10.0.1",
- "Mozilla/5.0 (Linux; Android 4.1.2; SHV-E250S Build/JZO54K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.82 Mobile Safari/537.36",
- "Mozilla/5.0 (Android 4.2; rv:19.0) Gecko/20121129 Firefox/19.0",
- "Mozilla/5.0 (Linux; U; Android 4.3; en-us; sdk Build/MR1) AppleWebKit/536.23 (KHTML, like Gecko) Version/4.3 Mobile Safari/536.23",
- "Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/BuildID) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 4.4.2; SAMSUNG-SM-T537A Build/KOT49H) AppleWebKit/537.36 (KHTML like Gecko) Chrome/35.0.1916.141 Safari/537.36",
- "Mozilla/5.0 (Linux; Android 4.4.2; SM-T230NU Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Safari/537.36",
- "Mozilla/5.0 (Linux; Android 5.0.1; SCH-R970 Build/LRX22C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.84 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 5.0.2; SAMSUNG SM-T530NU Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.2 Chrome/38.0.2125.102 Safari/537.36",
- "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 7 Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.78 Safari/537.36 OPR/30.0.1856.93524",
- "Mozilla/5.0 (Linux; Android 6.0; HTC One M9 Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 6.0; LG-D850 Build/MRA58K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.97 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 6.0; Nexus 5X Build/MDB08L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.124 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 6.0.1; SM-G900H Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 7.0; Nexus 9 Build/NRD90R) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.124 Safari/537.36",
- "Mozilla/5.0 (Linux; Android 7.0; LG-H918 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 8.0.0; Pixel XL Build/OPR6.170623.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.107 Mobile Safari/537.36",
- "Mozilla/5.0 (Linux; Android 8.0.0; Pixel XL Build/OPR6.170623.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.107 Mobile Safari/537.36",
- "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420 (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3",
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_0 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5A347 Safari/525.200",
- "Mozilla/5.0 (iPod; U; CPU iPhone OS 2_2_1 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5H11a Safari/525.20",
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16",
- "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10",
- "Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5",
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_2_1 like Mac OS X; da-dk) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5",
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3 like Mac OS X; de-de) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8F190",
- "MobileSafari/600.1.4 CFNetwork/711.1.12 Darwin/14.0.0",
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; da-dk) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1",
- "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5362a Safari/604.1",
- "Mozilla/5.0 (X11; Linux i686 on x86_64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1",
- "Mozilla/5.0 (Maemo; Linux armv7l; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 Fennec/2.0.1",
- "Mozilla/5.0 (webOS/1.3; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Desktop/1.0",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; PalmSource/hspr-H102; Blazer/4.0) 16;320x320",
- "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaN8-00/014.002; Profile/MIDP-2.1 Configuration/CLDC-1.1; en-us) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.6.4 3gpp-gba",
- "Mozilla/5.0 (Symbian/3; Series60/5.2 NokiaX7-00/021.004; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/533.4 (KHTML, like Gecko) NokiaBrowser/7.3.1.21 Mobile Safari/533.4 3gpp-gba",
- "Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE90-1/07.24.0.3; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413 UP.Link/6.2.3.18.0",
- "Mozilla/5.0 (SymbianOS 9.4; Series60/5.0 NokiaN97-1/10.0.012; Profile/MIDP-2.1 Configuration/CLDC-1.1; en-us) AppleWebKit/525 (KHTML, like Gecko) WicKed/7.1.12344",
- "Opera/9.80 (S60; SymbOS; Opera Mobi/499; U; ru) Presto/2.4.18 Version/10.00",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 6.12; Microsoft ZuneHD 4.3)",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11)",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11) Sprint:PPC6800",
- "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 8.12; MSIEMobile6.0)",
- "Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0) Asus;Galaxy6",
- "Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0)",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)",
- "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch)",
- "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)",
- "Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 530) like Gecko",
- "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)",
- "Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 630) like Gecko",
- "Mozilla/5.0 (Windows NT 6.2; ARM; Trident/7.0; Touch; rv:11.0; WPDesktop; NOKIA; Lumia 635) like Gecko",
- "Mozilla/5.0 (Windows NT 6.2; ARM; Trident/7.0; Touch; rv:11.0; WPDesktop; NOKIA; Lumia 920) like Geckoo",
- "Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 920) like Gecko",
- "Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 929) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537",
- "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Mobile Safari/537.36 Edge/12.0",
- "Mozilla/5.0 (Windows NT 10.0; ARM; Lumia 950 Dual SIM) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393",
- "DoCoMo/2.0 SH901iC(c100;TB;W24H12)",
- "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7 MG(Novarra-Vision/6.9)",
- "Mozilla/4.0 (compatible; MSIE 6.0; j2me) ReqwirelessWeb/3.5",
- "Vodafone/1.0/V802SE/SEJ001 Browser/SEMC-Browser/4.1",
- "BlackBerry7520/4.0.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/5.0.3.3 UP.Link/5.1.2.12 (Google WAP Proxy/1.0)",
- "Nokia6100/1.0 (04.01) Profile/MIDP-1.0 Configuration/CLDC-1.0",
- "Nokia6630/1.0 (2.3.129) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1",
- "Mozilla/2.0 (compatible; Ask Jeeves/Teoma)",
- "Baiduspider ( http://www.baidu.com/search/spider.htm)",
- "Mozilla/5.0 (compatible; bingbot/2.0 http://www.bing.com/bingbot.htm)",
- "Mozilla/5.0 (compatible; Exabot/3.0; http://www.exabot.com/go/robot)",
- "FAST-WebCrawler/3.8 (crawler at trd dot overture dot com; http://www.alltheweb.com/help/webmaster/crawler)",
- "AdsBot-Google ( http://www.google.com/adsbot.html)",
- "Mozilla/5.0 (compatible; Googlebot/2.1; http://www.google.com/bot.html)",
- "Googlebot/2.1 ( http://www.googlebot.com/bot.html)",
- "Googlebot-Image/1.0",
- "Mediapartners-Google",
- "DoCoMo/2.0 N905i(c100;TB;W24H16) (compatible; Googlebot-Mobile/2.1; http://www.google.com/bot.html)",
- "Mozilla/5.0 (iPhone; U; CPU iPhone OS) (compatible; Googlebot-Mobile/2.1; http://www.google.com/bot.html)",
- "SAMSUNG-SGH-E250/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 (compatible; Googlebot-Mobile/2.1; http://www.google.com/bot.html)",
- "Googlebot-News",
- "Googlebot-Video/1.0",
- "Mozilla/4.0 (compatible; GoogleToolbar 4.0.1019.5266-big; Windows XP 5.1; MSIE 6.0.2900.2180)",
- "Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13",
- "msnbot/1.0 ( http://search.msn.com/msnbot.htm)",
- "msnbot/1.1 ( http://search.msn.com/msnbot.htm)",
- "msnbot/0.11 ( http://search.msn.com/msnbot.htm)",
- "msnbot-media/1.1 ( http://search.msn.com/msnbot.htm)",
- "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)",
- "Mozilla/5.0 (compatible; Yahoo! Slurp China; http://misc.yahoo.com.cn/help.html)",
- "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)",
- "Mozilla/5.0 (compatible; YandexNews/4.0; +http://yandex.com/bots)",
- "Mozilla/5.0 (compatible; archive.org_bot +http://www.archive.org/details/archive.org_bot)",
- "Mozilla/5.0 (compatible; archive.org_bot; Wayback Machine Live Record; +http://archive.org/details/archive.org_bot)",
- "Mozilla/5.0 (compatible; alexa site audit/1.0; +http://www.alexa.com/help/webmasters; )",
- "EmailWolf 1.00",
- "facebookexternalhit/1.1",
- "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)",
- "Facebot",
- "Gaisbot/3.0 (robot@gais.cs.ccu.edu.tw; http://gais.cs.ccu.edu.tw/robot.php)",
- "grub-client-1.5.3; (grub-client-1.5.3; Crawl your own stuff with http://grub.org)",
- "Gulper Web Bot 0.2.4 (www.ecsl.cs.sunysb.edu/~maxim/cgi-bin/Link/GulperBot)",
- "Screaming Frog SEO Spider/8.1",
- "TurnitinBot (https://turnitin.com/robot/crawlerinfo.html)",
- "Twitterbot/1.0",
- "Xenu Link Sleuth/1.3.8",
- "Mozilla/3.0 (compatible; NetPositive/2.1.1; BeOS)",
- "Mozilla/5.0 (BeOS; U; BeOS BePC; en-US; rv:1.9a1) Gecko/20060702 SeaMonkey/1.5a",
- "Mozilla/5.0 (OS/2; U; OS/2; en-US) AppleWebKit/533.3 (KHTML, like Gecko) Arora/0.11.0 Safari/533.3",
- "Mozilla/5.0 (OS/2; Warp 4.5; rv:10.0.12) Gecko/20100101 Firefox/10.0.12",
- "Mozilla/5.0 (OS/2; Warp 4.5; rv:24.0) Gecko/20100101 Firefox/24.0",
- "Mozilla/5.0 (OS/2; Warp 4.5; rv:31.0) Gecko/20100101 Firefox/31.0",
- "Mozilla/5.0 (OS/2; Warp 4.5; rv:38.0) Gecko/20100101 Firefox/38.0",
- "Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101 Firefox/45.0",
- "Mozilla/5.0 (OS/2; U; OS/2; en-US) AppleWebKit/533.3 (KHTML, like Gecko) QupZilla/1.3.1 Safari/533.3",
- "Mozilla/5.0 (OS/2; Warp 4.5; rv:10.0.12) Gecko/20130108 Firefox/10.0.12 SeaMonkey/2.7.2",
- "Mozilla/5.0 (OS/2; Warp 4.5; rv:24.0) Gecko/20100101 Firefox/24.0 SeaMonkey/2.21",
- "Mozilla/5.0 (OS/2; Warp 4.5; rv:31.0) Gecko/20100101 Firefox/31.0 SeaMonkey/2.28",
- "Mozilla/5.0 (OS/2; Warp 4.5; rv:38.0) Gecko/20100101 Firefox/38.0 SeaMonkey/2.35",
- "Mozilla/5.0 (OS/2; Warp 4.5; rv:45.0) Gecko/20100101 Firefox/45.0 SeaMonkey/2.42.9esr",
- "Adobe Application Manager 2.0",
- "AndroidDownloadManager/5.1 (Linux; U; Android 5.1; Z820 Build/LMY47D)",
- "Download Demon/3.5.0.11",
- "Offline Explorer/2.5",
- "SuperBot/4.4.0.60 (Windows XP)",
- "WebCopier v4.6",
- "Web Downloader/6.9",
- "WebZIP/3.5 (http://www.spidersoft.com)",
- "Wget/1.9 cvs-stable (Red Hat modified)",
- "Wget/1.9.1",
- "Wget/1.12 (freebsd8.1)",
- "Bloglines/3.1 (http://www.bloglines.com)",
- "everyfeed-spider/2.0 (http://www.everyfeed.com)",
- "FeedFetcher-Google; ( http://www.google.com/feedfetcher.html)",
- "Gregarius/0.5.2 ( http://devlog.gregarius.net/docs/ua)",
- "Mozilla/5.0 (PLAYSTATION 3; 2.00)",
- "Mozilla/5.0 (PLAYSTATION 3; 1.10)",
- "Mozilla/4.0 (PSP (PlayStation Portable); 2.00)",
- "Opera/9.30 (Nintendo Wii; U; ; 2047-7; en)",
- "wii libnup/1.0",
- "Java/1.6.0_13",
- "libwww-perl/5.820",
- "Peach/1.01 (Ubuntu 8.04 LTS; U; en)",
- "Python-urllib/2.5",
- "HTMLParser/1.6",
- "Jigsaw/2.2.5 W3C_CSS_Validator_JFouffa/2.0",
- "W3C_Validator/1.654",
- "W3C_Validator/1.305.2.12 libwww-perl/5.64",
- "P3P Validator",
- "CSSCheck/1.2.2",
- "WDG_Validator/1.6.2",
- "facebookscraper/1.0( http://www.facebook.com/sharescraper_help.php)",
- "grub-client-1.5.3; (grub-client-1.5.3; Crawl your own stuff with http://grub.org)",
- "iTunes/4.2 (Macintosh; U; PPC Mac OS X 10.2)",
- "Microsoft URL Control - 6.00.8862",
- "Roku/DVP-4.1 (024.01E01250A)",
- "Mozilla/5.0 (SMART-TV; X11; Linux armv7l) AppleWebkit/537.42 (KHTML, like Gecko) Chromium/25.0.1349.2 Chrome/25.0.1349.2 Safari/537.42",
- "SearchExpress",
- }
-)
diff --git a/vendor/github.com/corpix/uarand/useragents.mk b/vendor/github.com/corpix/uarand/useragents.mk
deleted file mode 100644
index 2e2e457bde82e429e5d1f2627df146035674c3e8..0000000000000000000000000000000000000000
--- a/vendor/github.com/corpix/uarand/useragents.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-.PHONY: useragents.go
-useragents.go:
- curl -Ls -H'User-Agent: gotohellwithyour403' \
- http://techpatterns.com/downloads/firefox/useragentswitcher.xml \
- | ./scripts/extract-user-agents \
- | ./scripts/generate-useragents-go $(name) \
- > $@
- go fmt $@
-
-dependencies:: useragents.go
diff --git a/vendor/github.com/cpuguy83/go-md2man/LICENSE.md b/vendor/github.com/cpuguy83/go-md2man/LICENSE.md
deleted file mode 100644
index 1cade6cef6a1cb8efdf8549d709a99734c454630..0000000000000000000000000000000000000000
--- a/vendor/github.com/cpuguy83/go-md2man/LICENSE.md
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Brian Goff
-
-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/cpuguy83/go-md2man/md2man/md2man.go b/vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go
deleted file mode 100644
index af62279a61543a2e0e7859c8b19f6a505b427d70..0000000000000000000000000000000000000000
--- a/vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package md2man
-
-import (
- "github.com/russross/blackfriday"
-)
-
-// Render converts a markdown document into a roff formatted document.
-func Render(doc []byte) []byte {
- renderer := RoffRenderer(0)
- extensions := 0
- extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS
- extensions |= blackfriday.EXTENSION_TABLES
- extensions |= blackfriday.EXTENSION_FENCED_CODE
- extensions |= blackfriday.EXTENSION_AUTOLINK
- extensions |= blackfriday.EXTENSION_SPACE_HEADERS
- extensions |= blackfriday.EXTENSION_FOOTNOTES
- extensions |= blackfriday.EXTENSION_TITLEBLOCK
-
- return blackfriday.Markdown(doc, renderer, extensions)
-}
diff --git a/vendor/github.com/cpuguy83/go-md2man/md2man/roff.go b/vendor/github.com/cpuguy83/go-md2man/md2man/roff.go
deleted file mode 100644
index 8c29ec68738ae5adc00de1f1772faf81a4a97558..0000000000000000000000000000000000000000
--- a/vendor/github.com/cpuguy83/go-md2man/md2man/roff.go
+++ /dev/null
@@ -1,285 +0,0 @@
-package md2man
-
-import (
- "bytes"
- "fmt"
- "html"
- "strings"
-
- "github.com/russross/blackfriday"
-)
-
-type roffRenderer struct {
- ListCounters []int
-}
-
-// RoffRenderer creates a new blackfriday Renderer for generating roff documents
-// from markdown
-func RoffRenderer(flags int) blackfriday.Renderer {
- return &roffRenderer{}
-}
-
-func (r *roffRenderer) GetFlags() int {
- return 0
-}
-
-func (r *roffRenderer) TitleBlock(out *bytes.Buffer, text []byte) {
- out.WriteString(".TH ")
-
- splitText := bytes.Split(text, []byte("\n"))
- for i, line := range splitText {
- line = bytes.TrimPrefix(line, []byte("% "))
- if i == 0 {
- line = bytes.Replace(line, []byte("("), []byte("\" \""), 1)
- line = bytes.Replace(line, []byte(")"), []byte("\" \""), 1)
- }
- line = append([]byte("\""), line...)
- line = append(line, []byte("\" ")...)
- out.Write(line)
- }
- out.WriteString("\n")
-
- // disable hyphenation
- out.WriteString(".nh\n")
- // disable justification (adjust text to left margin only)
- out.WriteString(".ad l\n")
-}
-
-func (r *roffRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string) {
- out.WriteString("\n.PP\n.RS\n\n.nf\n")
- escapeSpecialChars(out, text)
- out.WriteString("\n.fi\n.RE\n")
-}
-
-func (r *roffRenderer) BlockQuote(out *bytes.Buffer, text []byte) {
- out.WriteString("\n.PP\n.RS\n")
- out.Write(text)
- out.WriteString("\n.RE\n")
-}
-
-func (r *roffRenderer) BlockHtml(out *bytes.Buffer, text []byte) { // nolint: golint
- out.Write(text)
-}
-
-func (r *roffRenderer) Header(out *bytes.Buffer, text func() bool, level int, id string) {
- marker := out.Len()
-
- switch {
- case marker == 0:
- // This is the doc header
- out.WriteString(".TH ")
- case level == 1:
- out.WriteString("\n\n.SH ")
- case level == 2:
- out.WriteString("\n.SH ")
- default:
- out.WriteString("\n.SS ")
- }
-
- if !text() {
- out.Truncate(marker)
- return
- }
-}
-
-func (r *roffRenderer) HRule(out *bytes.Buffer) {
- out.WriteString("\n.ti 0\n\\l'\\n(.lu'\n")
-}
-
-func (r *roffRenderer) List(out *bytes.Buffer, text func() bool, flags int) {
- marker := out.Len()
- r.ListCounters = append(r.ListCounters, 1)
- out.WriteString("\n.RS\n")
- if !text() {
- out.Truncate(marker)
- return
- }
- r.ListCounters = r.ListCounters[:len(r.ListCounters)-1]
- out.WriteString("\n.RE\n")
-}
-
-func (r *roffRenderer) ListItem(out *bytes.Buffer, text []byte, flags int) {
- if flags&blackfriday.LIST_TYPE_ORDERED != 0 {
- out.WriteString(fmt.Sprintf(".IP \"%3d.\" 5\n", r.ListCounters[len(r.ListCounters)-1]))
- r.ListCounters[len(r.ListCounters)-1]++
- } else {
- out.WriteString(".IP \\(bu 2\n")
- }
- out.Write(text)
- out.WriteString("\n")
-}
-
-func (r *roffRenderer) Paragraph(out *bytes.Buffer, text func() bool) {
- marker := out.Len()
- out.WriteString("\n.PP\n")
- if !text() {
- out.Truncate(marker)
- return
- }
- if marker != 0 {
- out.WriteString("\n")
- }
-}
-
-func (r *roffRenderer) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) {
- out.WriteString("\n.TS\nallbox;\n")
-
- maxDelims := 0
- lines := strings.Split(strings.TrimRight(string(header), "\n")+"\n"+strings.TrimRight(string(body), "\n"), "\n")
- for _, w := range lines {
- curDelims := strings.Count(w, "\t")
- if curDelims > maxDelims {
- maxDelims = curDelims
- }
- }
- out.Write([]byte(strings.Repeat("l ", maxDelims+1) + "\n"))
- out.Write([]byte(strings.Repeat("l ", maxDelims+1) + ".\n"))
- out.Write(header)
- if len(header) > 0 {
- out.Write([]byte("\n"))
- }
-
- out.Write(body)
- out.WriteString("\n.TE\n")
-}
-
-func (r *roffRenderer) TableRow(out *bytes.Buffer, text []byte) {
- if out.Len() > 0 {
- out.WriteString("\n")
- }
- out.Write(text)
-}
-
-func (r *roffRenderer) TableHeaderCell(out *bytes.Buffer, text []byte, align int) {
- if out.Len() > 0 {
- out.WriteString("\t")
- }
- if len(text) == 0 {
- text = []byte{' '}
- }
- out.Write([]byte("\\fB\\fC" + string(text) + "\\fR"))
-}
-
-func (r *roffRenderer) TableCell(out *bytes.Buffer, text []byte, align int) {
- if out.Len() > 0 {
- out.WriteString("\t")
- }
- if len(text) > 30 {
- text = append([]byte("T{\n"), text...)
- text = append(text, []byte("\nT}")...)
- }
- if len(text) == 0 {
- text = []byte{' '}
- }
- out.Write(text)
-}
-
-func (r *roffRenderer) Footnotes(out *bytes.Buffer, text func() bool) {
-
-}
-
-func (r *roffRenderer) FootnoteItem(out *bytes.Buffer, name, text []byte, flags int) {
-
-}
-
-func (r *roffRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) {
- out.WriteString("\n\\[la]")
- out.Write(link)
- out.WriteString("\\[ra]")
-}
-
-func (r *roffRenderer) CodeSpan(out *bytes.Buffer, text []byte) {
- out.WriteString("\\fB\\fC")
- escapeSpecialChars(out, text)
- out.WriteString("\\fR")
-}
-
-func (r *roffRenderer) DoubleEmphasis(out *bytes.Buffer, text []byte) {
- out.WriteString("\\fB")
- out.Write(text)
- out.WriteString("\\fP")
-}
-
-func (r *roffRenderer) Emphasis(out *bytes.Buffer, text []byte) {
- out.WriteString("\\fI")
- out.Write(text)
- out.WriteString("\\fP")
-}
-
-func (r *roffRenderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
-}
-
-func (r *roffRenderer) LineBreak(out *bytes.Buffer) {
- out.WriteString("\n.br\n")
-}
-
-func (r *roffRenderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
- out.Write(content)
- r.AutoLink(out, link, 0)
-}
-
-func (r *roffRenderer) RawHtmlTag(out *bytes.Buffer, tag []byte) { // nolint: golint
- out.Write(tag)
-}
-
-func (r *roffRenderer) TripleEmphasis(out *bytes.Buffer, text []byte) {
- out.WriteString("\\s+2")
- out.Write(text)
- out.WriteString("\\s-2")
-}
-
-func (r *roffRenderer) StrikeThrough(out *bytes.Buffer, text []byte) {
-}
-
-func (r *roffRenderer) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {
-
-}
-
-func (r *roffRenderer) Entity(out *bytes.Buffer, entity []byte) {
- out.WriteString(html.UnescapeString(string(entity)))
-}
-
-func (r *roffRenderer) NormalText(out *bytes.Buffer, text []byte) {
- escapeSpecialChars(out, text)
-}
-
-func (r *roffRenderer) DocumentHeader(out *bytes.Buffer) {
-}
-
-func (r *roffRenderer) DocumentFooter(out *bytes.Buffer) {
-}
-
-func needsBackslash(c byte) bool {
- for _, r := range []byte("-_&\\~") {
- if c == r {
- return true
- }
- }
- return false
-}
-
-func escapeSpecialChars(out *bytes.Buffer, text []byte) {
- for i := 0; i < len(text); i++ {
- // escape initial apostrophe or period
- if len(text) >= 1 && (text[0] == '\'' || text[0] == '.') {
- out.WriteString("\\&")
- }
-
- // directly copy normal characters
- org := i
-
- for i < len(text) && !needsBackslash(text[i]) {
- i++
- }
- if i > org {
- out.Write(text[org:i])
- }
-
- // escape a character
- if i >= len(text) {
- break
- }
- out.WriteByte('\\')
- out.WriteByte(text[i])
- }
-}
diff --git a/vendor/github.com/davecgh/go-spew/LICENSE b/vendor/github.com/davecgh/go-spew/LICENSE
deleted file mode 100644
index bc52e96f2b0ea97cc450e2fefbbb4cc430d1ac5a..0000000000000000000000000000000000000000
--- a/vendor/github.com/davecgh/go-spew/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-ISC License
-
-Copyright (c) 2012-2016 Dave Collins
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go
deleted file mode 100644
index 792994785e36ca74c5545a0d93a2cdecda006678..0000000000000000000000000000000000000000
--- a/vendor/github.com/davecgh/go-spew/spew/bypass.go
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (c) 2015-2016 Dave Collins
-//
-// Permission to use, copy, modify, and distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-// NOTE: Due to the following build constraints, this file will only be compiled
-// when the code is not running on Google App Engine, compiled by GopherJS, and
-// "-tags safe" is not added to the go build command line. The "disableunsafe"
-// tag is deprecated and thus should not be used.
-// Go versions prior to 1.4 are disabled because they use a different layout
-// for interfaces which make the implementation of unsafeReflectValue more complex.
-// +build !js,!appengine,!safe,!disableunsafe,go1.4
-
-package spew
-
-import (
- "reflect"
- "unsafe"
-)
-
-const (
- // UnsafeDisabled is a build-time constant which specifies whether or
- // not access to the unsafe package is available.
- UnsafeDisabled = false
-
- // ptrSize is the size of a pointer on the current arch.
- ptrSize = unsafe.Sizeof((*byte)(nil))
-)
-
-type flag uintptr
-
-var (
- // flagRO indicates whether the value field of a reflect.Value
- // is read-only.
- flagRO flag
-
- // flagAddr indicates whether the address of the reflect.Value's
- // value may be taken.
- flagAddr flag
-)
-
-// flagKindMask holds the bits that make up the kind
-// part of the flags field. In all the supported versions,
-// it is in the lower 5 bits.
-const flagKindMask = flag(0x1f)
-
-// Different versions of Go have used different
-// bit layouts for the flags type. This table
-// records the known combinations.
-var okFlags = []struct {
- ro, addr flag
-}{{
- // From Go 1.4 to 1.5
- ro: 1 << 5,
- addr: 1 << 7,
-}, {
- // Up to Go tip.
- ro: 1<<5 | 1<<6,
- addr: 1 << 8,
-}}
-
-var flagValOffset = func() uintptr {
- field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag")
- if !ok {
- panic("reflect.Value has no flag field")
- }
- return field.Offset
-}()
-
-// flagField returns a pointer to the flag field of a reflect.Value.
-func flagField(v *reflect.Value) *flag {
- return (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset))
-}
-
-// unsafeReflectValue converts the passed reflect.Value into a one that bypasses
-// the typical safety restrictions preventing access to unaddressable and
-// unexported data. It works by digging the raw pointer to the underlying
-// value out of the protected value and generating a new unprotected (unsafe)
-// reflect.Value to it.
-//
-// This allows us to check for implementations of the Stringer and error
-// interfaces to be used for pretty printing ordinarily unaddressable and
-// inaccessible values such as unexported struct fields.
-func unsafeReflectValue(v reflect.Value) reflect.Value {
- if !v.IsValid() || (v.CanInterface() && v.CanAddr()) {
- return v
- }
- flagFieldPtr := flagField(&v)
- *flagFieldPtr &^= flagRO
- *flagFieldPtr |= flagAddr
- return v
-}
-
-// Sanity checks against future reflect package changes
-// to the type or semantics of the Value.flag field.
-func init() {
- field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag")
- if !ok {
- panic("reflect.Value has no flag field")
- }
- if field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() {
- panic("reflect.Value flag field has changed kind")
- }
- type t0 int
- var t struct {
- A t0
- // t0 will have flagEmbedRO set.
- t0
- // a will have flagStickyRO set
- a t0
- }
- vA := reflect.ValueOf(t).FieldByName("A")
- va := reflect.ValueOf(t).FieldByName("a")
- vt0 := reflect.ValueOf(t).FieldByName("t0")
-
- // Infer flagRO from the difference between the flags
- // for the (otherwise identical) fields in t.
- flagPublic := *flagField(&vA)
- flagWithRO := *flagField(&va) | *flagField(&vt0)
- flagRO = flagPublic ^ flagWithRO
-
- // Infer flagAddr from the difference between a value
- // taken from a pointer and not.
- vPtrA := reflect.ValueOf(&t).Elem().FieldByName("A")
- flagNoPtr := *flagField(&vA)
- flagPtr := *flagField(&vPtrA)
- flagAddr = flagNoPtr ^ flagPtr
-
- // Check that the inferred flags tally with one of the known versions.
- for _, f := range okFlags {
- if flagRO == f.ro && flagAddr == f.addr {
- return
- }
- }
- panic("reflect.Value read-only flag has changed semantics")
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go
deleted file mode 100644
index 205c28d68c474e4497e6aa1ce8b9fdeb260f4586..0000000000000000000000000000000000000000
--- a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2015-2016 Dave Collins
-//
-// Permission to use, copy, modify, and distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-// NOTE: Due to the following build constraints, this file will only be compiled
-// when the code is running on Google App Engine, compiled by GopherJS, or
-// "-tags safe" is added to the go build command line. The "disableunsafe"
-// tag is deprecated and thus should not be used.
-// +build js appengine safe disableunsafe !go1.4
-
-package spew
-
-import "reflect"
-
-const (
- // UnsafeDisabled is a build-time constant which specifies whether or
- // not access to the unsafe package is available.
- UnsafeDisabled = true
-)
-
-// unsafeReflectValue typically converts the passed reflect.Value into a one
-// that bypasses the typical safety restrictions preventing access to
-// unaddressable and unexported data. However, doing this relies on access to
-// the unsafe package. This is a stub version which simply returns the passed
-// reflect.Value when the unsafe package is not available.
-func unsafeReflectValue(v reflect.Value) reflect.Value {
- return v
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/common.go b/vendor/github.com/davecgh/go-spew/spew/common.go
deleted file mode 100644
index 1be8ce9457612e02a64c01b2321d087ebd6415f2..0000000000000000000000000000000000000000
--- a/vendor/github.com/davecgh/go-spew/spew/common.go
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew
-
-import (
- "bytes"
- "fmt"
- "io"
- "reflect"
- "sort"
- "strconv"
-)
-
-// Some constants in the form of bytes to avoid string overhead. This mirrors
-// the technique used in the fmt package.
-var (
- panicBytes = []byte("(PANIC=")
- plusBytes = []byte("+")
- iBytes = []byte("i")
- trueBytes = []byte("true")
- falseBytes = []byte("false")
- interfaceBytes = []byte("(interface {})")
- commaNewlineBytes = []byte(",\n")
- newlineBytes = []byte("\n")
- openBraceBytes = []byte("{")
- openBraceNewlineBytes = []byte("{\n")
- closeBraceBytes = []byte("}")
- asteriskBytes = []byte("*")
- colonBytes = []byte(":")
- colonSpaceBytes = []byte(": ")
- openParenBytes = []byte("(")
- closeParenBytes = []byte(")")
- spaceBytes = []byte(" ")
- pointerChainBytes = []byte("->")
- nilAngleBytes = []byte("")
- maxNewlineBytes = []byte("\n")
- maxShortBytes = []byte("")
- circularBytes = []byte("")
- circularShortBytes = []byte("")
- invalidAngleBytes = []byte("")
- openBracketBytes = []byte("[")
- closeBracketBytes = []byte("]")
- percentBytes = []byte("%")
- precisionBytes = []byte(".")
- openAngleBytes = []byte("<")
- closeAngleBytes = []byte(">")
- openMapBytes = []byte("map[")
- closeMapBytes = []byte("]")
- lenEqualsBytes = []byte("len=")
- capEqualsBytes = []byte("cap=")
-)
-
-// hexDigits is used to map a decimal value to a hex digit.
-var hexDigits = "0123456789abcdef"
-
-// catchPanic handles any panics that might occur during the handleMethods
-// calls.
-func catchPanic(w io.Writer, v reflect.Value) {
- if err := recover(); err != nil {
- w.Write(panicBytes)
- fmt.Fprintf(w, "%v", err)
- w.Write(closeParenBytes)
- }
-}
-
-// handleMethods attempts to call the Error and String methods on the underlying
-// type the passed reflect.Value represents and outputes the result to Writer w.
-//
-// It handles panics in any called methods by catching and displaying the error
-// as the formatted value.
-func handleMethods(cs *ConfigState, w io.Writer, v reflect.Value) (handled bool) {
- // We need an interface to check if the type implements the error or
- // Stringer interface. However, the reflect package won't give us an
- // interface on certain things like unexported struct fields in order
- // to enforce visibility rules. We use unsafe, when it's available,
- // to bypass these restrictions since this package does not mutate the
- // values.
- if !v.CanInterface() {
- if UnsafeDisabled {
- return false
- }
-
- v = unsafeReflectValue(v)
- }
-
- // Choose whether or not to do error and Stringer interface lookups against
- // the base type or a pointer to the base type depending on settings.
- // Technically calling one of these methods with a pointer receiver can
- // mutate the value, however, types which choose to satisify an error or
- // Stringer interface with a pointer receiver should not be mutating their
- // state inside these interface methods.
- if !cs.DisablePointerMethods && !UnsafeDisabled && !v.CanAddr() {
- v = unsafeReflectValue(v)
- }
- if v.CanAddr() {
- v = v.Addr()
- }
-
- // Is it an error or Stringer?
- switch iface := v.Interface().(type) {
- case error:
- defer catchPanic(w, v)
- if cs.ContinueOnMethod {
- w.Write(openParenBytes)
- w.Write([]byte(iface.Error()))
- w.Write(closeParenBytes)
- w.Write(spaceBytes)
- return false
- }
-
- w.Write([]byte(iface.Error()))
- return true
-
- case fmt.Stringer:
- defer catchPanic(w, v)
- if cs.ContinueOnMethod {
- w.Write(openParenBytes)
- w.Write([]byte(iface.String()))
- w.Write(closeParenBytes)
- w.Write(spaceBytes)
- return false
- }
- w.Write([]byte(iface.String()))
- return true
- }
- return false
-}
-
-// printBool outputs a boolean value as true or false to Writer w.
-func printBool(w io.Writer, val bool) {
- if val {
- w.Write(trueBytes)
- } else {
- w.Write(falseBytes)
- }
-}
-
-// printInt outputs a signed integer value to Writer w.
-func printInt(w io.Writer, val int64, base int) {
- w.Write([]byte(strconv.FormatInt(val, base)))
-}
-
-// printUint outputs an unsigned integer value to Writer w.
-func printUint(w io.Writer, val uint64, base int) {
- w.Write([]byte(strconv.FormatUint(val, base)))
-}
-
-// printFloat outputs a floating point value using the specified precision,
-// which is expected to be 32 or 64bit, to Writer w.
-func printFloat(w io.Writer, val float64, precision int) {
- w.Write([]byte(strconv.FormatFloat(val, 'g', -1, precision)))
-}
-
-// printComplex outputs a complex value using the specified float precision
-// for the real and imaginary parts to Writer w.
-func printComplex(w io.Writer, c complex128, floatPrecision int) {
- r := real(c)
- w.Write(openParenBytes)
- w.Write([]byte(strconv.FormatFloat(r, 'g', -1, floatPrecision)))
- i := imag(c)
- if i >= 0 {
- w.Write(plusBytes)
- }
- w.Write([]byte(strconv.FormatFloat(i, 'g', -1, floatPrecision)))
- w.Write(iBytes)
- w.Write(closeParenBytes)
-}
-
-// printHexPtr outputs a uintptr formatted as hexadecimal with a leading '0x'
-// prefix to Writer w.
-func printHexPtr(w io.Writer, p uintptr) {
- // Null pointer.
- num := uint64(p)
- if num == 0 {
- w.Write(nilAngleBytes)
- return
- }
-
- // Max uint64 is 16 bytes in hex + 2 bytes for '0x' prefix
- buf := make([]byte, 18)
-
- // It's simpler to construct the hex string right to left.
- base := uint64(16)
- i := len(buf) - 1
- for num >= base {
- buf[i] = hexDigits[num%base]
- num /= base
- i--
- }
- buf[i] = hexDigits[num]
-
- // Add '0x' prefix.
- i--
- buf[i] = 'x'
- i--
- buf[i] = '0'
-
- // Strip unused leading bytes.
- buf = buf[i:]
- w.Write(buf)
-}
-
-// valuesSorter implements sort.Interface to allow a slice of reflect.Value
-// elements to be sorted.
-type valuesSorter struct {
- values []reflect.Value
- strings []string // either nil or same len and values
- cs *ConfigState
-}
-
-// newValuesSorter initializes a valuesSorter instance, which holds a set of
-// surrogate keys on which the data should be sorted. It uses flags in
-// ConfigState to decide if and how to populate those surrogate keys.
-func newValuesSorter(values []reflect.Value, cs *ConfigState) sort.Interface {
- vs := &valuesSorter{values: values, cs: cs}
- if canSortSimply(vs.values[0].Kind()) {
- return vs
- }
- if !cs.DisableMethods {
- vs.strings = make([]string, len(values))
- for i := range vs.values {
- b := bytes.Buffer{}
- if !handleMethods(cs, &b, vs.values[i]) {
- vs.strings = nil
- break
- }
- vs.strings[i] = b.String()
- }
- }
- if vs.strings == nil && cs.SpewKeys {
- vs.strings = make([]string, len(values))
- for i := range vs.values {
- vs.strings[i] = Sprintf("%#v", vs.values[i].Interface())
- }
- }
- return vs
-}
-
-// canSortSimply tests whether a reflect.Kind is a primitive that can be sorted
-// directly, or whether it should be considered for sorting by surrogate keys
-// (if the ConfigState allows it).
-func canSortSimply(kind reflect.Kind) bool {
- // This switch parallels valueSortLess, except for the default case.
- switch kind {
- case reflect.Bool:
- return true
- case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
- return true
- case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
- return true
- case reflect.Float32, reflect.Float64:
- return true
- case reflect.String:
- return true
- case reflect.Uintptr:
- return true
- case reflect.Array:
- return true
- }
- return false
-}
-
-// Len returns the number of values in the slice. It is part of the
-// sort.Interface implementation.
-func (s *valuesSorter) Len() int {
- return len(s.values)
-}
-
-// Swap swaps the values at the passed indices. It is part of the
-// sort.Interface implementation.
-func (s *valuesSorter) Swap(i, j int) {
- s.values[i], s.values[j] = s.values[j], s.values[i]
- if s.strings != nil {
- s.strings[i], s.strings[j] = s.strings[j], s.strings[i]
- }
-}
-
-// valueSortLess returns whether the first value should sort before the second
-// value. It is used by valueSorter.Less as part of the sort.Interface
-// implementation.
-func valueSortLess(a, b reflect.Value) bool {
- switch a.Kind() {
- case reflect.Bool:
- return !a.Bool() && b.Bool()
- case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
- return a.Int() < b.Int()
- case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
- return a.Uint() < b.Uint()
- case reflect.Float32, reflect.Float64:
- return a.Float() < b.Float()
- case reflect.String:
- return a.String() < b.String()
- case reflect.Uintptr:
- return a.Uint() < b.Uint()
- case reflect.Array:
- // Compare the contents of both arrays.
- l := a.Len()
- for i := 0; i < l; i++ {
- av := a.Index(i)
- bv := b.Index(i)
- if av.Interface() == bv.Interface() {
- continue
- }
- return valueSortLess(av, bv)
- }
- }
- return a.String() < b.String()
-}
-
-// Less returns whether the value at index i should sort before the
-// value at index j. It is part of the sort.Interface implementation.
-func (s *valuesSorter) Less(i, j int) bool {
- if s.strings == nil {
- return valueSortLess(s.values[i], s.values[j])
- }
- return s.strings[i] < s.strings[j]
-}
-
-// sortValues is a sort function that handles both native types and any type that
-// can be converted to error or Stringer. Other inputs are sorted according to
-// their Value.String() value to ensure display stability.
-func sortValues(values []reflect.Value, cs *ConfigState) {
- if len(values) == 0 {
- return
- }
- sort.Sort(newValuesSorter(values, cs))
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/config.go b/vendor/github.com/davecgh/go-spew/spew/config.go
deleted file mode 100644
index 2e3d22f312026ff2c863bbffcbc88b7f6fb942f5..0000000000000000000000000000000000000000
--- a/vendor/github.com/davecgh/go-spew/spew/config.go
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
-)
-
-// ConfigState houses the configuration options used by spew to format and
-// display values. There is a global instance, Config, that is used to control
-// all top-level Formatter and Dump functionality. Each ConfigState instance
-// provides methods equivalent to the top-level functions.
-//
-// The zero value for ConfigState provides no indentation. You would typically
-// want to set it to a space or a tab.
-//
-// Alternatively, you can use NewDefaultConfig to get a ConfigState instance
-// with default settings. See the documentation of NewDefaultConfig for default
-// values.
-type ConfigState struct {
- // Indent specifies the string to use for each indentation level. The
- // global config instance that all top-level functions use set this to a
- // single space by default. If you would like more indentation, you might
- // set this to a tab with "\t" or perhaps two spaces with " ".
- Indent string
-
- // MaxDepth controls the maximum number of levels to descend into nested
- // data structures. The default, 0, means there is no limit.
- //
- // NOTE: Circular data structures are properly detected, so it is not
- // necessary to set this value unless you specifically want to limit deeply
- // nested data structures.
- MaxDepth int
-
- // DisableMethods specifies whether or not error and Stringer interfaces are
- // invoked for types that implement them.
- DisableMethods bool
-
- // DisablePointerMethods specifies whether or not to check for and invoke
- // error and Stringer interfaces on types which only accept a pointer
- // receiver when the current type is not a pointer.
- //
- // NOTE: This might be an unsafe action since calling one of these methods
- // with a pointer receiver could technically mutate the value, however,
- // in practice, types which choose to satisify an error or Stringer
- // interface with a pointer receiver should not be mutating their state
- // inside these interface methods. As a result, this option relies on
- // access to the unsafe package, so it will not have any effect when
- // running in environments without access to the unsafe package such as
- // Google App Engine or with the "safe" build tag specified.
- DisablePointerMethods bool
-
- // DisablePointerAddresses specifies whether to disable the printing of
- // pointer addresses. This is useful when diffing data structures in tests.
- DisablePointerAddresses bool
-
- // DisableCapacities specifies whether to disable the printing of capacities
- // for arrays, slices, maps and channels. This is useful when diffing
- // data structures in tests.
- DisableCapacities bool
-
- // ContinueOnMethod specifies whether or not recursion should continue once
- // a custom error or Stringer interface is invoked. The default, false,
- // means it will print the results of invoking the custom error or Stringer
- // interface and return immediately instead of continuing to recurse into
- // the internals of the data type.
- //
- // NOTE: This flag does not have any effect if method invocation is disabled
- // via the DisableMethods or DisablePointerMethods options.
- ContinueOnMethod bool
-
- // SortKeys specifies map keys should be sorted before being printed. Use
- // this to have a more deterministic, diffable output. Note that only
- // native types (bool, int, uint, floats, uintptr and string) and types
- // that support the error or Stringer interfaces (if methods are
- // enabled) are supported, with other types sorted according to the
- // reflect.Value.String() output which guarantees display stability.
- SortKeys bool
-
- // SpewKeys specifies that, as a last resort attempt, map keys should
- // be spewed to strings and sorted by those strings. This is only
- // considered if SortKeys is true.
- SpewKeys bool
-}
-
-// Config is the active configuration of the top-level functions.
-// The configuration can be changed by modifying the contents of spew.Config.
-var Config = ConfigState{Indent: " "}
-
-// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the formatted string as a value that satisfies error. See NewFormatter
-// for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Errorf(format, c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Errorf(format string, a ...interface{}) (err error) {
- return fmt.Errorf(format, c.convertArgs(a)...)
-}
-
-// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Fprint(w, c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Fprint(w io.Writer, a ...interface{}) (n int, err error) {
- return fmt.Fprint(w, c.convertArgs(a)...)
-}
-
-// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Fprintf(w, format, c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
- return fmt.Fprintf(w, format, c.convertArgs(a)...)
-}
-
-// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it
-// passed with a Formatter interface returned by c.NewFormatter. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Fprintln(w, c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
- return fmt.Fprintln(w, c.convertArgs(a)...)
-}
-
-// Print is a wrapper for fmt.Print that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Print(c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Print(a ...interface{}) (n int, err error) {
- return fmt.Print(c.convertArgs(a)...)
-}
-
-// Printf is a wrapper for fmt.Printf that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Printf(format, c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Printf(format string, a ...interface{}) (n int, err error) {
- return fmt.Printf(format, c.convertArgs(a)...)
-}
-
-// Println is a wrapper for fmt.Println that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Println(c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Println(a ...interface{}) (n int, err error) {
- return fmt.Println(c.convertArgs(a)...)
-}
-
-// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the resulting string. See NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Sprint(c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Sprint(a ...interface{}) string {
- return fmt.Sprint(c.convertArgs(a)...)
-}
-
-// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were
-// passed with a Formatter interface returned by c.NewFormatter. It returns
-// the resulting string. See NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Sprintf(format, c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Sprintf(format string, a ...interface{}) string {
- return fmt.Sprintf(format, c.convertArgs(a)...)
-}
-
-// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it
-// were passed with a Formatter interface returned by c.NewFormatter. It
-// returns the resulting string. See NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Sprintln(c.NewFormatter(a), c.NewFormatter(b))
-func (c *ConfigState) Sprintln(a ...interface{}) string {
- return fmt.Sprintln(c.convertArgs(a)...)
-}
-
-/*
-NewFormatter returns a custom formatter that satisfies the fmt.Formatter
-interface. As a result, it integrates cleanly with standard fmt package
-printing functions. The formatter is useful for inline printing of smaller data
-types similar to the standard %v format specifier.
-
-The custom formatter only responds to the %v (most compact), %+v (adds pointer
-addresses), %#v (adds types), and %#+v (adds types and pointer addresses) verb
-combinations. Any other verbs such as %x and %q will be sent to the the
-standard fmt package for formatting. In addition, the custom formatter ignores
-the width and precision arguments (however they will still work on the format
-specifiers not handled by the custom formatter).
-
-Typically this function shouldn't be called directly. It is much easier to make
-use of the custom formatter by calling one of the convenience functions such as
-c.Printf, c.Println, or c.Printf.
-*/
-func (c *ConfigState) NewFormatter(v interface{}) fmt.Formatter {
- return newFormatter(c, v)
-}
-
-// Fdump formats and displays the passed arguments to io.Writer w. It formats
-// exactly the same as Dump.
-func (c *ConfigState) Fdump(w io.Writer, a ...interface{}) {
- fdump(c, w, a...)
-}
-
-/*
-Dump displays the passed parameters to standard out with newlines, customizable
-indentation, and additional debug information such as complete types and all
-pointer addresses used to indirect to the final value. It provides the
-following features over the built-in printing facilities provided by the fmt
-package:
-
- * Pointers are dereferenced and followed
- * Circular data structures are detected and handled properly
- * Custom Stringer/error interfaces are optionally invoked, including
- on unexported types
- * Custom types which only implement the Stringer/error interfaces via
- a pointer receiver are optionally invoked when passing non-pointer
- variables
- * Byte arrays and slices are dumped like the hexdump -C command which
- includes offsets, byte values in hex, and ASCII output
-
-The configuration options are controlled by modifying the public members
-of c. See ConfigState for options documentation.
-
-See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
-get the formatted result as a string.
-*/
-func (c *ConfigState) Dump(a ...interface{}) {
- fdump(c, os.Stdout, a...)
-}
-
-// Sdump returns a string with the passed arguments formatted exactly the same
-// as Dump.
-func (c *ConfigState) Sdump(a ...interface{}) string {
- var buf bytes.Buffer
- fdump(c, &buf, a...)
- return buf.String()
-}
-
-// convertArgs accepts a slice of arguments and returns a slice of the same
-// length with each argument converted to a spew Formatter interface using
-// the ConfigState associated with s.
-func (c *ConfigState) convertArgs(args []interface{}) (formatters []interface{}) {
- formatters = make([]interface{}, len(args))
- for index, arg := range args {
- formatters[index] = newFormatter(c, arg)
- }
- return formatters
-}
-
-// NewDefaultConfig returns a ConfigState with the following default settings.
-//
-// Indent: " "
-// MaxDepth: 0
-// DisableMethods: false
-// DisablePointerMethods: false
-// ContinueOnMethod: false
-// SortKeys: false
-func NewDefaultConfig() *ConfigState {
- return &ConfigState{Indent: " "}
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/doc.go b/vendor/github.com/davecgh/go-spew/spew/doc.go
deleted file mode 100644
index aacaac6f1e1e936ee0022c00e139756c9bdc2b3e..0000000000000000000000000000000000000000
--- a/vendor/github.com/davecgh/go-spew/spew/doc.go
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
-Package spew implements a deep pretty printer for Go data structures to aid in
-debugging.
-
-A quick overview of the additional features spew provides over the built-in
-printing facilities for Go data types are as follows:
-
- * Pointers are dereferenced and followed
- * Circular data structures are detected and handled properly
- * Custom Stringer/error interfaces are optionally invoked, including
- on unexported types
- * Custom types which only implement the Stringer/error interfaces via
- a pointer receiver are optionally invoked when passing non-pointer
- variables
- * Byte arrays and slices are dumped like the hexdump -C command which
- includes offsets, byte values in hex, and ASCII output (only when using
- Dump style)
-
-There are two different approaches spew allows for dumping Go data structures:
-
- * Dump style which prints with newlines, customizable indentation,
- and additional debug information such as types and all pointer addresses
- used to indirect to the final value
- * A custom Formatter interface that integrates cleanly with the standard fmt
- package and replaces %v, %+v, %#v, and %#+v to provide inline printing
- similar to the default %v while providing the additional functionality
- outlined above and passing unsupported format verbs such as %x and %q
- along to fmt
-
-Quick Start
-
-This section demonstrates how to quickly get started with spew. See the
-sections below for further details on formatting and configuration options.
-
-To dump a variable with full newlines, indentation, type, and pointer
-information use Dump, Fdump, or Sdump:
- spew.Dump(myVar1, myVar2, ...)
- spew.Fdump(someWriter, myVar1, myVar2, ...)
- str := spew.Sdump(myVar1, myVar2, ...)
-
-Alternatively, if you would prefer to use format strings with a compacted inline
-printing style, use the convenience wrappers Printf, Fprintf, etc with
-%v (most compact), %+v (adds pointer addresses), %#v (adds types), or
-%#+v (adds types and pointer addresses):
- spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2)
- spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
- spew.Fprintf(someWriter, "myVar1: %v -- myVar2: %+v", myVar1, myVar2)
- spew.Fprintf(someWriter, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
-
-Configuration Options
-
-Configuration of spew is handled by fields in the ConfigState type. For
-convenience, all of the top-level functions use a global state available
-via the spew.Config global.
-
-It is also possible to create a ConfigState instance that provides methods
-equivalent to the top-level functions. This allows concurrent configuration
-options. See the ConfigState documentation for more details.
-
-The following configuration options are available:
- * Indent
- String to use for each indentation level for Dump functions.
- It is a single space by default. A popular alternative is "\t".
-
- * MaxDepth
- Maximum number of levels to descend into nested data structures.
- There is no limit by default.
-
- * DisableMethods
- Disables invocation of error and Stringer interface methods.
- Method invocation is enabled by default.
-
- * DisablePointerMethods
- Disables invocation of error and Stringer interface methods on types
- which only accept pointer receivers from non-pointer variables.
- Pointer method invocation is enabled by default.
-
- * DisablePointerAddresses
- DisablePointerAddresses specifies whether to disable the printing of
- pointer addresses. This is useful when diffing data structures in tests.
-
- * DisableCapacities
- DisableCapacities specifies whether to disable the printing of
- capacities for arrays, slices, maps and channels. This is useful when
- diffing data structures in tests.
-
- * ContinueOnMethod
- Enables recursion into types after invoking error and Stringer interface
- methods. Recursion after method invocation is disabled by default.
-
- * SortKeys
- Specifies map keys should be sorted before being printed. Use
- this to have a more deterministic, diffable output. Note that
- only native types (bool, int, uint, floats, uintptr and string)
- and types which implement error or Stringer interfaces are
- supported with other types sorted according to the
- reflect.Value.String() output which guarantees display
- stability. Natural map order is used by default.
-
- * SpewKeys
- Specifies that, as a last resort attempt, map keys should be
- spewed to strings and sorted by those strings. This is only
- considered if SortKeys is true.
-
-Dump Usage
-
-Simply call spew.Dump with a list of variables you want to dump:
-
- spew.Dump(myVar1, myVar2, ...)
-
-You may also call spew.Fdump if you would prefer to output to an arbitrary
-io.Writer. For example, to dump to standard error:
-
- spew.Fdump(os.Stderr, myVar1, myVar2, ...)
-
-A third option is to call spew.Sdump to get the formatted output as a string:
-
- str := spew.Sdump(myVar1, myVar2, ...)
-
-Sample Dump Output
-
-See the Dump example for details on the setup of the types and variables being
-shown here.
-
- (main.Foo) {
- unexportedField: (*main.Bar)(0xf84002e210)({
- flag: (main.Flag) flagTwo,
- data: (uintptr)
- }),
- ExportedField: (map[interface {}]interface {}) (len=1) {
- (string) (len=3) "one": (bool) true
- }
- }
-
-Byte (and uint8) arrays and slices are displayed uniquely like the hexdump -C
-command as shown.
- ([]uint8) (len=32 cap=32) {
- 00000000 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 |............... |
- 00000010 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 |!"#$%&'()*+,-./0|
- 00000020 31 32 |12|
- }
-
-Custom Formatter
-
-Spew provides a custom formatter that implements the fmt.Formatter interface
-so that it integrates cleanly with standard fmt package printing functions. The
-formatter is useful for inline printing of smaller data types similar to the
-standard %v format specifier.
-
-The custom formatter only responds to the %v (most compact), %+v (adds pointer
-addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb
-combinations. Any other verbs such as %x and %q will be sent to the the
-standard fmt package for formatting. In addition, the custom formatter ignores
-the width and precision arguments (however they will still work on the format
-specifiers not handled by the custom formatter).
-
-Custom Formatter Usage
-
-The simplest way to make use of the spew custom formatter is to call one of the
-convenience functions such as spew.Printf, spew.Println, or spew.Printf. The
-functions have syntax you are most likely already familiar with:
-
- spew.Printf("myVar1: %v -- myVar2: %+v", myVar1, myVar2)
- spew.Printf("myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
- spew.Println(myVar, myVar2)
- spew.Fprintf(os.Stderr, "myVar1: %v -- myVar2: %+v", myVar1, myVar2)
- spew.Fprintf(os.Stderr, "myVar3: %#v -- myVar4: %#+v", myVar3, myVar4)
-
-See the Index for the full list convenience functions.
-
-Sample Formatter Output
-
-Double pointer to a uint8:
- %v: <**>5
- %+v: <**>(0xf8400420d0->0xf8400420c8)5
- %#v: (**uint8)5
- %#+v: (**uint8)(0xf8400420d0->0xf8400420c8)5
-
-Pointer to circular struct with a uint8 field and a pointer to itself:
- %v: <*>{1 <*>}
- %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)}
- %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)}
- %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)}
-
-See the Printf example for details on the setup of variables being shown
-here.
-
-Errors
-
-Since it is possible for custom Stringer/error interfaces to panic, spew
-detects them and handles them internally by printing the panic information
-inline with the output. Since spew is intended to provide deep pretty printing
-capabilities on structures, it intentionally does not return any errors.
-*/
-package spew
diff --git a/vendor/github.com/davecgh/go-spew/spew/dump.go b/vendor/github.com/davecgh/go-spew/spew/dump.go
deleted file mode 100644
index f78d89fc1f6c454df58cd1e346817db6e30c4299..0000000000000000000000000000000000000000
--- a/vendor/github.com/davecgh/go-spew/spew/dump.go
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew
-
-import (
- "bytes"
- "encoding/hex"
- "fmt"
- "io"
- "os"
- "reflect"
- "regexp"
- "strconv"
- "strings"
-)
-
-var (
- // uint8Type is a reflect.Type representing a uint8. It is used to
- // convert cgo types to uint8 slices for hexdumping.
- uint8Type = reflect.TypeOf(uint8(0))
-
- // cCharRE is a regular expression that matches a cgo char.
- // It is used to detect character arrays to hexdump them.
- cCharRE = regexp.MustCompile(`^.*\._Ctype_char$`)
-
- // cUnsignedCharRE is a regular expression that matches a cgo unsigned
- // char. It is used to detect unsigned character arrays to hexdump
- // them.
- cUnsignedCharRE = regexp.MustCompile(`^.*\._Ctype_unsignedchar$`)
-
- // cUint8tCharRE is a regular expression that matches a cgo uint8_t.
- // It is used to detect uint8_t arrays to hexdump them.
- cUint8tCharRE = regexp.MustCompile(`^.*\._Ctype_uint8_t$`)
-)
-
-// dumpState contains information about the state of a dump operation.
-type dumpState struct {
- w io.Writer
- depth int
- pointers map[uintptr]int
- ignoreNextType bool
- ignoreNextIndent bool
- cs *ConfigState
-}
-
-// indent performs indentation according to the depth level and cs.Indent
-// option.
-func (d *dumpState) indent() {
- if d.ignoreNextIndent {
- d.ignoreNextIndent = false
- return
- }
- d.w.Write(bytes.Repeat([]byte(d.cs.Indent), d.depth))
-}
-
-// unpackValue returns values inside of non-nil interfaces when possible.
-// This is useful for data types like structs, arrays, slices, and maps which
-// can contain varying types packed inside an interface.
-func (d *dumpState) unpackValue(v reflect.Value) reflect.Value {
- if v.Kind() == reflect.Interface && !v.IsNil() {
- v = v.Elem()
- }
- return v
-}
-
-// dumpPtr handles formatting of pointers by indirecting them as necessary.
-func (d *dumpState) dumpPtr(v reflect.Value) {
- // Remove pointers at or below the current depth from map used to detect
- // circular refs.
- for k, depth := range d.pointers {
- if depth >= d.depth {
- delete(d.pointers, k)
- }
- }
-
- // Keep list of all dereferenced pointers to show later.
- pointerChain := make([]uintptr, 0)
-
- // Figure out how many levels of indirection there are by dereferencing
- // pointers and unpacking interfaces down the chain while detecting circular
- // references.
- nilFound := false
- cycleFound := false
- indirects := 0
- ve := v
- for ve.Kind() == reflect.Ptr {
- if ve.IsNil() {
- nilFound = true
- break
- }
- indirects++
- addr := ve.Pointer()
- pointerChain = append(pointerChain, addr)
- if pd, ok := d.pointers[addr]; ok && pd < d.depth {
- cycleFound = true
- indirects--
- break
- }
- d.pointers[addr] = d.depth
-
- ve = ve.Elem()
- if ve.Kind() == reflect.Interface {
- if ve.IsNil() {
- nilFound = true
- break
- }
- ve = ve.Elem()
- }
- }
-
- // Display type information.
- d.w.Write(openParenBytes)
- d.w.Write(bytes.Repeat(asteriskBytes, indirects))
- d.w.Write([]byte(ve.Type().String()))
- d.w.Write(closeParenBytes)
-
- // Display pointer information.
- if !d.cs.DisablePointerAddresses && len(pointerChain) > 0 {
- d.w.Write(openParenBytes)
- for i, addr := range pointerChain {
- if i > 0 {
- d.w.Write(pointerChainBytes)
- }
- printHexPtr(d.w, addr)
- }
- d.w.Write(closeParenBytes)
- }
-
- // Display dereferenced value.
- d.w.Write(openParenBytes)
- switch {
- case nilFound:
- d.w.Write(nilAngleBytes)
-
- case cycleFound:
- d.w.Write(circularBytes)
-
- default:
- d.ignoreNextType = true
- d.dump(ve)
- }
- d.w.Write(closeParenBytes)
-}
-
-// dumpSlice handles formatting of arrays and slices. Byte (uint8 under
-// reflection) arrays and slices are dumped in hexdump -C fashion.
-func (d *dumpState) dumpSlice(v reflect.Value) {
- // Determine whether this type should be hex dumped or not. Also,
- // for types which should be hexdumped, try to use the underlying data
- // first, then fall back to trying to convert them to a uint8 slice.
- var buf []uint8
- doConvert := false
- doHexDump := false
- numEntries := v.Len()
- if numEntries > 0 {
- vt := v.Index(0).Type()
- vts := vt.String()
- switch {
- // C types that need to be converted.
- case cCharRE.MatchString(vts):
- fallthrough
- case cUnsignedCharRE.MatchString(vts):
- fallthrough
- case cUint8tCharRE.MatchString(vts):
- doConvert = true
-
- // Try to use existing uint8 slices and fall back to converting
- // and copying if that fails.
- case vt.Kind() == reflect.Uint8:
- // We need an addressable interface to convert the type
- // to a byte slice. However, the reflect package won't
- // give us an interface on certain things like
- // unexported struct fields in order to enforce
- // visibility rules. We use unsafe, when available, to
- // bypass these restrictions since this package does not
- // mutate the values.
- vs := v
- if !vs.CanInterface() || !vs.CanAddr() {
- vs = unsafeReflectValue(vs)
- }
- if !UnsafeDisabled {
- vs = vs.Slice(0, numEntries)
-
- // Use the existing uint8 slice if it can be
- // type asserted.
- iface := vs.Interface()
- if slice, ok := iface.([]uint8); ok {
- buf = slice
- doHexDump = true
- break
- }
- }
-
- // The underlying data needs to be converted if it can't
- // be type asserted to a uint8 slice.
- doConvert = true
- }
-
- // Copy and convert the underlying type if needed.
- if doConvert && vt.ConvertibleTo(uint8Type) {
- // Convert and copy each element into a uint8 byte
- // slice.
- buf = make([]uint8, numEntries)
- for i := 0; i < numEntries; i++ {
- vv := v.Index(i)
- buf[i] = uint8(vv.Convert(uint8Type).Uint())
- }
- doHexDump = true
- }
- }
-
- // Hexdump the entire slice as needed.
- if doHexDump {
- indent := strings.Repeat(d.cs.Indent, d.depth)
- str := indent + hex.Dump(buf)
- str = strings.Replace(str, "\n", "\n"+indent, -1)
- str = strings.TrimRight(str, d.cs.Indent)
- d.w.Write([]byte(str))
- return
- }
-
- // Recursively call dump for each item.
- for i := 0; i < numEntries; i++ {
- d.dump(d.unpackValue(v.Index(i)))
- if i < (numEntries - 1) {
- d.w.Write(commaNewlineBytes)
- } else {
- d.w.Write(newlineBytes)
- }
- }
-}
-
-// dump is the main workhorse for dumping a value. It uses the passed reflect
-// value to figure out what kind of object we are dealing with and formats it
-// appropriately. It is a recursive function, however circular data structures
-// are detected and handled properly.
-func (d *dumpState) dump(v reflect.Value) {
- // Handle invalid reflect values immediately.
- kind := v.Kind()
- if kind == reflect.Invalid {
- d.w.Write(invalidAngleBytes)
- return
- }
-
- // Handle pointers specially.
- if kind == reflect.Ptr {
- d.indent()
- d.dumpPtr(v)
- return
- }
-
- // Print type information unless already handled elsewhere.
- if !d.ignoreNextType {
- d.indent()
- d.w.Write(openParenBytes)
- d.w.Write([]byte(v.Type().String()))
- d.w.Write(closeParenBytes)
- d.w.Write(spaceBytes)
- }
- d.ignoreNextType = false
-
- // Display length and capacity if the built-in len and cap functions
- // work with the value's kind and the len/cap itself is non-zero.
- valueLen, valueCap := 0, 0
- switch v.Kind() {
- case reflect.Array, reflect.Slice, reflect.Chan:
- valueLen, valueCap = v.Len(), v.Cap()
- case reflect.Map, reflect.String:
- valueLen = v.Len()
- }
- if valueLen != 0 || !d.cs.DisableCapacities && valueCap != 0 {
- d.w.Write(openParenBytes)
- if valueLen != 0 {
- d.w.Write(lenEqualsBytes)
- printInt(d.w, int64(valueLen), 10)
- }
- if !d.cs.DisableCapacities && valueCap != 0 {
- if valueLen != 0 {
- d.w.Write(spaceBytes)
- }
- d.w.Write(capEqualsBytes)
- printInt(d.w, int64(valueCap), 10)
- }
- d.w.Write(closeParenBytes)
- d.w.Write(spaceBytes)
- }
-
- // Call Stringer/error interfaces if they exist and the handle methods flag
- // is enabled
- if !d.cs.DisableMethods {
- if (kind != reflect.Invalid) && (kind != reflect.Interface) {
- if handled := handleMethods(d.cs, d.w, v); handled {
- return
- }
- }
- }
-
- switch kind {
- case reflect.Invalid:
- // Do nothing. We should never get here since invalid has already
- // been handled above.
-
- case reflect.Bool:
- printBool(d.w, v.Bool())
-
- case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
- printInt(d.w, v.Int(), 10)
-
- case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
- printUint(d.w, v.Uint(), 10)
-
- case reflect.Float32:
- printFloat(d.w, v.Float(), 32)
-
- case reflect.Float64:
- printFloat(d.w, v.Float(), 64)
-
- case reflect.Complex64:
- printComplex(d.w, v.Complex(), 32)
-
- case reflect.Complex128:
- printComplex(d.w, v.Complex(), 64)
-
- case reflect.Slice:
- if v.IsNil() {
- d.w.Write(nilAngleBytes)
- break
- }
- fallthrough
-
- case reflect.Array:
- d.w.Write(openBraceNewlineBytes)
- d.depth++
- if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {
- d.indent()
- d.w.Write(maxNewlineBytes)
- } else {
- d.dumpSlice(v)
- }
- d.depth--
- d.indent()
- d.w.Write(closeBraceBytes)
-
- case reflect.String:
- d.w.Write([]byte(strconv.Quote(v.String())))
-
- case reflect.Interface:
- // The only time we should get here is for nil interfaces due to
- // unpackValue calls.
- if v.IsNil() {
- d.w.Write(nilAngleBytes)
- }
-
- case reflect.Ptr:
- // Do nothing. We should never get here since pointers have already
- // been handled above.
-
- case reflect.Map:
- // nil maps should be indicated as different than empty maps
- if v.IsNil() {
- d.w.Write(nilAngleBytes)
- break
- }
-
- d.w.Write(openBraceNewlineBytes)
- d.depth++
- if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {
- d.indent()
- d.w.Write(maxNewlineBytes)
- } else {
- numEntries := v.Len()
- keys := v.MapKeys()
- if d.cs.SortKeys {
- sortValues(keys, d.cs)
- }
- for i, key := range keys {
- d.dump(d.unpackValue(key))
- d.w.Write(colonSpaceBytes)
- d.ignoreNextIndent = true
- d.dump(d.unpackValue(v.MapIndex(key)))
- if i < (numEntries - 1) {
- d.w.Write(commaNewlineBytes)
- } else {
- d.w.Write(newlineBytes)
- }
- }
- }
- d.depth--
- d.indent()
- d.w.Write(closeBraceBytes)
-
- case reflect.Struct:
- d.w.Write(openBraceNewlineBytes)
- d.depth++
- if (d.cs.MaxDepth != 0) && (d.depth > d.cs.MaxDepth) {
- d.indent()
- d.w.Write(maxNewlineBytes)
- } else {
- vt := v.Type()
- numFields := v.NumField()
- for i := 0; i < numFields; i++ {
- d.indent()
- vtf := vt.Field(i)
- d.w.Write([]byte(vtf.Name))
- d.w.Write(colonSpaceBytes)
- d.ignoreNextIndent = true
- d.dump(d.unpackValue(v.Field(i)))
- if i < (numFields - 1) {
- d.w.Write(commaNewlineBytes)
- } else {
- d.w.Write(newlineBytes)
- }
- }
- }
- d.depth--
- d.indent()
- d.w.Write(closeBraceBytes)
-
- case reflect.Uintptr:
- printHexPtr(d.w, uintptr(v.Uint()))
-
- case reflect.UnsafePointer, reflect.Chan, reflect.Func:
- printHexPtr(d.w, v.Pointer())
-
- // There were not any other types at the time this code was written, but
- // fall back to letting the default fmt package handle it in case any new
- // types are added.
- default:
- if v.CanInterface() {
- fmt.Fprintf(d.w, "%v", v.Interface())
- } else {
- fmt.Fprintf(d.w, "%v", v.String())
- }
- }
-}
-
-// fdump is a helper function to consolidate the logic from the various public
-// methods which take varying writers and config states.
-func fdump(cs *ConfigState, w io.Writer, a ...interface{}) {
- for _, arg := range a {
- if arg == nil {
- w.Write(interfaceBytes)
- w.Write(spaceBytes)
- w.Write(nilAngleBytes)
- w.Write(newlineBytes)
- continue
- }
-
- d := dumpState{w: w, cs: cs}
- d.pointers = make(map[uintptr]int)
- d.dump(reflect.ValueOf(arg))
- d.w.Write(newlineBytes)
- }
-}
-
-// Fdump formats and displays the passed arguments to io.Writer w. It formats
-// exactly the same as Dump.
-func Fdump(w io.Writer, a ...interface{}) {
- fdump(&Config, w, a...)
-}
-
-// Sdump returns a string with the passed arguments formatted exactly the same
-// as Dump.
-func Sdump(a ...interface{}) string {
- var buf bytes.Buffer
- fdump(&Config, &buf, a...)
- return buf.String()
-}
-
-/*
-Dump displays the passed parameters to standard out with newlines, customizable
-indentation, and additional debug information such as complete types and all
-pointer addresses used to indirect to the final value. It provides the
-following features over the built-in printing facilities provided by the fmt
-package:
-
- * Pointers are dereferenced and followed
- * Circular data structures are detected and handled properly
- * Custom Stringer/error interfaces are optionally invoked, including
- on unexported types
- * Custom types which only implement the Stringer/error interfaces via
- a pointer receiver are optionally invoked when passing non-pointer
- variables
- * Byte arrays and slices are dumped like the hexdump -C command which
- includes offsets, byte values in hex, and ASCII output
-
-The configuration options are controlled by an exported package global,
-spew.Config. See ConfigState for options documentation.
-
-See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to
-get the formatted result as a string.
-*/
-func Dump(a ...interface{}) {
- fdump(&Config, os.Stdout, a...)
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/format.go b/vendor/github.com/davecgh/go-spew/spew/format.go
deleted file mode 100644
index b04edb7d7ac278ae0b873a1335f37822a00bfd7c..0000000000000000000000000000000000000000
--- a/vendor/github.com/davecgh/go-spew/spew/format.go
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "strconv"
- "strings"
-)
-
-// supportedFlags is a list of all the character flags supported by fmt package.
-const supportedFlags = "0-+# "
-
-// formatState implements the fmt.Formatter interface and contains information
-// about the state of a formatting operation. The NewFormatter function can
-// be used to get a new Formatter which can be used directly as arguments
-// in standard fmt package printing calls.
-type formatState struct {
- value interface{}
- fs fmt.State
- depth int
- pointers map[uintptr]int
- ignoreNextType bool
- cs *ConfigState
-}
-
-// buildDefaultFormat recreates the original format string without precision
-// and width information to pass in to fmt.Sprintf in the case of an
-// unrecognized type. Unless new types are added to the language, this
-// function won't ever be called.
-func (f *formatState) buildDefaultFormat() (format string) {
- buf := bytes.NewBuffer(percentBytes)
-
- for _, flag := range supportedFlags {
- if f.fs.Flag(int(flag)) {
- buf.WriteRune(flag)
- }
- }
-
- buf.WriteRune('v')
-
- format = buf.String()
- return format
-}
-
-// constructOrigFormat recreates the original format string including precision
-// and width information to pass along to the standard fmt package. This allows
-// automatic deferral of all format strings this package doesn't support.
-func (f *formatState) constructOrigFormat(verb rune) (format string) {
- buf := bytes.NewBuffer(percentBytes)
-
- for _, flag := range supportedFlags {
- if f.fs.Flag(int(flag)) {
- buf.WriteRune(flag)
- }
- }
-
- if width, ok := f.fs.Width(); ok {
- buf.WriteString(strconv.Itoa(width))
- }
-
- if precision, ok := f.fs.Precision(); ok {
- buf.Write(precisionBytes)
- buf.WriteString(strconv.Itoa(precision))
- }
-
- buf.WriteRune(verb)
-
- format = buf.String()
- return format
-}
-
-// unpackValue returns values inside of non-nil interfaces when possible and
-// ensures that types for values which have been unpacked from an interface
-// are displayed when the show types flag is also set.
-// This is useful for data types like structs, arrays, slices, and maps which
-// can contain varying types packed inside an interface.
-func (f *formatState) unpackValue(v reflect.Value) reflect.Value {
- if v.Kind() == reflect.Interface {
- f.ignoreNextType = false
- if !v.IsNil() {
- v = v.Elem()
- }
- }
- return v
-}
-
-// formatPtr handles formatting of pointers by indirecting them as necessary.
-func (f *formatState) formatPtr(v reflect.Value) {
- // Display nil if top level pointer is nil.
- showTypes := f.fs.Flag('#')
- if v.IsNil() && (!showTypes || f.ignoreNextType) {
- f.fs.Write(nilAngleBytes)
- return
- }
-
- // Remove pointers at or below the current depth from map used to detect
- // circular refs.
- for k, depth := range f.pointers {
- if depth >= f.depth {
- delete(f.pointers, k)
- }
- }
-
- // Keep list of all dereferenced pointers to possibly show later.
- pointerChain := make([]uintptr, 0)
-
- // Figure out how many levels of indirection there are by derferencing
- // pointers and unpacking interfaces down the chain while detecting circular
- // references.
- nilFound := false
- cycleFound := false
- indirects := 0
- ve := v
- for ve.Kind() == reflect.Ptr {
- if ve.IsNil() {
- nilFound = true
- break
- }
- indirects++
- addr := ve.Pointer()
- pointerChain = append(pointerChain, addr)
- if pd, ok := f.pointers[addr]; ok && pd < f.depth {
- cycleFound = true
- indirects--
- break
- }
- f.pointers[addr] = f.depth
-
- ve = ve.Elem()
- if ve.Kind() == reflect.Interface {
- if ve.IsNil() {
- nilFound = true
- break
- }
- ve = ve.Elem()
- }
- }
-
- // Display type or indirection level depending on flags.
- if showTypes && !f.ignoreNextType {
- f.fs.Write(openParenBytes)
- f.fs.Write(bytes.Repeat(asteriskBytes, indirects))
- f.fs.Write([]byte(ve.Type().String()))
- f.fs.Write(closeParenBytes)
- } else {
- if nilFound || cycleFound {
- indirects += strings.Count(ve.Type().String(), "*")
- }
- f.fs.Write(openAngleBytes)
- f.fs.Write([]byte(strings.Repeat("*", indirects)))
- f.fs.Write(closeAngleBytes)
- }
-
- // Display pointer information depending on flags.
- if f.fs.Flag('+') && (len(pointerChain) > 0) {
- f.fs.Write(openParenBytes)
- for i, addr := range pointerChain {
- if i > 0 {
- f.fs.Write(pointerChainBytes)
- }
- printHexPtr(f.fs, addr)
- }
- f.fs.Write(closeParenBytes)
- }
-
- // Display dereferenced value.
- switch {
- case nilFound:
- f.fs.Write(nilAngleBytes)
-
- case cycleFound:
- f.fs.Write(circularShortBytes)
-
- default:
- f.ignoreNextType = true
- f.format(ve)
- }
-}
-
-// format is the main workhorse for providing the Formatter interface. It
-// uses the passed reflect value to figure out what kind of object we are
-// dealing with and formats it appropriately. It is a recursive function,
-// however circular data structures are detected and handled properly.
-func (f *formatState) format(v reflect.Value) {
- // Handle invalid reflect values immediately.
- kind := v.Kind()
- if kind == reflect.Invalid {
- f.fs.Write(invalidAngleBytes)
- return
- }
-
- // Handle pointers specially.
- if kind == reflect.Ptr {
- f.formatPtr(v)
- return
- }
-
- // Print type information unless already handled elsewhere.
- if !f.ignoreNextType && f.fs.Flag('#') {
- f.fs.Write(openParenBytes)
- f.fs.Write([]byte(v.Type().String()))
- f.fs.Write(closeParenBytes)
- }
- f.ignoreNextType = false
-
- // Call Stringer/error interfaces if they exist and the handle methods
- // flag is enabled.
- if !f.cs.DisableMethods {
- if (kind != reflect.Invalid) && (kind != reflect.Interface) {
- if handled := handleMethods(f.cs, f.fs, v); handled {
- return
- }
- }
- }
-
- switch kind {
- case reflect.Invalid:
- // Do nothing. We should never get here since invalid has already
- // been handled above.
-
- case reflect.Bool:
- printBool(f.fs, v.Bool())
-
- case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
- printInt(f.fs, v.Int(), 10)
-
- case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
- printUint(f.fs, v.Uint(), 10)
-
- case reflect.Float32:
- printFloat(f.fs, v.Float(), 32)
-
- case reflect.Float64:
- printFloat(f.fs, v.Float(), 64)
-
- case reflect.Complex64:
- printComplex(f.fs, v.Complex(), 32)
-
- case reflect.Complex128:
- printComplex(f.fs, v.Complex(), 64)
-
- case reflect.Slice:
- if v.IsNil() {
- f.fs.Write(nilAngleBytes)
- break
- }
- fallthrough
-
- case reflect.Array:
- f.fs.Write(openBracketBytes)
- f.depth++
- if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {
- f.fs.Write(maxShortBytes)
- } else {
- numEntries := v.Len()
- for i := 0; i < numEntries; i++ {
- if i > 0 {
- f.fs.Write(spaceBytes)
- }
- f.ignoreNextType = true
- f.format(f.unpackValue(v.Index(i)))
- }
- }
- f.depth--
- f.fs.Write(closeBracketBytes)
-
- case reflect.String:
- f.fs.Write([]byte(v.String()))
-
- case reflect.Interface:
- // The only time we should get here is for nil interfaces due to
- // unpackValue calls.
- if v.IsNil() {
- f.fs.Write(nilAngleBytes)
- }
-
- case reflect.Ptr:
- // Do nothing. We should never get here since pointers have already
- // been handled above.
-
- case reflect.Map:
- // nil maps should be indicated as different than empty maps
- if v.IsNil() {
- f.fs.Write(nilAngleBytes)
- break
- }
-
- f.fs.Write(openMapBytes)
- f.depth++
- if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {
- f.fs.Write(maxShortBytes)
- } else {
- keys := v.MapKeys()
- if f.cs.SortKeys {
- sortValues(keys, f.cs)
- }
- for i, key := range keys {
- if i > 0 {
- f.fs.Write(spaceBytes)
- }
- f.ignoreNextType = true
- f.format(f.unpackValue(key))
- f.fs.Write(colonBytes)
- f.ignoreNextType = true
- f.format(f.unpackValue(v.MapIndex(key)))
- }
- }
- f.depth--
- f.fs.Write(closeMapBytes)
-
- case reflect.Struct:
- numFields := v.NumField()
- f.fs.Write(openBraceBytes)
- f.depth++
- if (f.cs.MaxDepth != 0) && (f.depth > f.cs.MaxDepth) {
- f.fs.Write(maxShortBytes)
- } else {
- vt := v.Type()
- for i := 0; i < numFields; i++ {
- if i > 0 {
- f.fs.Write(spaceBytes)
- }
- vtf := vt.Field(i)
- if f.fs.Flag('+') || f.fs.Flag('#') {
- f.fs.Write([]byte(vtf.Name))
- f.fs.Write(colonBytes)
- }
- f.format(f.unpackValue(v.Field(i)))
- }
- }
- f.depth--
- f.fs.Write(closeBraceBytes)
-
- case reflect.Uintptr:
- printHexPtr(f.fs, uintptr(v.Uint()))
-
- case reflect.UnsafePointer, reflect.Chan, reflect.Func:
- printHexPtr(f.fs, v.Pointer())
-
- // There were not any other types at the time this code was written, but
- // fall back to letting the default fmt package handle it if any get added.
- default:
- format := f.buildDefaultFormat()
- if v.CanInterface() {
- fmt.Fprintf(f.fs, format, v.Interface())
- } else {
- fmt.Fprintf(f.fs, format, v.String())
- }
- }
-}
-
-// Format satisfies the fmt.Formatter interface. See NewFormatter for usage
-// details.
-func (f *formatState) Format(fs fmt.State, verb rune) {
- f.fs = fs
-
- // Use standard formatting for verbs that are not v.
- if verb != 'v' {
- format := f.constructOrigFormat(verb)
- fmt.Fprintf(fs, format, f.value)
- return
- }
-
- if f.value == nil {
- if fs.Flag('#') {
- fs.Write(interfaceBytes)
- }
- fs.Write(nilAngleBytes)
- return
- }
-
- f.format(reflect.ValueOf(f.value))
-}
-
-// newFormatter is a helper function to consolidate the logic from the various
-// public methods which take varying config states.
-func newFormatter(cs *ConfigState, v interface{}) fmt.Formatter {
- fs := &formatState{value: v, cs: cs}
- fs.pointers = make(map[uintptr]int)
- return fs
-}
-
-/*
-NewFormatter returns a custom formatter that satisfies the fmt.Formatter
-interface. As a result, it integrates cleanly with standard fmt package
-printing functions. The formatter is useful for inline printing of smaller data
-types similar to the standard %v format specifier.
-
-The custom formatter only responds to the %v (most compact), %+v (adds pointer
-addresses), %#v (adds types), or %#+v (adds types and pointer addresses) verb
-combinations. Any other verbs such as %x and %q will be sent to the the
-standard fmt package for formatting. In addition, the custom formatter ignores
-the width and precision arguments (however they will still work on the format
-specifiers not handled by the custom formatter).
-
-Typically this function shouldn't be called directly. It is much easier to make
-use of the custom formatter by calling one of the convenience functions such as
-Printf, Println, or Fprintf.
-*/
-func NewFormatter(v interface{}) fmt.Formatter {
- return newFormatter(&Config, v)
-}
diff --git a/vendor/github.com/davecgh/go-spew/spew/spew.go b/vendor/github.com/davecgh/go-spew/spew/spew.go
deleted file mode 100644
index 32c0e338825308f6b9b4d0407aa5682a23e2dc9c..0000000000000000000000000000000000000000
--- a/vendor/github.com/davecgh/go-spew/spew/spew.go
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-package spew
-
-import (
- "fmt"
- "io"
-)
-
-// Errorf is a wrapper for fmt.Errorf that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the formatted string as a value that satisfies error. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Errorf(format, spew.NewFormatter(a), spew.NewFormatter(b))
-func Errorf(format string, a ...interface{}) (err error) {
- return fmt.Errorf(format, convertArgs(a)...)
-}
-
-// Fprint is a wrapper for fmt.Fprint that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Fprint(w, spew.NewFormatter(a), spew.NewFormatter(b))
-func Fprint(w io.Writer, a ...interface{}) (n int, err error) {
- return fmt.Fprint(w, convertArgs(a)...)
-}
-
-// Fprintf is a wrapper for fmt.Fprintf that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Fprintf(w, format, spew.NewFormatter(a), spew.NewFormatter(b))
-func Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
- return fmt.Fprintf(w, format, convertArgs(a)...)
-}
-
-// Fprintln is a wrapper for fmt.Fprintln that treats each argument as if it
-// passed with a default Formatter interface returned by NewFormatter. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Fprintln(w, spew.NewFormatter(a), spew.NewFormatter(b))
-func Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
- return fmt.Fprintln(w, convertArgs(a)...)
-}
-
-// Print is a wrapper for fmt.Print that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Print(spew.NewFormatter(a), spew.NewFormatter(b))
-func Print(a ...interface{}) (n int, err error) {
- return fmt.Print(convertArgs(a)...)
-}
-
-// Printf is a wrapper for fmt.Printf that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Printf(format, spew.NewFormatter(a), spew.NewFormatter(b))
-func Printf(format string, a ...interface{}) (n int, err error) {
- return fmt.Printf(format, convertArgs(a)...)
-}
-
-// Println is a wrapper for fmt.Println that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the number of bytes written and any write error encountered. See
-// NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Println(spew.NewFormatter(a), spew.NewFormatter(b))
-func Println(a ...interface{}) (n int, err error) {
- return fmt.Println(convertArgs(a)...)
-}
-
-// Sprint is a wrapper for fmt.Sprint that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the resulting string. See NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Sprint(spew.NewFormatter(a), spew.NewFormatter(b))
-func Sprint(a ...interface{}) string {
- return fmt.Sprint(convertArgs(a)...)
-}
-
-// Sprintf is a wrapper for fmt.Sprintf that treats each argument as if it were
-// passed with a default Formatter interface returned by NewFormatter. It
-// returns the resulting string. See NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Sprintf(format, spew.NewFormatter(a), spew.NewFormatter(b))
-func Sprintf(format string, a ...interface{}) string {
- return fmt.Sprintf(format, convertArgs(a)...)
-}
-
-// Sprintln is a wrapper for fmt.Sprintln that treats each argument as if it
-// were passed with a default Formatter interface returned by NewFormatter. It
-// returns the resulting string. See NewFormatter for formatting details.
-//
-// This function is shorthand for the following syntax:
-//
-// fmt.Sprintln(spew.NewFormatter(a), spew.NewFormatter(b))
-func Sprintln(a ...interface{}) string {
- return fmt.Sprintln(convertArgs(a)...)
-}
-
-// convertArgs accepts a slice of arguments and returns a slice of the same
-// length with each argument converted to a default spew Formatter interface.
-func convertArgs(args []interface{}) (formatters []interface{}) {
- formatters = make([]interface{}, len(args))
- for index, arg := range args {
- formatters[index] = NewFormatter(arg)
- }
- return formatters
-}
diff --git a/vendor/github.com/dustin/go-humanize/.travis.yml b/vendor/github.com/dustin/go-humanize/.travis.yml
deleted file mode 100644
index ba95cdd15c3112a80bf448a0f2fd491a48b30b03..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/.travis.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-sudo: false
-language: go
-go:
- - 1.3.x
- - 1.5.x
- - 1.6.x
- - 1.7.x
- - 1.8.x
- - 1.9.x
- - master
-matrix:
- allow_failures:
- - go: master
- fast_finish: true
-install:
- - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step).
-script:
- - go get -t -v ./...
- - diff -u <(echo -n) <(gofmt -d -s .)
- - go tool vet .
- - go test -v -race ./...
diff --git a/vendor/github.com/dustin/go-humanize/LICENSE b/vendor/github.com/dustin/go-humanize/LICENSE
deleted file mode 100644
index 8d9a94a90680d9fc114a1b3a2b4123c233c324af..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-Copyright (c) 2005-2008 Dustin Sallings
-
-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/dustin/go-humanize/README.markdown b/vendor/github.com/dustin/go-humanize/README.markdown
deleted file mode 100644
index 91b4ae56464b6ab79556c8869da84273a252656a..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/README.markdown
+++ /dev/null
@@ -1,124 +0,0 @@
-# Humane Units [](https://travis-ci.org/dustin/go-humanize) [](https://godoc.org/github.com/dustin/go-humanize)
-
-Just a few functions for helping humanize times and sizes.
-
-`go get` it as `github.com/dustin/go-humanize`, import it as
-`"github.com/dustin/go-humanize"`, use it as `humanize`.
-
-See [godoc](https://godoc.org/github.com/dustin/go-humanize) for
-complete documentation.
-
-## Sizes
-
-This lets you take numbers like `82854982` and convert them to useful
-strings like, `83 MB` or `79 MiB` (whichever you prefer).
-
-Example:
-
-```go
-fmt.Printf("That file is %s.", humanize.Bytes(82854982)) // That file is 83 MB.
-```
-
-## Times
-
-This lets you take a `time.Time` and spit it out in relative terms.
-For example, `12 seconds ago` or `3 days from now`.
-
-Example:
-
-```go
-fmt.Printf("This was touched %s.", humanize.Time(someTimeInstance)) // This was touched 7 hours ago.
-```
-
-Thanks to Kyle Lemons for the time implementation from an IRC
-conversation one day. It's pretty neat.
-
-## Ordinals
-
-From a [mailing list discussion][odisc] where a user wanted to be able
-to label ordinals.
-
- 0 -> 0th
- 1 -> 1st
- 2 -> 2nd
- 3 -> 3rd
- 4 -> 4th
- [...]
-
-Example:
-
-```go
-fmt.Printf("You're my %s best friend.", humanize.Ordinal(193)) // You are my 193rd best friend.
-```
-
-## Commas
-
-Want to shove commas into numbers? Be my guest.
-
- 0 -> 0
- 100 -> 100
- 1000 -> 1,000
- 1000000000 -> 1,000,000,000
- -100000 -> -100,000
-
-Example:
-
-```go
-fmt.Printf("You owe $%s.\n", humanize.Comma(6582491)) // You owe $6,582,491.
-```
-
-## Ftoa
-
-Nicer float64 formatter that removes trailing zeros.
-
-```go
-fmt.Printf("%f", 2.24) // 2.240000
-fmt.Printf("%s", humanize.Ftoa(2.24)) // 2.24
-fmt.Printf("%f", 2.0) // 2.000000
-fmt.Printf("%s", humanize.Ftoa(2.0)) // 2
-```
-
-## SI notation
-
-Format numbers with [SI notation][sinotation].
-
-Example:
-
-```go
-humanize.SI(0.00000000223, "M") // 2.23 nM
-```
-
-## English-specific functions
-
-The following functions are in the `humanize/english` subpackage.
-
-### Plurals
-
-Simple English pluralization
-
-```go
-english.PluralWord(1, "object", "") // object
-english.PluralWord(42, "object", "") // objects
-english.PluralWord(2, "bus", "") // buses
-english.PluralWord(99, "locus", "loci") // loci
-
-english.Plural(1, "object", "") // 1 object
-english.Plural(42, "object", "") // 42 objects
-english.Plural(2, "bus", "") // 2 buses
-english.Plural(99, "locus", "loci") // 99 loci
-```
-
-### Word series
-
-Format comma-separated words lists with conjuctions:
-
-```go
-english.WordSeries([]string{"foo"}, "and") // foo
-english.WordSeries([]string{"foo", "bar"}, "and") // foo and bar
-english.WordSeries([]string{"foo", "bar", "baz"}, "and") // foo, bar and baz
-
-english.OxfordWordSeries([]string{"foo", "bar", "baz"}, "and") // foo, bar, and baz
-```
-
-[odisc]: https://groups.google.com/d/topic/golang-nuts/l8NhI74jl-4/discussion
-[sinotation]: http://en.wikipedia.org/wiki/Metric_prefix
diff --git a/vendor/github.com/dustin/go-humanize/big.go b/vendor/github.com/dustin/go-humanize/big.go
deleted file mode 100644
index f49dc337dcd7318c6e827b81b5020a5715c41bfd..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/big.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package humanize
-
-import (
- "math/big"
-)
-
-// order of magnitude (to a max order)
-func oomm(n, b *big.Int, maxmag int) (float64, int) {
- mag := 0
- m := &big.Int{}
- for n.Cmp(b) >= 0 {
- n.DivMod(n, b, m)
- mag++
- if mag == maxmag && maxmag >= 0 {
- break
- }
- }
- return float64(n.Int64()) + (float64(m.Int64()) / float64(b.Int64())), mag
-}
-
-// total order of magnitude
-// (same as above, but with no upper limit)
-func oom(n, b *big.Int) (float64, int) {
- mag := 0
- m := &big.Int{}
- for n.Cmp(b) >= 0 {
- n.DivMod(n, b, m)
- mag++
- }
- return float64(n.Int64()) + (float64(m.Int64()) / float64(b.Int64())), mag
-}
diff --git a/vendor/github.com/dustin/go-humanize/bigbytes.go b/vendor/github.com/dustin/go-humanize/bigbytes.go
deleted file mode 100644
index 1a2bf61723922c0a199af8c6134be7e801b7edad..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/bigbytes.go
+++ /dev/null
@@ -1,173 +0,0 @@
-package humanize
-
-import (
- "fmt"
- "math/big"
- "strings"
- "unicode"
-)
-
-var (
- bigIECExp = big.NewInt(1024)
-
- // BigByte is one byte in bit.Ints
- BigByte = big.NewInt(1)
- // BigKiByte is 1,024 bytes in bit.Ints
- BigKiByte = (&big.Int{}).Mul(BigByte, bigIECExp)
- // BigMiByte is 1,024 k bytes in bit.Ints
- BigMiByte = (&big.Int{}).Mul(BigKiByte, bigIECExp)
- // BigGiByte is 1,024 m bytes in bit.Ints
- BigGiByte = (&big.Int{}).Mul(BigMiByte, bigIECExp)
- // BigTiByte is 1,024 g bytes in bit.Ints
- BigTiByte = (&big.Int{}).Mul(BigGiByte, bigIECExp)
- // BigPiByte is 1,024 t bytes in bit.Ints
- BigPiByte = (&big.Int{}).Mul(BigTiByte, bigIECExp)
- // BigEiByte is 1,024 p bytes in bit.Ints
- BigEiByte = (&big.Int{}).Mul(BigPiByte, bigIECExp)
- // BigZiByte is 1,024 e bytes in bit.Ints
- BigZiByte = (&big.Int{}).Mul(BigEiByte, bigIECExp)
- // BigYiByte is 1,024 z bytes in bit.Ints
- BigYiByte = (&big.Int{}).Mul(BigZiByte, bigIECExp)
-)
-
-var (
- bigSIExp = big.NewInt(1000)
-
- // BigSIByte is one SI byte in big.Ints
- BigSIByte = big.NewInt(1)
- // BigKByte is 1,000 SI bytes in big.Ints
- BigKByte = (&big.Int{}).Mul(BigSIByte, bigSIExp)
- // BigMByte is 1,000 SI k bytes in big.Ints
- BigMByte = (&big.Int{}).Mul(BigKByte, bigSIExp)
- // BigGByte is 1,000 SI m bytes in big.Ints
- BigGByte = (&big.Int{}).Mul(BigMByte, bigSIExp)
- // BigTByte is 1,000 SI g bytes in big.Ints
- BigTByte = (&big.Int{}).Mul(BigGByte, bigSIExp)
- // BigPByte is 1,000 SI t bytes in big.Ints
- BigPByte = (&big.Int{}).Mul(BigTByte, bigSIExp)
- // BigEByte is 1,000 SI p bytes in big.Ints
- BigEByte = (&big.Int{}).Mul(BigPByte, bigSIExp)
- // BigZByte is 1,000 SI e bytes in big.Ints
- BigZByte = (&big.Int{}).Mul(BigEByte, bigSIExp)
- // BigYByte is 1,000 SI z bytes in big.Ints
- BigYByte = (&big.Int{}).Mul(BigZByte, bigSIExp)
-)
-
-var bigBytesSizeTable = map[string]*big.Int{
- "b": BigByte,
- "kib": BigKiByte,
- "kb": BigKByte,
- "mib": BigMiByte,
- "mb": BigMByte,
- "gib": BigGiByte,
- "gb": BigGByte,
- "tib": BigTiByte,
- "tb": BigTByte,
- "pib": BigPiByte,
- "pb": BigPByte,
- "eib": BigEiByte,
- "eb": BigEByte,
- "zib": BigZiByte,
- "zb": BigZByte,
- "yib": BigYiByte,
- "yb": BigYByte,
- // Without suffix
- "": BigByte,
- "ki": BigKiByte,
- "k": BigKByte,
- "mi": BigMiByte,
- "m": BigMByte,
- "gi": BigGiByte,
- "g": BigGByte,
- "ti": BigTiByte,
- "t": BigTByte,
- "pi": BigPiByte,
- "p": BigPByte,
- "ei": BigEiByte,
- "e": BigEByte,
- "z": BigZByte,
- "zi": BigZiByte,
- "y": BigYByte,
- "yi": BigYiByte,
-}
-
-var ten = big.NewInt(10)
-
-func humanateBigBytes(s, base *big.Int, sizes []string) string {
- if s.Cmp(ten) < 0 {
- return fmt.Sprintf("%d B", s)
- }
- c := (&big.Int{}).Set(s)
- val, mag := oomm(c, base, len(sizes)-1)
- suffix := sizes[mag]
- f := "%.0f %s"
- if val < 10 {
- f = "%.1f %s"
- }
-
- return fmt.Sprintf(f, val, suffix)
-
-}
-
-// BigBytes produces a human readable representation of an SI size.
-//
-// See also: ParseBigBytes.
-//
-// BigBytes(82854982) -> 83 MB
-func BigBytes(s *big.Int) string {
- sizes := []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"}
- return humanateBigBytes(s, bigSIExp, sizes)
-}
-
-// BigIBytes produces a human readable representation of an IEC size.
-//
-// See also: ParseBigBytes.
-//
-// BigIBytes(82854982) -> 79 MiB
-func BigIBytes(s *big.Int) string {
- sizes := []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"}
- return humanateBigBytes(s, bigIECExp, sizes)
-}
-
-// ParseBigBytes parses a string representation of bytes into the number
-// of bytes it represents.
-//
-// See also: BigBytes, BigIBytes.
-//
-// ParseBigBytes("42 MB") -> 42000000, nil
-// ParseBigBytes("42 mib") -> 44040192, nil
-func ParseBigBytes(s string) (*big.Int, error) {
- lastDigit := 0
- hasComma := false
- for _, r := range s {
- if !(unicode.IsDigit(r) || r == '.' || r == ',') {
- break
- }
- if r == ',' {
- hasComma = true
- }
- lastDigit++
- }
-
- num := s[:lastDigit]
- if hasComma {
- num = strings.Replace(num, ",", "", -1)
- }
-
- val := &big.Rat{}
- _, err := fmt.Sscanf(num, "%f", val)
- if err != nil {
- return nil, err
- }
-
- extra := strings.ToLower(strings.TrimSpace(s[lastDigit:]))
- if m, ok := bigBytesSizeTable[extra]; ok {
- mv := (&big.Rat{}).SetInt(m)
- val.Mul(val, mv)
- rv := &big.Int{}
- rv.Div(val.Num(), val.Denom())
- return rv, nil
- }
-
- return nil, fmt.Errorf("unhandled size name: %v", extra)
-}
diff --git a/vendor/github.com/dustin/go-humanize/bytes.go b/vendor/github.com/dustin/go-humanize/bytes.go
deleted file mode 100644
index 0b498f4885c5940951fce0befc9a0881e6224ed4..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/bytes.go
+++ /dev/null
@@ -1,143 +0,0 @@
-package humanize
-
-import (
- "fmt"
- "math"
- "strconv"
- "strings"
- "unicode"
-)
-
-// IEC Sizes.
-// kibis of bits
-const (
- Byte = 1 << (iota * 10)
- KiByte
- MiByte
- GiByte
- TiByte
- PiByte
- EiByte
-)
-
-// SI Sizes.
-const (
- IByte = 1
- KByte = IByte * 1000
- MByte = KByte * 1000
- GByte = MByte * 1000
- TByte = GByte * 1000
- PByte = TByte * 1000
- EByte = PByte * 1000
-)
-
-var bytesSizeTable = map[string]uint64{
- "b": Byte,
- "kib": KiByte,
- "kb": KByte,
- "mib": MiByte,
- "mb": MByte,
- "gib": GiByte,
- "gb": GByte,
- "tib": TiByte,
- "tb": TByte,
- "pib": PiByte,
- "pb": PByte,
- "eib": EiByte,
- "eb": EByte,
- // Without suffix
- "": Byte,
- "ki": KiByte,
- "k": KByte,
- "mi": MiByte,
- "m": MByte,
- "gi": GiByte,
- "g": GByte,
- "ti": TiByte,
- "t": TByte,
- "pi": PiByte,
- "p": PByte,
- "ei": EiByte,
- "e": EByte,
-}
-
-func logn(n, b float64) float64 {
- return math.Log(n) / math.Log(b)
-}
-
-func humanateBytes(s uint64, base float64, sizes []string) string {
- if s < 10 {
- return fmt.Sprintf("%d B", s)
- }
- e := math.Floor(logn(float64(s), base))
- suffix := sizes[int(e)]
- val := math.Floor(float64(s)/math.Pow(base, e)*10+0.5) / 10
- f := "%.0f %s"
- if val < 10 {
- f = "%.1f %s"
- }
-
- return fmt.Sprintf(f, val, suffix)
-}
-
-// Bytes produces a human readable representation of an SI size.
-//
-// See also: ParseBytes.
-//
-// Bytes(82854982) -> 83 MB
-func Bytes(s uint64) string {
- sizes := []string{"B", "kB", "MB", "GB", "TB", "PB", "EB"}
- return humanateBytes(s, 1000, sizes)
-}
-
-// IBytes produces a human readable representation of an IEC size.
-//
-// See also: ParseBytes.
-//
-// IBytes(82854982) -> 79 MiB
-func IBytes(s uint64) string {
- sizes := []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"}
- return humanateBytes(s, 1024, sizes)
-}
-
-// ParseBytes parses a string representation of bytes into the number
-// of bytes it represents.
-//
-// See Also: Bytes, IBytes.
-//
-// ParseBytes("42 MB") -> 42000000, nil
-// ParseBytes("42 mib") -> 44040192, nil
-func ParseBytes(s string) (uint64, error) {
- lastDigit := 0
- hasComma := false
- for _, r := range s {
- if !(unicode.IsDigit(r) || r == '.' || r == ',') {
- break
- }
- if r == ',' {
- hasComma = true
- }
- lastDigit++
- }
-
- num := s[:lastDigit]
- if hasComma {
- num = strings.Replace(num, ",", "", -1)
- }
-
- f, err := strconv.ParseFloat(num, 64)
- if err != nil {
- return 0, err
- }
-
- extra := strings.ToLower(strings.TrimSpace(s[lastDigit:]))
- if m, ok := bytesSizeTable[extra]; ok {
- f *= float64(m)
- if f >= math.MaxUint64 {
- return 0, fmt.Errorf("too large: %v", s)
- }
- return uint64(f), nil
- }
-
- return 0, fmt.Errorf("unhandled size name: %v", extra)
-}
diff --git a/vendor/github.com/dustin/go-humanize/comma.go b/vendor/github.com/dustin/go-humanize/comma.go
deleted file mode 100644
index 520ae3e57d92356e994733e1254f4046ba6215de..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/comma.go
+++ /dev/null
@@ -1,116 +0,0 @@
-package humanize
-
-import (
- "bytes"
- "math"
- "math/big"
- "strconv"
- "strings"
-)
-
-// Comma produces a string form of the given number in base 10 with
-// commas after every three orders of magnitude.
-//
-// e.g. Comma(834142) -> 834,142
-func Comma(v int64) string {
- sign := ""
-
- // Min int64 can't be negated to a usable value, so it has to be special cased.
- if v == math.MinInt64 {
- return "-9,223,372,036,854,775,808"
- }
-
- if v < 0 {
- sign = "-"
- v = 0 - v
- }
-
- parts := []string{"", "", "", "", "", "", ""}
- j := len(parts) - 1
-
- for v > 999 {
- parts[j] = strconv.FormatInt(v%1000, 10)
- switch len(parts[j]) {
- case 2:
- parts[j] = "0" + parts[j]
- case 1:
- parts[j] = "00" + parts[j]
- }
- v = v / 1000
- j--
- }
- parts[j] = strconv.Itoa(int(v))
- return sign + strings.Join(parts[j:], ",")
-}
-
-// Commaf produces a string form of the given number in base 10 with
-// commas after every three orders of magnitude.
-//
-// e.g. Commaf(834142.32) -> 834,142.32
-func Commaf(v float64) string {
- buf := &bytes.Buffer{}
- if v < 0 {
- buf.Write([]byte{'-'})
- v = 0 - v
- }
-
- comma := []byte{','}
-
- parts := strings.Split(strconv.FormatFloat(v, 'f', -1, 64), ".")
- pos := 0
- if len(parts[0])%3 != 0 {
- pos += len(parts[0]) % 3
- buf.WriteString(parts[0][:pos])
- buf.Write(comma)
- }
- for ; pos < len(parts[0]); pos += 3 {
- buf.WriteString(parts[0][pos : pos+3])
- buf.Write(comma)
- }
- buf.Truncate(buf.Len() - 1)
-
- if len(parts) > 1 {
- buf.Write([]byte{'.'})
- buf.WriteString(parts[1])
- }
- return buf.String()
-}
-
-// CommafWithDigits works like the Commaf but limits the resulting
-// string to the given number of decimal places.
-//
-// e.g. CommafWithDigits(834142.32, 1) -> 834,142.3
-func CommafWithDigits(f float64, decimals int) string {
- return stripTrailingDigits(Commaf(f), decimals)
-}
-
-// BigComma produces a string form of the given big.Int in base 10
-// with commas after every three orders of magnitude.
-func BigComma(b *big.Int) string {
- sign := ""
- if b.Sign() < 0 {
- sign = "-"
- b.Abs(b)
- }
-
- athousand := big.NewInt(1000)
- c := (&big.Int{}).Set(b)
- _, m := oom(c, athousand)
- parts := make([]string, m+1)
- j := len(parts) - 1
-
- mod := &big.Int{}
- for b.Cmp(athousand) >= 0 {
- b.DivMod(b, athousand, mod)
- parts[j] = strconv.FormatInt(mod.Int64(), 10)
- switch len(parts[j]) {
- case 2:
- parts[j] = "0" + parts[j]
- case 1:
- parts[j] = "00" + parts[j]
- }
- j--
- }
- parts[j] = strconv.Itoa(int(b.Int64()))
- return sign + strings.Join(parts[j:], ",")
-}
diff --git a/vendor/github.com/dustin/go-humanize/commaf.go b/vendor/github.com/dustin/go-humanize/commaf.go
deleted file mode 100644
index 620690dec7dd63b58e03dbc8b4ae23d6cf793a3d..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/commaf.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// +build go1.6
-
-package humanize
-
-import (
- "bytes"
- "math/big"
- "strings"
-)
-
-// BigCommaf produces a string form of the given big.Float in base 10
-// with commas after every three orders of magnitude.
-func BigCommaf(v *big.Float) string {
- buf := &bytes.Buffer{}
- if v.Sign() < 0 {
- buf.Write([]byte{'-'})
- v.Abs(v)
- }
-
- comma := []byte{','}
-
- parts := strings.Split(v.Text('f', -1), ".")
- pos := 0
- if len(parts[0])%3 != 0 {
- pos += len(parts[0]) % 3
- buf.WriteString(parts[0][:pos])
- buf.Write(comma)
- }
- for ; pos < len(parts[0]); pos += 3 {
- buf.WriteString(parts[0][pos : pos+3])
- buf.Write(comma)
- }
- buf.Truncate(buf.Len() - 1)
-
- if len(parts) > 1 {
- buf.Write([]byte{'.'})
- buf.WriteString(parts[1])
- }
- return buf.String()
-}
diff --git a/vendor/github.com/dustin/go-humanize/ftoa.go b/vendor/github.com/dustin/go-humanize/ftoa.go
deleted file mode 100644
index 1c62b640d47cbdfa15f5a82b3448493d3f9421ca..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/ftoa.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package humanize
-
-import (
- "strconv"
- "strings"
-)
-
-func stripTrailingZeros(s string) string {
- offset := len(s) - 1
- for offset > 0 {
- if s[offset] == '.' {
- offset--
- break
- }
- if s[offset] != '0' {
- break
- }
- offset--
- }
- return s[:offset+1]
-}
-
-func stripTrailingDigits(s string, digits int) string {
- if i := strings.Index(s, "."); i >= 0 {
- if digits <= 0 {
- return s[:i]
- }
- i++
- if i+digits >= len(s) {
- return s
- }
- return s[:i+digits]
- }
- return s
-}
-
-// Ftoa converts a float to a string with no trailing zeros.
-func Ftoa(num float64) string {
- return stripTrailingZeros(strconv.FormatFloat(num, 'f', 6, 64))
-}
-
-// FtoaWithDigits converts a float to a string but limits the resulting string
-// to the given number of decimal places, and no trailing zeros.
-func FtoaWithDigits(num float64, digits int) string {
- return stripTrailingZeros(stripTrailingDigits(strconv.FormatFloat(num, 'f', 6, 64), digits))
-}
diff --git a/vendor/github.com/dustin/go-humanize/humanize.go b/vendor/github.com/dustin/go-humanize/humanize.go
deleted file mode 100644
index a2c2da31ef1ad80b899607322395893bce9365e1..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/humanize.go
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
-Package humanize converts boring ugly numbers to human-friendly strings and back.
-
-Durations can be turned into strings such as "3 days ago", numbers
-representing sizes like 82854982 into useful strings like, "83 MB" or
-"79 MiB" (whichever you prefer).
-*/
-package humanize
diff --git a/vendor/github.com/dustin/go-humanize/number.go b/vendor/github.com/dustin/go-humanize/number.go
deleted file mode 100644
index dec618659969c41ac575428218b033d37d191997..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/number.go
+++ /dev/null
@@ -1,192 +0,0 @@
-package humanize
-
-/*
-Slightly adapted from the source to fit go-humanize.
-
-Author: https://github.com/gorhill
-Source: https://gist.github.com/gorhill/5285193
-
-*/
-
-import (
- "math"
- "strconv"
-)
-
-var (
- renderFloatPrecisionMultipliers = [...]float64{
- 1,
- 10,
- 100,
- 1000,
- 10000,
- 100000,
- 1000000,
- 10000000,
- 100000000,
- 1000000000,
- }
-
- renderFloatPrecisionRounders = [...]float64{
- 0.5,
- 0.05,
- 0.005,
- 0.0005,
- 0.00005,
- 0.000005,
- 0.0000005,
- 0.00000005,
- 0.000000005,
- 0.0000000005,
- }
-)
-
-// FormatFloat produces a formatted number as string based on the following user-specified criteria:
-// * thousands separator
-// * decimal separator
-// * decimal precision
-//
-// Usage: s := RenderFloat(format, n)
-// The format parameter tells how to render the number n.
-//
-// See examples: http://play.golang.org/p/LXc1Ddm1lJ
-//
-// Examples of format strings, given n = 12345.6789:
-// "#,###.##" => "12,345.67"
-// "#,###." => "12,345"
-// "#,###" => "12345,678"
-// "#\u202F###,##" => "12 345,68"
-// "#.###,###### => 12.345,678900
-// "" (aka default format) => 12,345.67
-//
-// The highest precision allowed is 9 digits after the decimal symbol.
-// There is also a version for integer number, FormatInteger(),
-// which is convenient for calls within template.
-func FormatFloat(format string, n float64) string {
- // Special cases:
- // NaN = "NaN"
- // +Inf = "+Infinity"
- // -Inf = "-Infinity"
- if math.IsNaN(n) {
- return "NaN"
- }
- if n > math.MaxFloat64 {
- return "Infinity"
- }
- if n < -math.MaxFloat64 {
- return "-Infinity"
- }
-
- // default format
- precision := 2
- decimalStr := "."
- thousandStr := ","
- positiveStr := ""
- negativeStr := "-"
-
- if len(format) > 0 {
- format := []rune(format)
-
- // If there is an explicit format directive,
- // then default values are these:
- precision = 9
- thousandStr = ""
-
- // collect indices of meaningful formatting directives
- formatIndx := []int{}
- for i, char := range format {
- if char != '#' && char != '0' {
- formatIndx = append(formatIndx, i)
- }
- }
-
- if len(formatIndx) > 0 {
- // Directive at index 0:
- // Must be a '+'
- // Raise an error if not the case
- // index: 0123456789
- // +0.000,000
- // +000,000.0
- // +0000.00
- // +0000
- if formatIndx[0] == 0 {
- if format[formatIndx[0]] != '+' {
- panic("RenderFloat(): invalid positive sign directive")
- }
- positiveStr = "+"
- formatIndx = formatIndx[1:]
- }
-
- // Two directives:
- // First is thousands separator
- // Raise an error if not followed by 3-digit
- // 0123456789
- // 0.000,000
- // 000,000.00
- if len(formatIndx) == 2 {
- if (formatIndx[1] - formatIndx[0]) != 4 {
- panic("RenderFloat(): thousands separator directive must be followed by 3 digit-specifiers")
- }
- thousandStr = string(format[formatIndx[0]])
- formatIndx = formatIndx[1:]
- }
-
- // One directive:
- // Directive is decimal separator
- // The number of digit-specifier following the separator indicates wanted precision
- // 0123456789
- // 0.00
- // 000,0000
- if len(formatIndx) == 1 {
- decimalStr = string(format[formatIndx[0]])
- precision = len(format) - formatIndx[0] - 1
- }
- }
- }
-
- // generate sign part
- var signStr string
- if n >= 0.000000001 {
- signStr = positiveStr
- } else if n <= -0.000000001 {
- signStr = negativeStr
- n = -n
- } else {
- signStr = ""
- n = 0.0
- }
-
- // split number into integer and fractional parts
- intf, fracf := math.Modf(n + renderFloatPrecisionRounders[precision])
-
- // generate integer part string
- intStr := strconv.FormatInt(int64(intf), 10)
-
- // add thousand separator if required
- if len(thousandStr) > 0 {
- for i := len(intStr); i > 3; {
- i -= 3
- intStr = intStr[:i] + thousandStr + intStr[i:]
- }
- }
-
- // no fractional part, we can leave now
- if precision == 0 {
- return signStr + intStr
- }
-
- // generate fractional part
- fracStr := strconv.Itoa(int(fracf * renderFloatPrecisionMultipliers[precision]))
- // may need padding
- if len(fracStr) < precision {
- fracStr = "000000000000000"[:precision-len(fracStr)] + fracStr
- }
-
- return signStr + intStr + decimalStr + fracStr
-}
-
-// FormatInteger produces a formatted number as string.
-// See FormatFloat.
-func FormatInteger(format string, n int) string {
- return FormatFloat(format, float64(n))
-}
diff --git a/vendor/github.com/dustin/go-humanize/ordinals.go b/vendor/github.com/dustin/go-humanize/ordinals.go
deleted file mode 100644
index 43d88a861950eac85b0f742a59621f92345d7109..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/ordinals.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package humanize
-
-import "strconv"
-
-// Ordinal gives you the input number in a rank/ordinal format.
-//
-// Ordinal(3) -> 3rd
-func Ordinal(x int) string {
- suffix := "th"
- switch x % 10 {
- case 1:
- if x%100 != 11 {
- suffix = "st"
- }
- case 2:
- if x%100 != 12 {
- suffix = "nd"
- }
- case 3:
- if x%100 != 13 {
- suffix = "rd"
- }
- }
- return strconv.Itoa(x) + suffix
-}
diff --git a/vendor/github.com/dustin/go-humanize/si.go b/vendor/github.com/dustin/go-humanize/si.go
deleted file mode 100644
index ae659e0e49792e30e1f7ddcf149b145ee121f181..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/si.go
+++ /dev/null
@@ -1,123 +0,0 @@
-package humanize
-
-import (
- "errors"
- "math"
- "regexp"
- "strconv"
-)
-
-var siPrefixTable = map[float64]string{
- -24: "y", // yocto
- -21: "z", // zepto
- -18: "a", // atto
- -15: "f", // femto
- -12: "p", // pico
- -9: "n", // nano
- -6: "µ", // micro
- -3: "m", // milli
- 0: "",
- 3: "k", // kilo
- 6: "M", // mega
- 9: "G", // giga
- 12: "T", // tera
- 15: "P", // peta
- 18: "E", // exa
- 21: "Z", // zetta
- 24: "Y", // yotta
-}
-
-var revSIPrefixTable = revfmap(siPrefixTable)
-
-// revfmap reverses the map and precomputes the power multiplier
-func revfmap(in map[float64]string) map[string]float64 {
- rv := map[string]float64{}
- for k, v := range in {
- rv[v] = math.Pow(10, k)
- }
- return rv
-}
-
-var riParseRegex *regexp.Regexp
-
-func init() {
- ri := `^([\-0-9.]+)\s?([`
- for _, v := range siPrefixTable {
- ri += v
- }
- ri += `]?)(.*)`
-
- riParseRegex = regexp.MustCompile(ri)
-}
-
-// ComputeSI finds the most appropriate SI prefix for the given number
-// and returns the prefix along with the value adjusted to be within
-// that prefix.
-//
-// See also: SI, ParseSI.
-//
-// e.g. ComputeSI(2.2345e-12) -> (2.2345, "p")
-func ComputeSI(input float64) (float64, string) {
- if input == 0 {
- return 0, ""
- }
- mag := math.Abs(input)
- exponent := math.Floor(logn(mag, 10))
- exponent = math.Floor(exponent/3) * 3
-
- value := mag / math.Pow(10, exponent)
-
- // Handle special case where value is exactly 1000.0
- // Should return 1 M instead of 1000 k
- if value == 1000.0 {
- exponent += 3
- value = mag / math.Pow(10, exponent)
- }
-
- value = math.Copysign(value, input)
-
- prefix := siPrefixTable[exponent]
- return value, prefix
-}
-
-// SI returns a string with default formatting.
-//
-// SI uses Ftoa to format float value, removing trailing zeros.
-//
-// See also: ComputeSI, ParseSI.
-//
-// e.g. SI(1000000, "B") -> 1 MB
-// e.g. SI(2.2345e-12, "F") -> 2.2345 pF
-func SI(input float64, unit string) string {
- value, prefix := ComputeSI(input)
- return Ftoa(value) + " " + prefix + unit
-}
-
-// SIWithDigits works like SI but limits the resulting string to the
-// given number of decimal places.
-//
-// e.g. SIWithDigits(1000000, 0, "B") -> 1 MB
-// e.g. SIWithDigits(2.2345e-12, 2, "F") -> 2.23 pF
-func SIWithDigits(input float64, decimals int, unit string) string {
- value, prefix := ComputeSI(input)
- return FtoaWithDigits(value, decimals) + " " + prefix + unit
-}
-
-var errInvalid = errors.New("invalid input")
-
-// ParseSI parses an SI string back into the number and unit.
-//
-// See also: SI, ComputeSI.
-//
-// e.g. ParseSI("2.2345 pF") -> (2.2345e-12, "F", nil)
-func ParseSI(input string) (float64, string, error) {
- found := riParseRegex.FindStringSubmatch(input)
- if len(found) != 4 {
- return 0, "", errInvalid
- }
- mag := revSIPrefixTable[found[2]]
- unit := found[3]
-
- base, err := strconv.ParseFloat(found[1], 64)
- return base * mag, unit, err
-}
diff --git a/vendor/github.com/dustin/go-humanize/times.go b/vendor/github.com/dustin/go-humanize/times.go
deleted file mode 100644
index dd3fbf5efc0cc20d715748c4958b03d55f74d525..0000000000000000000000000000000000000000
--- a/vendor/github.com/dustin/go-humanize/times.go
+++ /dev/null
@@ -1,117 +0,0 @@
-package humanize
-
-import (
- "fmt"
- "math"
- "sort"
- "time"
-)
-
-// Seconds-based time units
-const (
- Day = 24 * time.Hour
- Week = 7 * Day
- Month = 30 * Day
- Year = 12 * Month
- LongTime = 37 * Year
-)
-
-// Time formats a time into a relative string.
-//
-// Time(someT) -> "3 weeks ago"
-func Time(then time.Time) string {
- return RelTime(then, time.Now(), "ago", "from now")
-}
-
-// A RelTimeMagnitude struct contains a relative time point at which
-// the relative format of time will switch to a new format string. A
-// slice of these in ascending order by their "D" field is passed to
-// CustomRelTime to format durations.
-//
-// The Format field is a string that may contain a "%s" which will be
-// replaced with the appropriate signed label (e.g. "ago" or "from
-// now") and a "%d" that will be replaced by the quantity.
-//
-// The DivBy field is the amount of time the time difference must be
-// divided by in order to display correctly.
-//
-// e.g. if D is 2*time.Minute and you want to display "%d minutes %s"
-// DivBy should be time.Minute so whatever the duration is will be
-// expressed in minutes.
-type RelTimeMagnitude struct {
- D time.Duration
- Format string
- DivBy time.Duration
-}
-
-var defaultMagnitudes = []RelTimeMagnitude{
- {time.Second, "now", time.Second},
- {2 * time.Second, "1 second %s", 1},
- {time.Minute, "%d seconds %s", time.Second},
- {2 * time.Minute, "1 minute %s", 1},
- {time.Hour, "%d minutes %s", time.Minute},
- {2 * time.Hour, "1 hour %s", 1},
- {Day, "%d hours %s", time.Hour},
- {2 * Day, "1 day %s", 1},
- {Week, "%d days %s", Day},
- {2 * Week, "1 week %s", 1},
- {Month, "%d weeks %s", Week},
- {2 * Month, "1 month %s", 1},
- {Year, "%d months %s", Month},
- {18 * Month, "1 year %s", 1},
- {2 * Year, "2 years %s", 1},
- {LongTime, "%d years %s", Year},
- {math.MaxInt64, "a long while %s", 1},
-}
-
-// RelTime formats a time into a relative string.
-//
-// It takes two times and two labels. In addition to the generic time
-// delta string (e.g. 5 minutes), the labels are used applied so that
-// the label corresponding to the smaller time is applied.
-//
-// RelTime(timeInPast, timeInFuture, "earlier", "later") -> "3 weeks earlier"
-func RelTime(a, b time.Time, albl, blbl string) string {
- return CustomRelTime(a, b, albl, blbl, defaultMagnitudes)
-}
-
-// CustomRelTime formats a time into a relative string.
-//
-// It takes two times two labels and a table of relative time formats.
-// In addition to the generic time delta string (e.g. 5 minutes), the
-// labels are used applied so that the label corresponding to the
-// smaller time is applied.
-func CustomRelTime(a, b time.Time, albl, blbl string, magnitudes []RelTimeMagnitude) string {
- lbl := albl
- diff := b.Sub(a)
-
- if a.After(b) {
- lbl = blbl
- diff = a.Sub(b)
- }
-
- n := sort.Search(len(magnitudes), func(i int) bool {
- return magnitudes[i].D > diff
- })
-
- if n >= len(magnitudes) {
- n = len(magnitudes) - 1
- }
- mag := magnitudes[n]
- args := []interface{}{}
- escaped := false
- for _, ch := range mag.Format {
- if escaped {
- switch ch {
- case 's':
- args = append(args, lbl)
- case 'd':
- args = append(args, diff/mag.DivBy)
- }
- escaped = false
- } else {
- escaped = ch == '%'
- }
- }
- return fmt.Sprintf(mag.Format, args...)
-}
diff --git a/vendor/github.com/fatih/color/.travis.yml b/vendor/github.com/fatih/color/.travis.yml
deleted file mode 100644
index 95f8a1ff5c7f445bfe074c82081e277528c0f573..0000000000000000000000000000000000000000
--- a/vendor/github.com/fatih/color/.travis.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-language: go
-go:
- - 1.8.x
- - tip
-
diff --git a/vendor/github.com/fatih/color/Gopkg.lock b/vendor/github.com/fatih/color/Gopkg.lock
deleted file mode 100644
index 7d879e9caf0b55f669c7fcf6ba3b17def5206dbf..0000000000000000000000000000000000000000
--- a/vendor/github.com/fatih/color/Gopkg.lock
+++ /dev/null
@@ -1,27 +0,0 @@
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-
-
-[[projects]]
- name = "github.com/mattn/go-colorable"
- packages = ["."]
- revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"
- version = "v0.0.9"
-
-[[projects]]
- name = "github.com/mattn/go-isatty"
- packages = ["."]
- revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
- version = "v0.0.3"
-
-[[projects]]
- branch = "master"
- name = "golang.org/x/sys"
- packages = ["unix"]
- revision = "37707fdb30a5b38865cfb95e5aab41707daec7fd"
-
-[solve-meta]
- analyzer-name = "dep"
- analyzer-version = 1
- inputs-digest = "e8a50671c3cb93ea935bf210b1cd20702876b9d9226129be581ef646d1565cdc"
- solver-name = "gps-cdcl"
- solver-version = 1
diff --git a/vendor/github.com/fatih/color/Gopkg.toml b/vendor/github.com/fatih/color/Gopkg.toml
deleted file mode 100644
index ff1617f71da8661eee361341b06e4a14d8abf794..0000000000000000000000000000000000000000
--- a/vendor/github.com/fatih/color/Gopkg.toml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-# Gopkg.toml example
-#
-# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
-# for detailed Gopkg.toml documentation.
-#
-# required = ["github.com/user/thing/cmd/thing"]
-# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
-#
-# [[constraint]]
-# name = "github.com/user/project"
-# version = "1.0.0"
-#
-# [[constraint]]
-# name = "github.com/user/project2"
-# branch = "dev"
-# source = "github.com/myfork/project2"
-#
-# [[override]]
-# name = "github.com/x/y"
-# version = "2.4.0"
-
-
-[[constraint]]
- name = "github.com/mattn/go-colorable"
- version = "0.0.9"
-
-[[constraint]]
- name = "github.com/mattn/go-isatty"
- version = "0.0.3"
diff --git a/vendor/github.com/fatih/color/LICENSE.md b/vendor/github.com/fatih/color/LICENSE.md
deleted file mode 100644
index 25fdaf639dfc039992d059805e51377d3174ae87..0000000000000000000000000000000000000000
--- a/vendor/github.com/fatih/color/LICENSE.md
+++ /dev/null
@@ -1,20 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Fatih Arslan
-
-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/fatih/color/README.md b/vendor/github.com/fatih/color/README.md
deleted file mode 100644
index 3fc9544602852e448530161fcd9c424a550fcae5..0000000000000000000000000000000000000000
--- a/vendor/github.com/fatih/color/README.md
+++ /dev/null
@@ -1,179 +0,0 @@
-# Color [](https://godoc.org/github.com/fatih/color) [](https://travis-ci.org/fatih/color)
-
-
-
-Color lets you use colorized outputs in terms of [ANSI Escape
-Codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors) in Go (Golang). It
-has support for Windows too! The API can be used in several ways, pick one that
-suits you.
-
-
-
-
-
-## Install
-
-```bash
-go get github.com/fatih/color
-```
-
-Note that the `vendor` folder is here for stability. Remove the folder if you
-already have the dependencies in your GOPATH.
-
-## Examples
-
-### Standard colors
-
-```go
-// Print with default helper functions
-color.Cyan("Prints text in cyan.")
-
-// A newline will be appended automatically
-color.Blue("Prints %s in blue.", "text")
-
-// These are using the default foreground colors
-color.Red("We have red")
-color.Magenta("And many others ..")
-
-```
-
-### Mix and reuse colors
-
-```go
-// Create a new color object
-c := color.New(color.FgCyan).Add(color.Underline)
-c.Println("Prints cyan text with an underline.")
-
-// Or just add them to New()
-d := color.New(color.FgCyan, color.Bold)
-d.Printf("This prints bold cyan %s\n", "too!.")
-
-// Mix up foreground and background colors, create new mixes!
-red := color.New(color.FgRed)
-
-boldRed := red.Add(color.Bold)
-boldRed.Println("This will print text in bold red.")
-
-whiteBackground := red.Add(color.BgWhite)
-whiteBackground.Println("Red text with white background.")
-```
-
-### Use your own output (io.Writer)
-
-```go
-// Use your own io.Writer output
-color.New(color.FgBlue).Fprintln(myWriter, "blue color!")
-
-blue := color.New(color.FgBlue)
-blue.Fprint(writer, "This will print text in blue.")
-```
-
-### Custom print functions (PrintFunc)
-
-```go
-// Create a custom print function for convenience
-red := color.New(color.FgRed).PrintfFunc()
-red("Warning")
-red("Error: %s", err)
-
-// Mix up multiple attributes
-notice := color.New(color.Bold, color.FgGreen).PrintlnFunc()
-notice("Don't forget this...")
-```
-
-### Custom fprint functions (FprintFunc)
-
-```go
-blue := color.New(FgBlue).FprintfFunc()
-blue(myWriter, "important notice: %s", stars)
-
-// Mix up with multiple attributes
-success := color.New(color.Bold, color.FgGreen).FprintlnFunc()
-success(myWriter, "Don't forget this...")
-```
-
-### Insert into noncolor strings (SprintFunc)
-
-```go
-// Create SprintXxx functions to mix strings with other non-colorized strings:
-yellow := color.New(color.FgYellow).SprintFunc()
-red := color.New(color.FgRed).SprintFunc()
-fmt.Printf("This is a %s and this is %s.\n", yellow("warning"), red("error"))
-
-info := color.New(color.FgWhite, color.BgGreen).SprintFunc()
-fmt.Printf("This %s rocks!\n", info("package"))
-
-// Use helper functions
-fmt.Println("This", color.RedString("warning"), "should be not neglected.")
-fmt.Printf("%v %v\n", color.GreenString("Info:"), "an important message.")
-
-// Windows supported too! Just don't forget to change the output to color.Output
-fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS"))
-```
-
-### Plug into existing code
-
-```go
-// Use handy standard colors
-color.Set(color.FgYellow)
-
-fmt.Println("Existing text will now be in yellow")
-fmt.Printf("This one %s\n", "too")
-
-color.Unset() // Don't forget to unset
-
-// You can mix up parameters
-color.Set(color.FgMagenta, color.Bold)
-defer color.Unset() // Use it in your function
-
-fmt.Println("All text will now be bold magenta.")
-```
-
-### Disable/Enable color
-
-There might be a case where you want to explicitly disable/enable color output. the
-`go-isatty` package will automatically disable color output for non-tty output streams
-(for example if the output were piped directly to `less`)
-
-`Color` has support to disable/enable colors both globally and for single color
-definitions. For example suppose you have a CLI app and a `--no-color` bool flag. You
-can easily disable the color output with:
-
-```go
-
-var flagNoColor = flag.Bool("no-color", false, "Disable color output")
-
-if *flagNoColor {
- color.NoColor = true // disables colorized output
-}
-```
-
-It also has support for single color definitions (local). You can
-disable/enable color output on the fly:
-
-```go
-c := color.New(color.FgCyan)
-c.Println("Prints cyan text")
-
-c.DisableColor()
-c.Println("This is printed without any color")
-
-c.EnableColor()
-c.Println("This prints again cyan...")
-```
-
-## Todo
-
-* Save/Return previous values
-* Evaluate fmt.Formatter interface
-
-
-## Credits
-
- * [Fatih Arslan](https://github.com/fatih)
- * Windows support via @mattn: [colorable](https://github.com/mattn/go-colorable)
-
-## License
-
-The MIT License (MIT) - see [`LICENSE.md`](https://github.com/fatih/color/blob/master/LICENSE.md) for more details
-
diff --git a/vendor/github.com/fatih/color/color.go b/vendor/github.com/fatih/color/color.go
deleted file mode 100644
index 91c8e9f0620f23cf84f313c44b2dcfeb1eeacb85..0000000000000000000000000000000000000000
--- a/vendor/github.com/fatih/color/color.go
+++ /dev/null
@@ -1,603 +0,0 @@
-package color
-
-import (
- "fmt"
- "io"
- "os"
- "strconv"
- "strings"
- "sync"
-
- "github.com/mattn/go-colorable"
- "github.com/mattn/go-isatty"
-)
-
-var (
- // NoColor defines if the output is colorized or not. It's dynamically set to
- // false or true based on the stdout's file descriptor referring to a terminal
- // or not. This is a global option and affects all colors. For more control
- // over each color block use the methods DisableColor() individually.
- NoColor = os.Getenv("TERM") == "dumb" ||
- (!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd()))
-
- // Output defines the standard output of the print functions. By default
- // os.Stdout is used.
- Output = colorable.NewColorableStdout()
-
- // Error defines a color supporting writer for os.Stderr.
- Error = colorable.NewColorableStderr()
-
- // colorsCache is used to reduce the count of created Color objects and
- // allows to reuse already created objects with required Attribute.
- colorsCache = make(map[Attribute]*Color)
- colorsCacheMu sync.Mutex // protects colorsCache
-)
-
-// Color defines a custom color object which is defined by SGR parameters.
-type Color struct {
- params []Attribute
- noColor *bool
-}
-
-// Attribute defines a single SGR Code
-type Attribute int
-
-const escape = "\x1b"
-
-// Base attributes
-const (
- Reset Attribute = iota
- Bold
- Faint
- Italic
- Underline
- BlinkSlow
- BlinkRapid
- ReverseVideo
- Concealed
- CrossedOut
-)
-
-// Foreground text colors
-const (
- FgBlack Attribute = iota + 30
- FgRed
- FgGreen
- FgYellow
- FgBlue
- FgMagenta
- FgCyan
- FgWhite
-)
-
-// Foreground Hi-Intensity text colors
-const (
- FgHiBlack Attribute = iota + 90
- FgHiRed
- FgHiGreen
- FgHiYellow
- FgHiBlue
- FgHiMagenta
- FgHiCyan
- FgHiWhite
-)
-
-// Background text colors
-const (
- BgBlack Attribute = iota + 40
- BgRed
- BgGreen
- BgYellow
- BgBlue
- BgMagenta
- BgCyan
- BgWhite
-)
-
-// Background Hi-Intensity text colors
-const (
- BgHiBlack Attribute = iota + 100
- BgHiRed
- BgHiGreen
- BgHiYellow
- BgHiBlue
- BgHiMagenta
- BgHiCyan
- BgHiWhite
-)
-
-// New returns a newly created color object.
-func New(value ...Attribute) *Color {
- c := &Color{params: make([]Attribute, 0)}
- c.Add(value...)
- return c
-}
-
-// Set sets the given parameters immediately. It will change the color of
-// output with the given SGR parameters until color.Unset() is called.
-func Set(p ...Attribute) *Color {
- c := New(p...)
- c.Set()
- return c
-}
-
-// Unset resets all escape attributes and clears the output. Usually should
-// be called after Set().
-func Unset() {
- if NoColor {
- return
- }
-
- fmt.Fprintf(Output, "%s[%dm", escape, Reset)
-}
-
-// Set sets the SGR sequence.
-func (c *Color) Set() *Color {
- if c.isNoColorSet() {
- return c
- }
-
- fmt.Fprintf(Output, c.format())
- return c
-}
-
-func (c *Color) unset() {
- if c.isNoColorSet() {
- return
- }
-
- Unset()
-}
-
-func (c *Color) setWriter(w io.Writer) *Color {
- if c.isNoColorSet() {
- return c
- }
-
- fmt.Fprintf(w, c.format())
- return c
-}
-
-func (c *Color) unsetWriter(w io.Writer) {
- if c.isNoColorSet() {
- return
- }
-
- if NoColor {
- return
- }
-
- fmt.Fprintf(w, "%s[%dm", escape, Reset)
-}
-
-// Add is used to chain SGR parameters. Use as many as parameters to combine
-// and create custom color objects. Example: Add(color.FgRed, color.Underline).
-func (c *Color) Add(value ...Attribute) *Color {
- c.params = append(c.params, value...)
- return c
-}
-
-func (c *Color) prepend(value Attribute) {
- c.params = append(c.params, 0)
- copy(c.params[1:], c.params[0:])
- c.params[0] = value
-}
-
-// Fprint formats using the default formats for its operands and writes to w.
-// Spaces are added between operands when neither is a string.
-// It returns the number of bytes written and any write error encountered.
-// On Windows, users should wrap w with colorable.NewColorable() if w is of
-// type *os.File.
-func (c *Color) Fprint(w io.Writer, a ...interface{}) (n int, err error) {
- c.setWriter(w)
- defer c.unsetWriter(w)
-
- return fmt.Fprint(w, a...)
-}
-
-// Print formats using the default formats for its operands and writes to
-// standard output. Spaces are added between operands when neither is a
-// string. It returns the number of bytes written and any write error
-// encountered. This is the standard fmt.Print() method wrapped with the given
-// color.
-func (c *Color) Print(a ...interface{}) (n int, err error) {
- c.Set()
- defer c.unset()
-
- return fmt.Fprint(Output, a...)
-}
-
-// Fprintf formats according to a format specifier and writes to w.
-// It returns the number of bytes written and any write error encountered.
-// On Windows, users should wrap w with colorable.NewColorable() if w is of
-// type *os.File.
-func (c *Color) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
- c.setWriter(w)
- defer c.unsetWriter(w)
-
- return fmt.Fprintf(w, format, a...)
-}
-
-// Printf formats according to a format specifier and writes to standard output.
-// It returns the number of bytes written and any write error encountered.
-// This is the standard fmt.Printf() method wrapped with the given color.
-func (c *Color) Printf(format string, a ...interface{}) (n int, err error) {
- c.Set()
- defer c.unset()
-
- return fmt.Fprintf(Output, format, a...)
-}
-
-// Fprintln formats using the default formats for its operands and writes to w.
-// Spaces are always added between operands and a newline is appended.
-// On Windows, users should wrap w with colorable.NewColorable() if w is of
-// type *os.File.
-func (c *Color) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
- c.setWriter(w)
- defer c.unsetWriter(w)
-
- return fmt.Fprintln(w, a...)
-}
-
-// Println formats using the default formats for its operands and writes to
-// standard output. Spaces are always added between operands and a newline is
-// appended. It returns the number of bytes written and any write error
-// encountered. This is the standard fmt.Print() method wrapped with the given
-// color.
-func (c *Color) Println(a ...interface{}) (n int, err error) {
- c.Set()
- defer c.unset()
-
- return fmt.Fprintln(Output, a...)
-}
-
-// Sprint is just like Print, but returns a string instead of printing it.
-func (c *Color) Sprint(a ...interface{}) string {
- return c.wrap(fmt.Sprint(a...))
-}
-
-// Sprintln is just like Println, but returns a string instead of printing it.
-func (c *Color) Sprintln(a ...interface{}) string {
- return c.wrap(fmt.Sprintln(a...))
-}
-
-// Sprintf is just like Printf, but returns a string instead of printing it.
-func (c *Color) Sprintf(format string, a ...interface{}) string {
- return c.wrap(fmt.Sprintf(format, a...))
-}
-
-// FprintFunc returns a new function that prints the passed arguments as
-// colorized with color.Fprint().
-func (c *Color) FprintFunc() func(w io.Writer, a ...interface{}) {
- return func(w io.Writer, a ...interface{}) {
- c.Fprint(w, a...)
- }
-}
-
-// PrintFunc returns a new function that prints the passed arguments as
-// colorized with color.Print().
-func (c *Color) PrintFunc() func(a ...interface{}) {
- return func(a ...interface{}) {
- c.Print(a...)
- }
-}
-
-// FprintfFunc returns a new function that prints the passed arguments as
-// colorized with color.Fprintf().
-func (c *Color) FprintfFunc() func(w io.Writer, format string, a ...interface{}) {
- return func(w io.Writer, format string, a ...interface{}) {
- c.Fprintf(w, format, a...)
- }
-}
-
-// PrintfFunc returns a new function that prints the passed arguments as
-// colorized with color.Printf().
-func (c *Color) PrintfFunc() func(format string, a ...interface{}) {
- return func(format string, a ...interface{}) {
- c.Printf(format, a...)
- }
-}
-
-// FprintlnFunc returns a new function that prints the passed arguments as
-// colorized with color.Fprintln().
-func (c *Color) FprintlnFunc() func(w io.Writer, a ...interface{}) {
- return func(w io.Writer, a ...interface{}) {
- c.Fprintln(w, a...)
- }
-}
-
-// PrintlnFunc returns a new function that prints the passed arguments as
-// colorized with color.Println().
-func (c *Color) PrintlnFunc() func(a ...interface{}) {
- return func(a ...interface{}) {
- c.Println(a...)
- }
-}
-
-// SprintFunc returns a new function that returns colorized strings for the
-// given arguments with fmt.Sprint(). Useful to put into or mix into other
-// string. Windows users should use this in conjunction with color.Output, example:
-//
-// put := New(FgYellow).SprintFunc()
-// fmt.Fprintf(color.Output, "This is a %s", put("warning"))
-func (c *Color) SprintFunc() func(a ...interface{}) string {
- return func(a ...interface{}) string {
- return c.wrap(fmt.Sprint(a...))
- }
-}
-
-// SprintfFunc returns a new function that returns colorized strings for the
-// given arguments with fmt.Sprintf(). Useful to put into or mix into other
-// string. Windows users should use this in conjunction with color.Output.
-func (c *Color) SprintfFunc() func(format string, a ...interface{}) string {
- return func(format string, a ...interface{}) string {
- return c.wrap(fmt.Sprintf(format, a...))
- }
-}
-
-// SprintlnFunc returns a new function that returns colorized strings for the
-// given arguments with fmt.Sprintln(). Useful to put into or mix into other
-// string. Windows users should use this in conjunction with color.Output.
-func (c *Color) SprintlnFunc() func(a ...interface{}) string {
- return func(a ...interface{}) string {
- return c.wrap(fmt.Sprintln(a...))
- }
-}
-
-// sequence returns a formatted SGR sequence to be plugged into a "\x1b[...m"
-// an example output might be: "1;36" -> bold cyan
-func (c *Color) sequence() string {
- format := make([]string, len(c.params))
- for i, v := range c.params {
- format[i] = strconv.Itoa(int(v))
- }
-
- return strings.Join(format, ";")
-}
-
-// wrap wraps the s string with the colors attributes. The string is ready to
-// be printed.
-func (c *Color) wrap(s string) string {
- if c.isNoColorSet() {
- return s
- }
-
- return c.format() + s + c.unformat()
-}
-
-func (c *Color) format() string {
- return fmt.Sprintf("%s[%sm", escape, c.sequence())
-}
-
-func (c *Color) unformat() string {
- return fmt.Sprintf("%s[%dm", escape, Reset)
-}
-
-// DisableColor disables the color output. Useful to not change any existing
-// code and still being able to output. Can be used for flags like
-// "--no-color". To enable back use EnableColor() method.
-func (c *Color) DisableColor() {
- c.noColor = boolPtr(true)
-}
-
-// EnableColor enables the color output. Use it in conjunction with
-// DisableColor(). Otherwise this method has no side effects.
-func (c *Color) EnableColor() {
- c.noColor = boolPtr(false)
-}
-
-func (c *Color) isNoColorSet() bool {
- // check first if we have user setted action
- if c.noColor != nil {
- return *c.noColor
- }
-
- // if not return the global option, which is disabled by default
- return NoColor
-}
-
-// Equals returns a boolean value indicating whether two colors are equal.
-func (c *Color) Equals(c2 *Color) bool {
- if len(c.params) != len(c2.params) {
- return false
- }
-
- for _, attr := range c.params {
- if !c2.attrExists(attr) {
- return false
- }
- }
-
- return true
-}
-
-func (c *Color) attrExists(a Attribute) bool {
- for _, attr := range c.params {
- if attr == a {
- return true
- }
- }
-
- return false
-}
-
-func boolPtr(v bool) *bool {
- return &v
-}
-
-func getCachedColor(p Attribute) *Color {
- colorsCacheMu.Lock()
- defer colorsCacheMu.Unlock()
-
- c, ok := colorsCache[p]
- if !ok {
- c = New(p)
- colorsCache[p] = c
- }
-
- return c
-}
-
-func colorPrint(format string, p Attribute, a ...interface{}) {
- c := getCachedColor(p)
-
- if !strings.HasSuffix(format, "\n") {
- format += "\n"
- }
-
- if len(a) == 0 {
- c.Print(format)
- } else {
- c.Printf(format, a...)
- }
-}
-
-func colorString(format string, p Attribute, a ...interface{}) string {
- c := getCachedColor(p)
-
- if len(a) == 0 {
- return c.SprintFunc()(format)
- }
-
- return c.SprintfFunc()(format, a...)
-}
-
-// Black is a convenient helper function to print with black foreground. A
-// newline is appended to format by default.
-func Black(format string, a ...interface{}) { colorPrint(format, FgBlack, a...) }
-
-// Red is a convenient helper function to print with red foreground. A
-// newline is appended to format by default.
-func Red(format string, a ...interface{}) { colorPrint(format, FgRed, a...) }
-
-// Green is a convenient helper function to print with green foreground. A
-// newline is appended to format by default.
-func Green(format string, a ...interface{}) { colorPrint(format, FgGreen, a...) }
-
-// Yellow is a convenient helper function to print with yellow foreground.
-// A newline is appended to format by default.
-func Yellow(format string, a ...interface{}) { colorPrint(format, FgYellow, a...) }
-
-// Blue is a convenient helper function to print with blue foreground. A
-// newline is appended to format by default.
-func Blue(format string, a ...interface{}) { colorPrint(format, FgBlue, a...) }
-
-// Magenta is a convenient helper function to print with magenta foreground.
-// A newline is appended to format by default.
-func Magenta(format string, a ...interface{}) { colorPrint(format, FgMagenta, a...) }
-
-// Cyan is a convenient helper function to print with cyan foreground. A
-// newline is appended to format by default.
-func Cyan(format string, a ...interface{}) { colorPrint(format, FgCyan, a...) }
-
-// White is a convenient helper function to print with white foreground. A
-// newline is appended to format by default.
-func White(format string, a ...interface{}) { colorPrint(format, FgWhite, a...) }
-
-// BlackString is a convenient helper function to return a string with black
-// foreground.
-func BlackString(format string, a ...interface{}) string { return colorString(format, FgBlack, a...) }
-
-// RedString is a convenient helper function to return a string with red
-// foreground.
-func RedString(format string, a ...interface{}) string { return colorString(format, FgRed, a...) }
-
-// GreenString is a convenient helper function to return a string with green
-// foreground.
-func GreenString(format string, a ...interface{}) string { return colorString(format, FgGreen, a...) }
-
-// YellowString is a convenient helper function to return a string with yellow
-// foreground.
-func YellowString(format string, a ...interface{}) string { return colorString(format, FgYellow, a...) }
-
-// BlueString is a convenient helper function to return a string with blue
-// foreground.
-func BlueString(format string, a ...interface{}) string { return colorString(format, FgBlue, a...) }
-
-// MagentaString is a convenient helper function to return a string with magenta
-// foreground.
-func MagentaString(format string, a ...interface{}) string {
- return colorString(format, FgMagenta, a...)
-}
-
-// CyanString is a convenient helper function to return a string with cyan
-// foreground.
-func CyanString(format string, a ...interface{}) string { return colorString(format, FgCyan, a...) }
-
-// WhiteString is a convenient helper function to return a string with white
-// foreground.
-func WhiteString(format string, a ...interface{}) string { return colorString(format, FgWhite, a...) }
-
-// HiBlack is a convenient helper function to print with hi-intensity black foreground. A
-// newline is appended to format by default.
-func HiBlack(format string, a ...interface{}) { colorPrint(format, FgHiBlack, a...) }
-
-// HiRed is a convenient helper function to print with hi-intensity red foreground. A
-// newline is appended to format by default.
-func HiRed(format string, a ...interface{}) { colorPrint(format, FgHiRed, a...) }
-
-// HiGreen is a convenient helper function to print with hi-intensity green foreground. A
-// newline is appended to format by default.
-func HiGreen(format string, a ...interface{}) { colorPrint(format, FgHiGreen, a...) }
-
-// HiYellow is a convenient helper function to print with hi-intensity yellow foreground.
-// A newline is appended to format by default.
-func HiYellow(format string, a ...interface{}) { colorPrint(format, FgHiYellow, a...) }
-
-// HiBlue is a convenient helper function to print with hi-intensity blue foreground. A
-// newline is appended to format by default.
-func HiBlue(format string, a ...interface{}) { colorPrint(format, FgHiBlue, a...) }
-
-// HiMagenta is a convenient helper function to print with hi-intensity magenta foreground.
-// A newline is appended to format by default.
-func HiMagenta(format string, a ...interface{}) { colorPrint(format, FgHiMagenta, a...) }
-
-// HiCyan is a convenient helper function to print with hi-intensity cyan foreground. A
-// newline is appended to format by default.
-func HiCyan(format string, a ...interface{}) { colorPrint(format, FgHiCyan, a...) }
-
-// HiWhite is a convenient helper function to print with hi-intensity white foreground. A
-// newline is appended to format by default.
-func HiWhite(format string, a ...interface{}) { colorPrint(format, FgHiWhite, a...) }
-
-// HiBlackString is a convenient helper function to return a string with hi-intensity black
-// foreground.
-func HiBlackString(format string, a ...interface{}) string {
- return colorString(format, FgHiBlack, a...)
-}
-
-// HiRedString is a convenient helper function to return a string with hi-intensity red
-// foreground.
-func HiRedString(format string, a ...interface{}) string { return colorString(format, FgHiRed, a...) }
-
-// HiGreenString is a convenient helper function to return a string with hi-intensity green
-// foreground.
-func HiGreenString(format string, a ...interface{}) string {
- return colorString(format, FgHiGreen, a...)
-}
-
-// HiYellowString is a convenient helper function to return a string with hi-intensity yellow
-// foreground.
-func HiYellowString(format string, a ...interface{}) string {
- return colorString(format, FgHiYellow, a...)
-}
-
-// HiBlueString is a convenient helper function to return a string with hi-intensity blue
-// foreground.
-func HiBlueString(format string, a ...interface{}) string { return colorString(format, FgHiBlue, a...) }
-
-// HiMagentaString is a convenient helper function to return a string with hi-intensity magenta
-// foreground.
-func HiMagentaString(format string, a ...interface{}) string {
- return colorString(format, FgHiMagenta, a...)
-}
-
-// HiCyanString is a convenient helper function to return a string with hi-intensity cyan
-// foreground.
-func HiCyanString(format string, a ...interface{}) string { return colorString(format, FgHiCyan, a...) }
-
-// HiWhiteString is a convenient helper function to return a string with hi-intensity white
-// foreground.
-func HiWhiteString(format string, a ...interface{}) string {
- return colorString(format, FgHiWhite, a...)
-}
diff --git a/vendor/github.com/fatih/color/doc.go b/vendor/github.com/fatih/color/doc.go
deleted file mode 100644
index cf1e96500f4e2736f5c20123238ddc463885107a..0000000000000000000000000000000000000000
--- a/vendor/github.com/fatih/color/doc.go
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-Package color is an ANSI color package to output colorized or SGR defined
-output to the standard output. The API can be used in several way, pick one
-that suits you.
-
-Use simple and default helper functions with predefined foreground colors:
-
- color.Cyan("Prints text in cyan.")
-
- // a newline will be appended automatically
- color.Blue("Prints %s in blue.", "text")
-
- // More default foreground colors..
- color.Red("We have red")
- color.Yellow("Yellow color too!")
- color.Magenta("And many others ..")
-
- // Hi-intensity colors
- color.HiGreen("Bright green color.")
- color.HiBlack("Bright black means gray..")
- color.HiWhite("Shiny white color!")
-
-However there are times where custom color mixes are required. Below are some
-examples to create custom color objects and use the print functions of each
-separate color object.
-
- // Create a new color object
- c := color.New(color.FgCyan).Add(color.Underline)
- c.Println("Prints cyan text with an underline.")
-
- // Or just add them to New()
- d := color.New(color.FgCyan, color.Bold)
- d.Printf("This prints bold cyan %s\n", "too!.")
-
-
- // Mix up foreground and background colors, create new mixes!
- red := color.New(color.FgRed)
-
- boldRed := red.Add(color.Bold)
- boldRed.Println("This will print text in bold red.")
-
- whiteBackground := red.Add(color.BgWhite)
- whiteBackground.Println("Red text with White background.")
-
- // Use your own io.Writer output
- color.New(color.FgBlue).Fprintln(myWriter, "blue color!")
-
- blue := color.New(color.FgBlue)
- blue.Fprint(myWriter, "This will print text in blue.")
-
-You can create PrintXxx functions to simplify even more:
-
- // Create a custom print function for convenient
- red := color.New(color.FgRed).PrintfFunc()
- red("warning")
- red("error: %s", err)
-
- // Mix up multiple attributes
- notice := color.New(color.Bold, color.FgGreen).PrintlnFunc()
- notice("don't forget this...")
-
-You can also FprintXxx functions to pass your own io.Writer:
-
- blue := color.New(FgBlue).FprintfFunc()
- blue(myWriter, "important notice: %s", stars)
-
- // Mix up with multiple attributes
- success := color.New(color.Bold, color.FgGreen).FprintlnFunc()
- success(myWriter, don't forget this...")
-
-
-Or create SprintXxx functions to mix strings with other non-colorized strings:
-
- yellow := New(FgYellow).SprintFunc()
- red := New(FgRed).SprintFunc()
-
- fmt.Printf("this is a %s and this is %s.\n", yellow("warning"), red("error"))
-
- info := New(FgWhite, BgGreen).SprintFunc()
- fmt.Printf("this %s rocks!\n", info("package"))
-
-Windows support is enabled by default. All Print functions work as intended.
-However only for color.SprintXXX functions, user should use fmt.FprintXXX and
-set the output to color.Output:
-
- fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS"))
-
- info := New(FgWhite, BgGreen).SprintFunc()
- fmt.Fprintf(color.Output, "this %s rocks!\n", info("package"))
-
-Using with existing code is possible. Just use the Set() method to set the
-standard output to the given parameters. That way a rewrite of an existing
-code is not required.
-
- // Use handy standard colors.
- color.Set(color.FgYellow)
-
- fmt.Println("Existing text will be now in Yellow")
- fmt.Printf("This one %s\n", "too")
-
- color.Unset() // don't forget to unset
-
- // You can mix up parameters
- color.Set(color.FgMagenta, color.Bold)
- defer color.Unset() // use it in your function
-
- fmt.Println("All text will be now bold magenta.")
-
-There might be a case where you want to disable color output (for example to
-pipe the standard output of your app to somewhere else). `Color` has support to
-disable colors both globally and for single color definition. For example
-suppose you have a CLI app and a `--no-color` bool flag. You can easily disable
-the color output with:
-
- var flagNoColor = flag.Bool("no-color", false, "Disable color output")
-
- if *flagNoColor {
- color.NoColor = true // disables colorized output
- }
-
-It also has support for single color definitions (local). You can
-disable/enable color output on the fly:
-
- c := color.New(color.FgCyan)
- c.Println("Prints cyan text")
-
- c.DisableColor()
- c.Println("This is printed without any color")
-
- c.EnableColor()
- c.Println("This prints again cyan...")
-*/
-package color
diff --git a/vendor/github.com/go-errors/errors/.travis.yml b/vendor/github.com/go-errors/errors/.travis.yml
deleted file mode 100644
index 9d00fdd5d66e068e8edf2f5e18c66261b350d331..0000000000000000000000000000000000000000
--- a/vendor/github.com/go-errors/errors/.travis.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-language: go
-
-go:
- - "1.8.x"
- - "1.10.x"
diff --git a/vendor/github.com/go-errors/errors/LICENSE.MIT b/vendor/github.com/go-errors/errors/LICENSE.MIT
deleted file mode 100644
index c9a5b2eeb751599d9d6c8396241561e0df3c9586..0000000000000000000000000000000000000000
--- a/vendor/github.com/go-errors/errors/LICENSE.MIT
+++ /dev/null
@@ -1,7 +0,0 @@
-Copyright (c) 2015 Conrad Irwin
-
-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/go-errors/errors/README.md b/vendor/github.com/go-errors/errors/README.md
deleted file mode 100644
index 5d4f1873ddfe24c7c79578ca6d59053bca351411..0000000000000000000000000000000000000000
--- a/vendor/github.com/go-errors/errors/README.md
+++ /dev/null
@@ -1,66 +0,0 @@
-go-errors/errors
-================
-
-[](https://travis-ci.org/go-errors/errors)
-
-Package errors adds stacktrace support to errors in go.
-
-This is particularly useful when you want to understand the state of execution
-when an error was returned unexpectedly.
-
-It provides the type \*Error which implements the standard golang error
-interface, so you can use this library interchangably with code that is
-expecting a normal error return.
-
-Usage
------
-
-Full documentation is available on
-[godoc](https://godoc.org/github.com/go-errors/errors), but here's a simple
-example:
-
-```go
-package crashy
-
-import "github.com/go-errors/errors"
-
-var Crashed = errors.Errorf("oh dear")
-
-func Crash() error {
- return errors.New(Crashed)
-}
-```
-
-This can be called as follows:
-
-```go
-package main
-
-import (
- "crashy"
- "fmt"
- "github.com/go-errors/errors"
-)
-
-func main() {
- err := crashy.Crash()
- if err != nil {
- if errors.Is(err, crashy.Crashed) {
- fmt.Println(err.(*errors.Error).ErrorStack())
- } else {
- panic(err)
- }
- }
-}
-```
-
-Meta-fu
--------
-
-This package was original written to allow reporting to
-[Bugsnag](https://bugsnag.com/) from
-[bugsnag-go](https://github.com/bugsnag/bugsnag-go), but after I found similar
-packages by Facebook and Dropbox, it was moved to one canonical location so
-everyone can benefit.
-
-This package is licensed under the MIT license, see LICENSE.MIT for details.
diff --git a/vendor/github.com/go-errors/errors/cover.out b/vendor/github.com/go-errors/errors/cover.out
deleted file mode 100644
index ab18b0519fcc0a57c0c6b568f00a2f25516e3836..0000000000000000000000000000000000000000
--- a/vendor/github.com/go-errors/errors/cover.out
+++ /dev/null
@@ -1,89 +0,0 @@
-mode: set
-github.com/go-errors/errors/stackframe.go:27.51,30.25 2 1
-github.com/go-errors/errors/stackframe.go:33.2,38.8 3 1
-github.com/go-errors/errors/stackframe.go:30.25,32.3 1 0
-github.com/go-errors/errors/stackframe.go:43.47,44.31 1 1
-github.com/go-errors/errors/stackframe.go:47.2,47.48 1 1
-github.com/go-errors/errors/stackframe.go:44.31,46.3 1 1
-github.com/go-errors/errors/stackframe.go:52.42,56.16 3 1
-github.com/go-errors/errors/stackframe.go:60.2,60.60 1 1
-github.com/go-errors/errors/stackframe.go:56.16,58.3 1 0
-github.com/go-errors/errors/stackframe.go:64.55,67.16 2 1
-github.com/go-errors/errors/stackframe.go:71.2,72.61 2 1
-github.com/go-errors/errors/stackframe.go:76.2,76.66 1 1
-github.com/go-errors/errors/stackframe.go:67.16,69.3 1 0
-github.com/go-errors/errors/stackframe.go:72.61,74.3 1 0
-github.com/go-errors/errors/stackframe.go:79.56,91.63 3 1
-github.com/go-errors/errors/stackframe.go:95.2,95.53 1 1
-github.com/go-errors/errors/stackframe.go:100.2,101.18 2 1
-github.com/go-errors/errors/stackframe.go:91.63,94.3 2 1
-github.com/go-errors/errors/stackframe.go:95.53,98.3 2 1
-github.com/go-errors/errors/error.go:70.32,73.23 2 1
-github.com/go-errors/errors/error.go:80.2,85.3 3 1
-github.com/go-errors/errors/error.go:74.2,75.10 1 1
-github.com/go-errors/errors/error.go:76.2,77.28 1 1
-github.com/go-errors/errors/error.go:92.43,95.23 2 1
-github.com/go-errors/errors/error.go:104.2,109.3 3 1
-github.com/go-errors/errors/error.go:96.2,97.11 1 1
-github.com/go-errors/errors/error.go:98.2,99.10 1 1
-github.com/go-errors/errors/error.go:100.2,101.28 1 1
-github.com/go-errors/errors/error.go:115.39,117.19 1 1
-github.com/go-errors/errors/error.go:121.2,121.29 1 1
-github.com/go-errors/errors/error.go:125.2,125.43 1 1
-github.com/go-errors/errors/error.go:129.2,129.14 1 1
-github.com/go-errors/errors/error.go:117.19,119.3 1 1
-github.com/go-errors/errors/error.go:121.29,123.3 1 1
-github.com/go-errors/errors/error.go:125.43,127.3 1 1
-github.com/go-errors/errors/error.go:135.53,137.2 1 1
-github.com/go-errors/errors/error.go:140.34,142.2 1 1
-github.com/go-errors/errors/error.go:146.34,149.42 2 1
-github.com/go-errors/errors/error.go:153.2,153.20 1 1
-github.com/go-errors/errors/error.go:149.42,151.3 1 1
-github.com/go-errors/errors/error.go:158.39,160.2 1 1
-github.com/go-errors/errors/error.go:164.46,165.23 1 1
-github.com/go-errors/errors/error.go:173.2,173.19 1 1
-github.com/go-errors/errors/error.go:165.23,168.32 2 1
-github.com/go-errors/errors/error.go:168.32,170.4 1 1
-github.com/go-errors/errors/error.go:177.37,178.42 1 1
-github.com/go-errors/errors/error.go:181.2,181.41 1 1
-github.com/go-errors/errors/error.go:178.42,180.3 1 1
-github.com/go-errors/errors/parse_panic.go:10.39,12.2 1 1
-github.com/go-errors/errors/parse_panic.go:16.46,24.34 5 1
-github.com/go-errors/errors/parse_panic.go:70.2,70.43 1 1
-github.com/go-errors/errors/parse_panic.go:73.2,73.55 1 0
-github.com/go-errors/errors/parse_panic.go:24.34,27.23 2 1
-github.com/go-errors/errors/parse_panic.go:27.23,28.42 1 1
-github.com/go-errors/errors/parse_panic.go:28.42,31.5 2 1
-github.com/go-errors/errors/parse_panic.go:31.6,33.5 1 0
-github.com/go-errors/errors/parse_panic.go:35.5,35.29 1 1
-github.com/go-errors/errors/parse_panic.go:35.29,36.86 1 1
-github.com/go-errors/errors/parse_panic.go:36.86,38.5 1 1
-github.com/go-errors/errors/parse_panic.go:40.5,40.32 1 1
-github.com/go-errors/errors/parse_panic.go:40.32,41.18 1 1
-github.com/go-errors/errors/parse_panic.go:45.4,46.46 2 1
-github.com/go-errors/errors/parse_panic.go:51.4,53.23 2 1
-github.com/go-errors/errors/parse_panic.go:57.4,58.18 2 1
-github.com/go-errors/errors/parse_panic.go:62.4,63.17 2 1
-github.com/go-errors/errors/parse_panic.go:41.18,43.10 2 1
-github.com/go-errors/errors/parse_panic.go:46.46,49.5 2 1
-github.com/go-errors/errors/parse_panic.go:53.23,55.5 1 0
-github.com/go-errors/errors/parse_panic.go:58.18,60.5 1 0
-github.com/go-errors/errors/parse_panic.go:63.17,65.10 2 1
-github.com/go-errors/errors/parse_panic.go:70.43,72.3 1 1
-github.com/go-errors/errors/parse_panic.go:80.85,82.29 2 1
-github.com/go-errors/errors/parse_panic.go:85.2,85.15 1 1
-github.com/go-errors/errors/parse_panic.go:88.2,90.63 2 1
-github.com/go-errors/errors/parse_panic.go:94.2,94.53 1 1
-github.com/go-errors/errors/parse_panic.go:99.2,101.36 2 1
-github.com/go-errors/errors/parse_panic.go:105.2,106.15 2 1
-github.com/go-errors/errors/parse_panic.go:109.2,112.49 3 1
-github.com/go-errors/errors/parse_panic.go:116.2,117.16 2 1
-github.com/go-errors/errors/parse_panic.go:121.2,126.8 1 1
-github.com/go-errors/errors/parse_panic.go:82.29,84.3 1 0
-github.com/go-errors/errors/parse_panic.go:85.15,87.3 1 1
-github.com/go-errors/errors/parse_panic.go:90.63,93.3 2 1
-github.com/go-errors/errors/parse_panic.go:94.53,97.3 2 1
-github.com/go-errors/errors/parse_panic.go:101.36,103.3 1 0
-github.com/go-errors/errors/parse_panic.go:106.15,108.3 1 0
-github.com/go-errors/errors/parse_panic.go:112.49,114.3 1 1
-github.com/go-errors/errors/parse_panic.go:117.16,119.3 1 0
diff --git a/vendor/github.com/go-errors/errors/error.go b/vendor/github.com/go-errors/errors/error.go
deleted file mode 100644
index 60062a4372bc85048cec6646bc44f1304ada4cd6..0000000000000000000000000000000000000000
--- a/vendor/github.com/go-errors/errors/error.go
+++ /dev/null
@@ -1,217 +0,0 @@
-// Package errors provides errors that have stack-traces.
-//
-// This is particularly useful when you want to understand the
-// state of execution when an error was returned unexpectedly.
-//
-// It provides the type *Error which implements the standard
-// golang error interface, so you can use this library interchangably
-// with code that is expecting a normal error return.
-//
-// For example:
-//
-// package crashy
-//
-// import "github.com/go-errors/errors"
-//
-// var Crashed = errors.Errorf("oh dear")
-//
-// func Crash() error {
-// return errors.New(Crashed)
-// }
-//
-// This can be called as follows:
-//
-// package main
-//
-// import (
-// "crashy"
-// "fmt"
-// "github.com/go-errors/errors"
-// )
-//
-// func main() {
-// err := crashy.Crash()
-// if err != nil {
-// if errors.Is(err, crashy.Crashed) {
-// fmt.Println(err.(*errors.Error).ErrorStack())
-// } else {
-// panic(err)
-// }
-// }
-// }
-//
-// This package was original written to allow reporting to Bugsnag,
-// but after I found similar packages by Facebook and Dropbox, it
-// was moved to one canonical location so everyone can benefit.
-package errors
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "runtime"
-)
-
-// The maximum number of stackframes on any error.
-var MaxStackDepth = 50
-
-// Error is an error with an attached stacktrace. It can be used
-// wherever the builtin error interface is expected.
-type Error struct {
- Err error
- stack []uintptr
- frames []StackFrame
- prefix string
-}
-
-// New makes an Error from the given value. If that value is already an
-// error then it will be used directly, if not, it will be passed to
-// fmt.Errorf("%v"). The stacktrace will point to the line of code that
-// called New.
-func New(e interface{}) *Error {
- var err error
-
- switch e := e.(type) {
- case error:
- err = e
- default:
- err = fmt.Errorf("%v", e)
- }
-
- stack := make([]uintptr, MaxStackDepth)
- length := runtime.Callers(2, stack[:])
- return &Error{
- Err: err,
- stack: stack[:length],
- }
-}
-
-// Wrap makes an Error from the given value. If that value is already an
-// error then it will be used directly, if not, it will be passed to
-// fmt.Errorf("%v"). The skip parameter indicates how far up the stack
-// to start the stacktrace. 0 is from the current call, 1 from its caller, etc.
-func Wrap(e interface{}, skip int) *Error {
- var err error
-
- switch e := e.(type) {
- case *Error:
- return e
- case error:
- err = e
- default:
- err = fmt.Errorf("%v", e)
- }
-
- stack := make([]uintptr, MaxStackDepth)
- length := runtime.Callers(2+skip, stack[:])
- return &Error{
- Err: err,
- stack: stack[:length],
- }
-}
-
-// WrapPrefix makes an Error from the given value. If that value is already an
-// error then it will be used directly, if not, it will be passed to
-// fmt.Errorf("%v"). The prefix parameter is used to add a prefix to the
-// error message when calling Error(). The skip parameter indicates how far
-// up the stack to start the stacktrace. 0 is from the current call,
-// 1 from its caller, etc.
-func WrapPrefix(e interface{}, prefix string, skip int) *Error {
-
- err := Wrap(e, 1+skip)
-
- if err.prefix != "" {
- prefix = fmt.Sprintf("%s: %s", prefix, err.prefix)
- }
-
- return &Error{
- Err: err.Err,
- stack: err.stack,
- prefix: prefix,
- }
-
-}
-
-// Is detects whether the error is equal to a given error. Errors
-// are considered equal by this function if they are the same object,
-// or if they both contain the same error inside an errors.Error.
-func Is(e error, original error) bool {
-
- if e == original {
- return true
- }
-
- if e, ok := e.(*Error); ok {
- return Is(e.Err, original)
- }
-
- if original, ok := original.(*Error); ok {
- return Is(e, original.Err)
- }
-
- return false
-}
-
-// Errorf creates a new error with the given message. You can use it
-// as a drop-in replacement for fmt.Errorf() to provide descriptive
-// errors in return values.
-func Errorf(format string, a ...interface{}) *Error {
- return Wrap(fmt.Errorf(format, a...), 1)
-}
-
-// Error returns the underlying error's message.
-func (err *Error) Error() string {
-
- msg := err.Err.Error()
- if err.prefix != "" {
- msg = fmt.Sprintf("%s: %s", err.prefix, msg)
- }
-
- return msg
-}
-
-// Stack returns the callstack formatted the same way that go does
-// in runtime/debug.Stack()
-func (err *Error) Stack() []byte {
- buf := bytes.Buffer{}
-
- for _, frame := range err.StackFrames() {
- buf.WriteString(frame.String())
- }
-
- return buf.Bytes()
-}
-
-// Callers satisfies the bugsnag ErrorWithCallerS() interface
-// so that the stack can be read out.
-func (err *Error) Callers() []uintptr {
- return err.stack
-}
-
-// ErrorStack returns a string that contains both the
-// error message and the callstack.
-func (err *Error) ErrorStack() string {
- return err.TypeName() + " " + err.Error() + "\n" + string(err.Stack())
-}
-
-// StackFrames returns an array of frames containing information about the
-// stack.
-func (err *Error) StackFrames() []StackFrame {
- if err.frames == nil {
- err.frames = make([]StackFrame, len(err.stack))
-
- for i, pc := range err.stack {
- err.frames[i] = NewStackFrame(pc)
- }
- }
-
- return err.frames
-}
-
-// TypeName returns the type this error. e.g. *errors.stringError.
-func (err *Error) TypeName() string {
- if _, ok := err.Err.(uncaughtPanic); ok {
- return "panic"
- }
- return reflect.TypeOf(err.Err).String()
-}
diff --git a/vendor/github.com/go-errors/errors/parse_panic.go b/vendor/github.com/go-errors/errors/parse_panic.go
deleted file mode 100644
index cc37052d786022b19fe8c0a39242b79dfa097ebf..0000000000000000000000000000000000000000
--- a/vendor/github.com/go-errors/errors/parse_panic.go
+++ /dev/null
@@ -1,127 +0,0 @@
-package errors
-
-import (
- "strconv"
- "strings"
-)
-
-type uncaughtPanic struct{ message string }
-
-func (p uncaughtPanic) Error() string {
- return p.message
-}
-
-// ParsePanic allows you to get an error object from the output of a go program
-// that panicked. This is particularly useful with https://github.com/mitchellh/panicwrap.
-func ParsePanic(text string) (*Error, error) {
- lines := strings.Split(text, "\n")
-
- state := "start"
-
- var message string
- var stack []StackFrame
-
- for i := 0; i < len(lines); i++ {
- line := lines[i]
-
- if state == "start" {
- if strings.HasPrefix(line, "panic: ") {
- message = strings.TrimPrefix(line, "panic: ")
- state = "seek"
- } else {
- return nil, Errorf("bugsnag.panicParser: Invalid line (no prefix): %s", line)
- }
-
- } else if state == "seek" {
- if strings.HasPrefix(line, "goroutine ") && strings.HasSuffix(line, "[running]:") {
- state = "parsing"
- }
-
- } else if state == "parsing" {
- if line == "" {
- state = "done"
- break
- }
- createdBy := false
- if strings.HasPrefix(line, "created by ") {
- line = strings.TrimPrefix(line, "created by ")
- createdBy = true
- }
-
- i++
-
- if i >= len(lines) {
- return nil, Errorf("bugsnag.panicParser: Invalid line (unpaired): %s", line)
- }
-
- frame, err := parsePanicFrame(line, lines[i], createdBy)
- if err != nil {
- return nil, err
- }
-
- stack = append(stack, *frame)
- if createdBy {
- state = "done"
- break
- }
- }
- }
-
- if state == "done" || state == "parsing" {
- return &Error{Err: uncaughtPanic{message}, frames: stack}, nil
- }
- return nil, Errorf("could not parse panic: %v", text)
-}
-
-// The lines we're passing look like this:
-//
-// main.(*foo).destruct(0xc208067e98)
-// /0/go/src/github.com/bugsnag/bugsnag-go/pan/main.go:22 +0x151
-func parsePanicFrame(name string, line string, createdBy bool) (*StackFrame, error) {
- idx := strings.LastIndex(name, "(")
- if idx == -1 && !createdBy {
- return nil, Errorf("bugsnag.panicParser: Invalid line (no call): %s", name)
- }
- if idx != -1 {
- name = name[:idx]
- }
- pkg := ""
-
- if lastslash := strings.LastIndex(name, "/"); lastslash >= 0 {
- pkg += name[:lastslash] + "/"
- name = name[lastslash+1:]
- }
- if period := strings.Index(name, "."); period >= 0 {
- pkg += name[:period]
- name = name[period+1:]
- }
-
- name = strings.Replace(name, "·", ".", -1)
-
- if !strings.HasPrefix(line, "\t") {
- return nil, Errorf("bugsnag.panicParser: Invalid line (no tab): %s", line)
- }
-
- idx = strings.LastIndex(line, ":")
- if idx == -1 {
- return nil, Errorf("bugsnag.panicParser: Invalid line (no line number): %s", line)
- }
- file := line[1:idx]
-
- number := line[idx+1:]
- if idx = strings.Index(number, " +"); idx > -1 {
- number = number[:idx]
- }
-
- lno, err := strconv.ParseInt(number, 10, 32)
- if err != nil {
- return nil, Errorf("bugsnag.panicParser: Invalid line (bad line number): %s", line)
- }
-
- return &StackFrame{
- File: file,
- LineNumber: int(lno),
- Package: pkg,
- Name: name,
- }, nil
-}
diff --git a/vendor/github.com/go-errors/errors/stackframe.go b/vendor/github.com/go-errors/errors/stackframe.go
deleted file mode 100644
index 750ab9a52153ef61128a6f080085e97ce8d68bf8..0000000000000000000000000000000000000000
--- a/vendor/github.com/go-errors/errors/stackframe.go
+++ /dev/null
@@ -1,102 +0,0 @@
-package errors
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "runtime"
- "strings"
-)
-
-// A StackFrame contains all necessary information about to generate a line
-// in a callstack.
-type StackFrame struct {
- // The path to the file containing this ProgramCounter
- File string
- // The LineNumber in that file
- LineNumber int
- // The Name of the function that contains this ProgramCounter
- Name string
- // The Package that contains this function
- Package string
- // The underlying ProgramCounter
- ProgramCounter uintptr
-}
-
-// NewStackFrame popoulates a stack frame object from the program counter.
-func NewStackFrame(pc uintptr) (frame StackFrame) {
-
- frame = StackFrame{ProgramCounter: pc}
- if frame.Func() == nil {
- return
- }
- frame.Package, frame.Name = packageAndName(frame.Func())
-
- // pc -1 because the program counters we use are usually return addresses,
- // and we want to show the line that corresponds to the function call
- frame.File, frame.LineNumber = frame.Func().FileLine(pc - 1)
- return
-
-}
-
-// Func returns the function that contained this frame.
-func (frame *StackFrame) Func() *runtime.Func {
- if frame.ProgramCounter == 0 {
- return nil
- }
- return runtime.FuncForPC(frame.ProgramCounter)
-}
-
-// String returns the stackframe formatted in the same way as go does
-// in runtime/debug.Stack()
-func (frame *StackFrame) String() string {
- str := fmt.Sprintf("%s:%d (0x%x)\n", frame.File, frame.LineNumber, frame.ProgramCounter)
-
- source, err := frame.SourceLine()
- if err != nil {
- return str
- }
-
- return str + fmt.Sprintf("\t%s: %s\n", frame.Name, source)
-}
-
-// SourceLine gets the line of code (from File and Line) of the original source if possible.
-func (frame *StackFrame) SourceLine() (string, error) {
- data, err := ioutil.ReadFile(frame.File)
-
- if err != nil {
- return "", New(err)
- }
-
- lines := bytes.Split(data, []byte{'\n'})
- if frame.LineNumber <= 0 || frame.LineNumber >= len(lines) {
- return "???", nil
- }
- // -1 because line-numbers are 1 based, but our array is 0 based
- return string(bytes.Trim(lines[frame.LineNumber-1], " \t")), nil
-}
-
-func packageAndName(fn *runtime.Func) (string, string) {
- name := fn.Name()
- pkg := ""
-
- // The name includes the path name to the package, which is unnecessary
- // since the file name is already included. Plus, it has center dots.
- // That is, we see
- // runtime/debug.*T·ptrmethod
- // and want
- // *T.ptrmethod
- // Since the package path might contains dots (e.g. code.google.com/...),
- // we first remove the path prefix if there is one.
- if lastslash := strings.LastIndex(name, "/"); lastslash >= 0 {
- pkg += name[:lastslash] + "/"
- name = name[lastslash+1:]
- }
- if period := strings.Index(name, "."); period >= 0 {
- pkg += name[:period]
- name = name[period+1:]
- }
-
- name = strings.Replace(name, "·", ".", -1)
- return pkg, name
-}
diff --git a/vendor/github.com/golang/protobuf/AUTHORS b/vendor/github.com/golang/protobuf/AUTHORS
deleted file mode 100644
index 15167cd746c560e5b3d3b233a169aa64d3e9101e..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code refers to The Go Authors for copyright purposes.
-# The master list of authors is in the main Go distribution,
-# visible at http://tip.golang.org/AUTHORS.
diff --git a/vendor/github.com/golang/protobuf/CONTRIBUTORS b/vendor/github.com/golang/protobuf/CONTRIBUTORS
deleted file mode 100644
index 1c4577e9680611383f46044d17fa343a96997c3c..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/CONTRIBUTORS
+++ /dev/null
@@ -1,3 +0,0 @@
-# This source code was written by the Go contributors.
-# The master list of contributors is in the main Go distribution,
-# visible at http://tip.golang.org/CONTRIBUTORS.
diff --git a/vendor/github.com/golang/protobuf/LICENSE b/vendor/github.com/golang/protobuf/LICENSE
deleted file mode 100644
index 0f646931a4627fbe7c4259f3fb0337d04d798d8e..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright 2010 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-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
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/vendor/github.com/golang/protobuf/proto/clone.go b/vendor/github.com/golang/protobuf/proto/clone.go
deleted file mode 100644
index 3cd3249f706241d57b2b79f36de043bfac488449..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/clone.go
+++ /dev/null
@@ -1,253 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Protocol buffer deep copy and merge.
-// TODO: RawMessage.
-
-package proto
-
-import (
- "fmt"
- "log"
- "reflect"
- "strings"
-)
-
-// Clone returns a deep copy of a protocol buffer.
-func Clone(src Message) Message {
- in := reflect.ValueOf(src)
- if in.IsNil() {
- return src
- }
- out := reflect.New(in.Type().Elem())
- dst := out.Interface().(Message)
- Merge(dst, src)
- return dst
-}
-
-// Merger is the interface representing objects that can merge messages of the same type.
-type Merger interface {
- // Merge merges src into this message.
- // Required and optional fields that are set in src will be set to that value in dst.
- // Elements of repeated fields will be appended.
- //
- // Merge may panic if called with a different argument type than the receiver.
- Merge(src Message)
-}
-
-// generatedMerger is the custom merge method that generated protos will have.
-// We must add this method since a generate Merge method will conflict with
-// many existing protos that have a Merge data field already defined.
-type generatedMerger interface {
- XXX_Merge(src Message)
-}
-
-// Merge merges src into dst.
-// Required and optional fields that are set in src will be set to that value in dst.
-// Elements of repeated fields will be appended.
-// Merge panics if src and dst are not the same type, or if dst is nil.
-func Merge(dst, src Message) {
- if m, ok := dst.(Merger); ok {
- m.Merge(src)
- return
- }
-
- in := reflect.ValueOf(src)
- out := reflect.ValueOf(dst)
- if out.IsNil() {
- panic("proto: nil destination")
- }
- if in.Type() != out.Type() {
- panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src))
- }
- if in.IsNil() {
- return // Merge from nil src is a noop
- }
- if m, ok := dst.(generatedMerger); ok {
- m.XXX_Merge(src)
- return
- }
- mergeStruct(out.Elem(), in.Elem())
-}
-
-func mergeStruct(out, in reflect.Value) {
- sprop := GetProperties(in.Type())
- for i := 0; i < in.NumField(); i++ {
- f := in.Type().Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- mergeAny(out.Field(i), in.Field(i), false, sprop.Prop[i])
- }
-
- if emIn, err := extendable(in.Addr().Interface()); err == nil {
- emOut, _ := extendable(out.Addr().Interface())
- mIn, muIn := emIn.extensionsRead()
- if mIn != nil {
- mOut := emOut.extensionsWrite()
- muIn.Lock()
- mergeExtension(mOut, mIn)
- muIn.Unlock()
- }
- }
-
- uf := in.FieldByName("XXX_unrecognized")
- if !uf.IsValid() {
- return
- }
- uin := uf.Bytes()
- if len(uin) > 0 {
- out.FieldByName("XXX_unrecognized").SetBytes(append([]byte(nil), uin...))
- }
-}
-
-// mergeAny performs a merge between two values of the same type.
-// viaPtr indicates whether the values were indirected through a pointer (implying proto2).
-// prop is set if this is a struct field (it may be nil).
-func mergeAny(out, in reflect.Value, viaPtr bool, prop *Properties) {
- if in.Type() == protoMessageType {
- if !in.IsNil() {
- if out.IsNil() {
- out.Set(reflect.ValueOf(Clone(in.Interface().(Message))))
- } else {
- Merge(out.Interface().(Message), in.Interface().(Message))
- }
- }
- return
- }
- switch in.Kind() {
- case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,
- reflect.String, reflect.Uint32, reflect.Uint64:
- if !viaPtr && isProto3Zero(in) {
- return
- }
- out.Set(in)
- case reflect.Interface:
- // Probably a oneof field; copy non-nil values.
- if in.IsNil() {
- return
- }
- // Allocate destination if it is not set, or set to a different type.
- // Otherwise we will merge as normal.
- if out.IsNil() || out.Elem().Type() != in.Elem().Type() {
- out.Set(reflect.New(in.Elem().Elem().Type())) // interface -> *T -> T -> new(T)
- }
- mergeAny(out.Elem(), in.Elem(), false, nil)
- case reflect.Map:
- if in.Len() == 0 {
- return
- }
- if out.IsNil() {
- out.Set(reflect.MakeMap(in.Type()))
- }
- // For maps with value types of *T or []byte we need to deep copy each value.
- elemKind := in.Type().Elem().Kind()
- for _, key := range in.MapKeys() {
- var val reflect.Value
- switch elemKind {
- case reflect.Ptr:
- val = reflect.New(in.Type().Elem().Elem())
- mergeAny(val, in.MapIndex(key), false, nil)
- case reflect.Slice:
- val = in.MapIndex(key)
- val = reflect.ValueOf(append([]byte{}, val.Bytes()...))
- default:
- val = in.MapIndex(key)
- }
- out.SetMapIndex(key, val)
- }
- case reflect.Ptr:
- if in.IsNil() {
- return
- }
- if out.IsNil() {
- out.Set(reflect.New(in.Elem().Type()))
- }
- mergeAny(out.Elem(), in.Elem(), true, nil)
- case reflect.Slice:
- if in.IsNil() {
- return
- }
- if in.Type().Elem().Kind() == reflect.Uint8 {
- // []byte is a scalar bytes field, not a repeated field.
-
- // Edge case: if this is in a proto3 message, a zero length
- // bytes field is considered the zero value, and should not
- // be merged.
- if prop != nil && prop.proto3 && in.Len() == 0 {
- return
- }
-
- // Make a deep copy.
- // Append to []byte{} instead of []byte(nil) so that we never end up
- // with a nil result.
- out.SetBytes(append([]byte{}, in.Bytes()...))
- return
- }
- n := in.Len()
- if out.IsNil() {
- out.Set(reflect.MakeSlice(in.Type(), 0, n))
- }
- switch in.Type().Elem().Kind() {
- case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64,
- reflect.String, reflect.Uint32, reflect.Uint64:
- out.Set(reflect.AppendSlice(out, in))
- default:
- for i := 0; i < n; i++ {
- x := reflect.Indirect(reflect.New(in.Type().Elem()))
- mergeAny(x, in.Index(i), false, nil)
- out.Set(reflect.Append(out, x))
- }
- }
- case reflect.Struct:
- mergeStruct(out, in)
- default:
- // unknown type, so not a protocol buffer
- log.Printf("proto: don't know how to copy %v", in)
- }
-}
-
-func mergeExtension(out, in map[int32]Extension) {
- for extNum, eIn := range in {
- eOut := Extension{desc: eIn.desc}
- if eIn.value != nil {
- v := reflect.New(reflect.TypeOf(eIn.value)).Elem()
- mergeAny(v, reflect.ValueOf(eIn.value), false, nil)
- eOut.value = v.Interface()
- }
- if eIn.enc != nil {
- eOut.enc = make([]byte, len(eIn.enc))
- copy(eOut.enc, eIn.enc)
- }
-
- out[extNum] = eOut
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/decode.go b/vendor/github.com/golang/protobuf/proto/decode.go
deleted file mode 100644
index d9aa3c42d666ec2503c322d567c035a0a884ee24..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/decode.go
+++ /dev/null
@@ -1,428 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Routines for decoding protocol buffer data to construct in-memory representations.
- */
-
-import (
- "errors"
- "fmt"
- "io"
-)
-
-// errOverflow is returned when an integer is too large to be represented.
-var errOverflow = errors.New("proto: integer overflow")
-
-// ErrInternalBadWireType is returned by generated code when an incorrect
-// wire type is encountered. It does not get returned to user code.
-var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof")
-
-// DecodeVarint reads a varint-encoded integer from the slice.
-// It returns the integer and the number of bytes consumed, or
-// zero if there is not enough.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func DecodeVarint(buf []byte) (x uint64, n int) {
- for shift := uint(0); shift < 64; shift += 7 {
- if n >= len(buf) {
- return 0, 0
- }
- b := uint64(buf[n])
- n++
- x |= (b & 0x7F) << shift
- if (b & 0x80) == 0 {
- return x, n
- }
- }
-
- // The number is too large to represent in a 64-bit value.
- return 0, 0
-}
-
-func (p *Buffer) decodeVarintSlow() (x uint64, err error) {
- i := p.index
- l := len(p.buf)
-
- for shift := uint(0); shift < 64; shift += 7 {
- if i >= l {
- err = io.ErrUnexpectedEOF
- return
- }
- b := p.buf[i]
- i++
- x |= (uint64(b) & 0x7F) << shift
- if b < 0x80 {
- p.index = i
- return
- }
- }
-
- // The number is too large to represent in a 64-bit value.
- err = errOverflow
- return
-}
-
-// DecodeVarint reads a varint-encoded integer from the Buffer.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func (p *Buffer) DecodeVarint() (x uint64, err error) {
- i := p.index
- buf := p.buf
-
- if i >= len(buf) {
- return 0, io.ErrUnexpectedEOF
- } else if buf[i] < 0x80 {
- p.index++
- return uint64(buf[i]), nil
- } else if len(buf)-i < 10 {
- return p.decodeVarintSlow()
- }
-
- var b uint64
- // we already checked the first byte
- x = uint64(buf[i]) - 0x80
- i++
-
- b = uint64(buf[i])
- i++
- x += b << 7
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 7
-
- b = uint64(buf[i])
- i++
- x += b << 14
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 14
-
- b = uint64(buf[i])
- i++
- x += b << 21
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 21
-
- b = uint64(buf[i])
- i++
- x += b << 28
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 28
-
- b = uint64(buf[i])
- i++
- x += b << 35
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 35
-
- b = uint64(buf[i])
- i++
- x += b << 42
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 42
-
- b = uint64(buf[i])
- i++
- x += b << 49
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 49
-
- b = uint64(buf[i])
- i++
- x += b << 56
- if b&0x80 == 0 {
- goto done
- }
- x -= 0x80 << 56
-
- b = uint64(buf[i])
- i++
- x += b << 63
- if b&0x80 == 0 {
- goto done
- }
- // x -= 0x80 << 63 // Always zero.
-
- return 0, errOverflow
-
-done:
- p.index = i
- return x, nil
-}
-
-// DecodeFixed64 reads a 64-bit integer from the Buffer.
-// This is the format for the
-// fixed64, sfixed64, and double protocol buffer types.
-func (p *Buffer) DecodeFixed64() (x uint64, err error) {
- // x, err already 0
- i := p.index + 8
- if i < 0 || i > len(p.buf) {
- err = io.ErrUnexpectedEOF
- return
- }
- p.index = i
-
- x = uint64(p.buf[i-8])
- x |= uint64(p.buf[i-7]) << 8
- x |= uint64(p.buf[i-6]) << 16
- x |= uint64(p.buf[i-5]) << 24
- x |= uint64(p.buf[i-4]) << 32
- x |= uint64(p.buf[i-3]) << 40
- x |= uint64(p.buf[i-2]) << 48
- x |= uint64(p.buf[i-1]) << 56
- return
-}
-
-// DecodeFixed32 reads a 32-bit integer from the Buffer.
-// This is the format for the
-// fixed32, sfixed32, and float protocol buffer types.
-func (p *Buffer) DecodeFixed32() (x uint64, err error) {
- // x, err already 0
- i := p.index + 4
- if i < 0 || i > len(p.buf) {
- err = io.ErrUnexpectedEOF
- return
- }
- p.index = i
-
- x = uint64(p.buf[i-4])
- x |= uint64(p.buf[i-3]) << 8
- x |= uint64(p.buf[i-2]) << 16
- x |= uint64(p.buf[i-1]) << 24
- return
-}
-
-// DecodeZigzag64 reads a zigzag-encoded 64-bit integer
-// from the Buffer.
-// This is the format used for the sint64 protocol buffer type.
-func (p *Buffer) DecodeZigzag64() (x uint64, err error) {
- x, err = p.DecodeVarint()
- if err != nil {
- return
- }
- x = (x >> 1) ^ uint64((int64(x&1)<<63)>>63)
- return
-}
-
-// DecodeZigzag32 reads a zigzag-encoded 32-bit integer
-// from the Buffer.
-// This is the format used for the sint32 protocol buffer type.
-func (p *Buffer) DecodeZigzag32() (x uint64, err error) {
- x, err = p.DecodeVarint()
- if err != nil {
- return
- }
- x = uint64((uint32(x) >> 1) ^ uint32((int32(x&1)<<31)>>31))
- return
-}
-
-// DecodeRawBytes reads a count-delimited byte buffer from the Buffer.
-// This is the format used for the bytes protocol buffer
-// type and for embedded messages.
-func (p *Buffer) DecodeRawBytes(alloc bool) (buf []byte, err error) {
- n, err := p.DecodeVarint()
- if err != nil {
- return nil, err
- }
-
- nb := int(n)
- if nb < 0 {
- return nil, fmt.Errorf("proto: bad byte length %d", nb)
- }
- end := p.index + nb
- if end < p.index || end > len(p.buf) {
- return nil, io.ErrUnexpectedEOF
- }
-
- if !alloc {
- // todo: check if can get more uses of alloc=false
- buf = p.buf[p.index:end]
- p.index += nb
- return
- }
-
- buf = make([]byte, nb)
- copy(buf, p.buf[p.index:])
- p.index += nb
- return
-}
-
-// DecodeStringBytes reads an encoded string from the Buffer.
-// This is the format used for the proto2 string type.
-func (p *Buffer) DecodeStringBytes() (s string, err error) {
- buf, err := p.DecodeRawBytes(false)
- if err != nil {
- return
- }
- return string(buf), nil
-}
-
-// Unmarshaler is the interface representing objects that can
-// unmarshal themselves. The argument points to data that may be
-// overwritten, so implementations should not keep references to the
-// buffer.
-// Unmarshal implementations should not clear the receiver.
-// Any unmarshaled data should be merged into the receiver.
-// Callers of Unmarshal that do not want to retain existing data
-// should Reset the receiver before calling Unmarshal.
-type Unmarshaler interface {
- Unmarshal([]byte) error
-}
-
-// newUnmarshaler is the interface representing objects that can
-// unmarshal themselves. The semantics are identical to Unmarshaler.
-//
-// This exists to support protoc-gen-go generated messages.
-// The proto package will stop type-asserting to this interface in the future.
-//
-// DO NOT DEPEND ON THIS.
-type newUnmarshaler interface {
- XXX_Unmarshal([]byte) error
-}
-
-// Unmarshal parses the protocol buffer representation in buf and places the
-// decoded result in pb. If the struct underlying pb does not match
-// the data in buf, the results can be unpredictable.
-//
-// Unmarshal resets pb before starting to unmarshal, so any
-// existing data in pb is always removed. Use UnmarshalMerge
-// to preserve and append to existing data.
-func Unmarshal(buf []byte, pb Message) error {
- pb.Reset()
- if u, ok := pb.(newUnmarshaler); ok {
- return u.XXX_Unmarshal(buf)
- }
- if u, ok := pb.(Unmarshaler); ok {
- return u.Unmarshal(buf)
- }
- return NewBuffer(buf).Unmarshal(pb)
-}
-
-// UnmarshalMerge parses the protocol buffer representation in buf and
-// writes the decoded result to pb. If the struct underlying pb does not match
-// the data in buf, the results can be unpredictable.
-//
-// UnmarshalMerge merges into existing data in pb.
-// Most code should use Unmarshal instead.
-func UnmarshalMerge(buf []byte, pb Message) error {
- if u, ok := pb.(newUnmarshaler); ok {
- return u.XXX_Unmarshal(buf)
- }
- if u, ok := pb.(Unmarshaler); ok {
- // NOTE: The history of proto have unfortunately been inconsistent
- // whether Unmarshaler should or should not implicitly clear itself.
- // Some implementations do, most do not.
- // Thus, calling this here may or may not do what people want.
- //
- // See https://github.com/golang/protobuf/issues/424
- return u.Unmarshal(buf)
- }
- return NewBuffer(buf).Unmarshal(pb)
-}
-
-// DecodeMessage reads a count-delimited message from the Buffer.
-func (p *Buffer) DecodeMessage(pb Message) error {
- enc, err := p.DecodeRawBytes(false)
- if err != nil {
- return err
- }
- return NewBuffer(enc).Unmarshal(pb)
-}
-
-// DecodeGroup reads a tag-delimited group from the Buffer.
-// StartGroup tag is already consumed. This function consumes
-// EndGroup tag.
-func (p *Buffer) DecodeGroup(pb Message) error {
- b := p.buf[p.index:]
- x, y := findEndGroup(b)
- if x < 0 {
- return io.ErrUnexpectedEOF
- }
- err := Unmarshal(b[:x], pb)
- p.index += y
- return err
-}
-
-// Unmarshal parses the protocol buffer representation in the
-// Buffer and places the decoded result in pb. If the struct
-// underlying pb does not match the data in the buffer, the results can be
-// unpredictable.
-//
-// Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal.
-func (p *Buffer) Unmarshal(pb Message) error {
- // If the object can unmarshal itself, let it.
- if u, ok := pb.(newUnmarshaler); ok {
- err := u.XXX_Unmarshal(p.buf[p.index:])
- p.index = len(p.buf)
- return err
- }
- if u, ok := pb.(Unmarshaler); ok {
- // NOTE: The history of proto have unfortunately been inconsistent
- // whether Unmarshaler should or should not implicitly clear itself.
- // Some implementations do, most do not.
- // Thus, calling this here may or may not do what people want.
- //
- // See https://github.com/golang/protobuf/issues/424
- err := u.Unmarshal(p.buf[p.index:])
- p.index = len(p.buf)
- return err
- }
-
- // Slow workaround for messages that aren't Unmarshalers.
- // This includes some hand-coded .pb.go files and
- // bootstrap protos.
- // TODO: fix all of those and then add Unmarshal to
- // the Message interface. Then:
- // The cast above and code below can be deleted.
- // The old unmarshaler can be deleted.
- // Clients can call Unmarshal directly (can already do that, actually).
- var info InternalMessageInfo
- err := info.Unmarshal(pb, p.buf[p.index:])
- p.index = len(p.buf)
- return err
-}
diff --git a/vendor/github.com/golang/protobuf/proto/discard.go b/vendor/github.com/golang/protobuf/proto/discard.go
deleted file mode 100644
index dea2617ced346ec98565c75713bbf71a0ffd0254..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/discard.go
+++ /dev/null
@@ -1,350 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2017 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
- "fmt"
- "reflect"
- "strings"
- "sync"
- "sync/atomic"
-)
-
-type generatedDiscarder interface {
- XXX_DiscardUnknown()
-}
-
-// DiscardUnknown recursively discards all unknown fields from this message
-// and all embedded messages.
-//
-// When unmarshaling a message with unrecognized fields, the tags and values
-// of such fields are preserved in the Message. This allows a later call to
-// marshal to be able to produce a message that continues to have those
-// unrecognized fields. To avoid this, DiscardUnknown is used to
-// explicitly clear the unknown fields after unmarshaling.
-//
-// For proto2 messages, the unknown fields of message extensions are only
-// discarded from messages that have been accessed via GetExtension.
-func DiscardUnknown(m Message) {
- if m, ok := m.(generatedDiscarder); ok {
- m.XXX_DiscardUnknown()
- return
- }
- // TODO: Dynamically populate a InternalMessageInfo for legacy messages,
- // but the master branch has no implementation for InternalMessageInfo,
- // so it would be more work to replicate that approach.
- discardLegacy(m)
-}
-
-// DiscardUnknown recursively discards all unknown fields.
-func (a *InternalMessageInfo) DiscardUnknown(m Message) {
- di := atomicLoadDiscardInfo(&a.discard)
- if di == nil {
- di = getDiscardInfo(reflect.TypeOf(m).Elem())
- atomicStoreDiscardInfo(&a.discard, di)
- }
- di.discard(toPointer(&m))
-}
-
-type discardInfo struct {
- typ reflect.Type
-
- initialized int32 // 0: only typ is valid, 1: everything is valid
- lock sync.Mutex
-
- fields []discardFieldInfo
- unrecognized field
-}
-
-type discardFieldInfo struct {
- field field // Offset of field, guaranteed to be valid
- discard func(src pointer)
-}
-
-var (
- discardInfoMap = map[reflect.Type]*discardInfo{}
- discardInfoLock sync.Mutex
-)
-
-func getDiscardInfo(t reflect.Type) *discardInfo {
- discardInfoLock.Lock()
- defer discardInfoLock.Unlock()
- di := discardInfoMap[t]
- if di == nil {
- di = &discardInfo{typ: t}
- discardInfoMap[t] = di
- }
- return di
-}
-
-func (di *discardInfo) discard(src pointer) {
- if src.isNil() {
- return // Nothing to do.
- }
-
- if atomic.LoadInt32(&di.initialized) == 0 {
- di.computeDiscardInfo()
- }
-
- for _, fi := range di.fields {
- sfp := src.offset(fi.field)
- fi.discard(sfp)
- }
-
- // For proto2 messages, only discard unknown fields in message extensions
- // that have been accessed via GetExtension.
- if em, err := extendable(src.asPointerTo(di.typ).Interface()); err == nil {
- // Ignore lock since DiscardUnknown is not concurrency safe.
- emm, _ := em.extensionsRead()
- for _, mx := range emm {
- if m, ok := mx.value.(Message); ok {
- DiscardUnknown(m)
- }
- }
- }
-
- if di.unrecognized.IsValid() {
- *src.offset(di.unrecognized).toBytes() = nil
- }
-}
-
-func (di *discardInfo) computeDiscardInfo() {
- di.lock.Lock()
- defer di.lock.Unlock()
- if di.initialized != 0 {
- return
- }
- t := di.typ
- n := t.NumField()
-
- for i := 0; i < n; i++ {
- f := t.Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
-
- dfi := discardFieldInfo{field: toField(&f)}
- tf := f.Type
-
- // Unwrap tf to get its most basic type.
- var isPointer, isSlice bool
- if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 {
- isSlice = true
- tf = tf.Elem()
- }
- if tf.Kind() == reflect.Ptr {
- isPointer = true
- tf = tf.Elem()
- }
- if isPointer && isSlice && tf.Kind() != reflect.Struct {
- panic(fmt.Sprintf("%v.%s cannot be a slice of pointers to primitive types", t, f.Name))
- }
-
- switch tf.Kind() {
- case reflect.Struct:
- switch {
- case !isPointer:
- panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name))
- case isSlice: // E.g., []*pb.T
- di := getDiscardInfo(tf)
- dfi.discard = func(src pointer) {
- sps := src.getPointerSlice()
- for _, sp := range sps {
- if !sp.isNil() {
- di.discard(sp)
- }
- }
- }
- default: // E.g., *pb.T
- di := getDiscardInfo(tf)
- dfi.discard = func(src pointer) {
- sp := src.getPointer()
- if !sp.isNil() {
- di.discard(sp)
- }
- }
- }
- case reflect.Map:
- switch {
- case isPointer || isSlice:
- panic(fmt.Sprintf("%v.%s cannot be a pointer to a map or a slice of map values", t, f.Name))
- default: // E.g., map[K]V
- if tf.Elem().Kind() == reflect.Ptr { // Proto struct (e.g., *T)
- dfi.discard = func(src pointer) {
- sm := src.asPointerTo(tf).Elem()
- if sm.Len() == 0 {
- return
- }
- for _, key := range sm.MapKeys() {
- val := sm.MapIndex(key)
- DiscardUnknown(val.Interface().(Message))
- }
- }
- } else {
- dfi.discard = func(pointer) {} // Noop
- }
- }
- case reflect.Interface:
- // Must be oneof field.
- switch {
- case isPointer || isSlice:
- panic(fmt.Sprintf("%v.%s cannot be a pointer to a interface or a slice of interface values", t, f.Name))
- default: // E.g., interface{}
- // TODO: Make this faster?
- dfi.discard = func(src pointer) {
- su := src.asPointerTo(tf).Elem()
- if !su.IsNil() {
- sv := su.Elem().Elem().Field(0)
- if sv.Kind() == reflect.Ptr && sv.IsNil() {
- return
- }
- switch sv.Type().Kind() {
- case reflect.Ptr: // Proto struct (e.g., *T)
- DiscardUnknown(sv.Interface().(Message))
- }
- }
- }
- }
- default:
- continue
- }
- di.fields = append(di.fields, dfi)
- }
-
- di.unrecognized = invalidField
- if f, ok := t.FieldByName("XXX_unrecognized"); ok {
- if f.Type != reflect.TypeOf([]byte{}) {
- panic("expected XXX_unrecognized to be of type []byte")
- }
- di.unrecognized = toField(&f)
- }
-
- atomic.StoreInt32(&di.initialized, 1)
-}
-
-func discardLegacy(m Message) {
- v := reflect.ValueOf(m)
- if v.Kind() != reflect.Ptr || v.IsNil() {
- return
- }
- v = v.Elem()
- if v.Kind() != reflect.Struct {
- return
- }
- t := v.Type()
-
- for i := 0; i < v.NumField(); i++ {
- f := t.Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- vf := v.Field(i)
- tf := f.Type
-
- // Unwrap tf to get its most basic type.
- var isPointer, isSlice bool
- if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 {
- isSlice = true
- tf = tf.Elem()
- }
- if tf.Kind() == reflect.Ptr {
- isPointer = true
- tf = tf.Elem()
- }
- if isPointer && isSlice && tf.Kind() != reflect.Struct {
- panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name))
- }
-
- switch tf.Kind() {
- case reflect.Struct:
- switch {
- case !isPointer:
- panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name))
- case isSlice: // E.g., []*pb.T
- for j := 0; j < vf.Len(); j++ {
- discardLegacy(vf.Index(j).Interface().(Message))
- }
- default: // E.g., *pb.T
- discardLegacy(vf.Interface().(Message))
- }
- case reflect.Map:
- switch {
- case isPointer || isSlice:
- panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name))
- default: // E.g., map[K]V
- tv := vf.Type().Elem()
- if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T)
- for _, key := range vf.MapKeys() {
- val := vf.MapIndex(key)
- discardLegacy(val.Interface().(Message))
- }
- }
- }
- case reflect.Interface:
- // Must be oneof field.
- switch {
- case isPointer || isSlice:
- panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name))
- default: // E.g., test_proto.isCommunique_Union interface
- if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" {
- vf = vf.Elem() // E.g., *test_proto.Communique_Msg
- if !vf.IsNil() {
- vf = vf.Elem() // E.g., test_proto.Communique_Msg
- vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value
- if vf.Kind() == reflect.Ptr {
- discardLegacy(vf.Interface().(Message))
- }
- }
- }
- }
- }
- }
-
- if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() {
- if vf.Type() != reflect.TypeOf([]byte{}) {
- panic("expected XXX_unrecognized to be of type []byte")
- }
- vf.Set(reflect.ValueOf([]byte(nil)))
- }
-
- // For proto2 messages, only discard unknown fields in message extensions
- // that have been accessed via GetExtension.
- if em, err := extendable(m); err == nil {
- // Ignore lock since discardLegacy is not concurrency safe.
- emm, _ := em.extensionsRead()
- for _, mx := range emm {
- if m, ok := mx.value.(Message); ok {
- discardLegacy(m)
- }
- }
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/encode.go b/vendor/github.com/golang/protobuf/proto/encode.go
deleted file mode 100644
index 3abfed2cff04bdf3bb72517b6f1807b82a151570..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/encode.go
+++ /dev/null
@@ -1,203 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Routines for encoding data into the wire format for protocol buffers.
- */
-
-import (
- "errors"
- "reflect"
-)
-
-var (
- // errRepeatedHasNil is the error returned if Marshal is called with
- // a struct with a repeated field containing a nil element.
- errRepeatedHasNil = errors.New("proto: repeated field has nil element")
-
- // errOneofHasNil is the error returned if Marshal is called with
- // a struct with a oneof field containing a nil element.
- errOneofHasNil = errors.New("proto: oneof field has nil value")
-
- // ErrNil is the error returned if Marshal is called with nil.
- ErrNil = errors.New("proto: Marshal called with nil")
-
- // ErrTooLarge is the error returned if Marshal is called with a
- // message that encodes to >2GB.
- ErrTooLarge = errors.New("proto: message encodes to over 2 GB")
-)
-
-// The fundamental encoders that put bytes on the wire.
-// Those that take integer types all accept uint64 and are
-// therefore of type valueEncoder.
-
-const maxVarintBytes = 10 // maximum length of a varint
-
-// EncodeVarint returns the varint encoding of x.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-// Not used by the package itself, but helpful to clients
-// wishing to use the same encoding.
-func EncodeVarint(x uint64) []byte {
- var buf [maxVarintBytes]byte
- var n int
- for n = 0; x > 127; n++ {
- buf[n] = 0x80 | uint8(x&0x7F)
- x >>= 7
- }
- buf[n] = uint8(x)
- n++
- return buf[0:n]
-}
-
-// EncodeVarint writes a varint-encoded integer to the Buffer.
-// This is the format for the
-// int32, int64, uint32, uint64, bool, and enum
-// protocol buffer types.
-func (p *Buffer) EncodeVarint(x uint64) error {
- for x >= 1<<7 {
- p.buf = append(p.buf, uint8(x&0x7f|0x80))
- x >>= 7
- }
- p.buf = append(p.buf, uint8(x))
- return nil
-}
-
-// SizeVarint returns the varint encoding size of an integer.
-func SizeVarint(x uint64) int {
- switch {
- case x < 1<<7:
- return 1
- case x < 1<<14:
- return 2
- case x < 1<<21:
- return 3
- case x < 1<<28:
- return 4
- case x < 1<<35:
- return 5
- case x < 1<<42:
- return 6
- case x < 1<<49:
- return 7
- case x < 1<<56:
- return 8
- case x < 1<<63:
- return 9
- }
- return 10
-}
-
-// EncodeFixed64 writes a 64-bit integer to the Buffer.
-// This is the format for the
-// fixed64, sfixed64, and double protocol buffer types.
-func (p *Buffer) EncodeFixed64(x uint64) error {
- p.buf = append(p.buf,
- uint8(x),
- uint8(x>>8),
- uint8(x>>16),
- uint8(x>>24),
- uint8(x>>32),
- uint8(x>>40),
- uint8(x>>48),
- uint8(x>>56))
- return nil
-}
-
-// EncodeFixed32 writes a 32-bit integer to the Buffer.
-// This is the format for the
-// fixed32, sfixed32, and float protocol buffer types.
-func (p *Buffer) EncodeFixed32(x uint64) error {
- p.buf = append(p.buf,
- uint8(x),
- uint8(x>>8),
- uint8(x>>16),
- uint8(x>>24))
- return nil
-}
-
-// EncodeZigzag64 writes a zigzag-encoded 64-bit integer
-// to the Buffer.
-// This is the format used for the sint64 protocol buffer type.
-func (p *Buffer) EncodeZigzag64(x uint64) error {
- // use signed number to get arithmetic right shift.
- return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63))))
-}
-
-// EncodeZigzag32 writes a zigzag-encoded 32-bit integer
-// to the Buffer.
-// This is the format used for the sint32 protocol buffer type.
-func (p *Buffer) EncodeZigzag32(x uint64) error {
- // use signed number to get arithmetic right shift.
- return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31))))
-}
-
-// EncodeRawBytes writes a count-delimited byte buffer to the Buffer.
-// This is the format used for the bytes protocol buffer
-// type and for embedded messages.
-func (p *Buffer) EncodeRawBytes(b []byte) error {
- p.EncodeVarint(uint64(len(b)))
- p.buf = append(p.buf, b...)
- return nil
-}
-
-// EncodeStringBytes writes an encoded string to the Buffer.
-// This is the format used for the proto2 string type.
-func (p *Buffer) EncodeStringBytes(s string) error {
- p.EncodeVarint(uint64(len(s)))
- p.buf = append(p.buf, s...)
- return nil
-}
-
-// Marshaler is the interface representing objects that can marshal themselves.
-type Marshaler interface {
- Marshal() ([]byte, error)
-}
-
-// EncodeMessage writes the protocol buffer to the Buffer,
-// prefixed by a varint-encoded length.
-func (p *Buffer) EncodeMessage(pb Message) error {
- siz := Size(pb)
- p.EncodeVarint(uint64(siz))
- return p.Marshal(pb)
-}
-
-// All protocol buffer fields are nillable, but be careful.
-func isNil(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
- return v.IsNil()
- }
- return false
-}
diff --git a/vendor/github.com/golang/protobuf/proto/equal.go b/vendor/github.com/golang/protobuf/proto/equal.go
deleted file mode 100644
index d4db5a1c1457776f25424eedc9d9e64f4f4ab736..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/equal.go
+++ /dev/null
@@ -1,300 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2011 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Protocol buffer comparison.
-
-package proto
-
-import (
- "bytes"
- "log"
- "reflect"
- "strings"
-)
-
-/*
-Equal returns true iff protocol buffers a and b are equal.
-The arguments must both be pointers to protocol buffer structs.
-
-Equality is defined in this way:
- - Two messages are equal iff they are the same type,
- corresponding fields are equal, unknown field sets
- are equal, and extensions sets are equal.
- - Two set scalar fields are equal iff their values are equal.
- If the fields are of a floating-point type, remember that
- NaN != x for all x, including NaN. If the message is defined
- in a proto3 .proto file, fields are not "set"; specifically,
- zero length proto3 "bytes" fields are equal (nil == {}).
- - Two repeated fields are equal iff their lengths are the same,
- and their corresponding elements are equal. Note a "bytes" field,
- although represented by []byte, is not a repeated field and the
- rule for the scalar fields described above applies.
- - Two unset fields are equal.
- - Two unknown field sets are equal if their current
- encoded state is equal.
- - Two extension sets are equal iff they have corresponding
- elements that are pairwise equal.
- - Two map fields are equal iff their lengths are the same,
- and they contain the same set of elements. Zero-length map
- fields are equal.
- - Every other combination of things are not equal.
-
-The return value is undefined if a and b are not protocol buffers.
-*/
-func Equal(a, b Message) bool {
- if a == nil || b == nil {
- return a == b
- }
- v1, v2 := reflect.ValueOf(a), reflect.ValueOf(b)
- if v1.Type() != v2.Type() {
- return false
- }
- if v1.Kind() == reflect.Ptr {
- if v1.IsNil() {
- return v2.IsNil()
- }
- if v2.IsNil() {
- return false
- }
- v1, v2 = v1.Elem(), v2.Elem()
- }
- if v1.Kind() != reflect.Struct {
- return false
- }
- return equalStruct(v1, v2)
-}
-
-// v1 and v2 are known to have the same type.
-func equalStruct(v1, v2 reflect.Value) bool {
- sprop := GetProperties(v1.Type())
- for i := 0; i < v1.NumField(); i++ {
- f := v1.Type().Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- f1, f2 := v1.Field(i), v2.Field(i)
- if f.Type.Kind() == reflect.Ptr {
- if n1, n2 := f1.IsNil(), f2.IsNil(); n1 && n2 {
- // both unset
- continue
- } else if n1 != n2 {
- // set/unset mismatch
- return false
- }
- f1, f2 = f1.Elem(), f2.Elem()
- }
- if !equalAny(f1, f2, sprop.Prop[i]) {
- return false
- }
- }
-
- if em1 := v1.FieldByName("XXX_InternalExtensions"); em1.IsValid() {
- em2 := v2.FieldByName("XXX_InternalExtensions")
- if !equalExtensions(v1.Type(), em1.Interface().(XXX_InternalExtensions), em2.Interface().(XXX_InternalExtensions)) {
- return false
- }
- }
-
- if em1 := v1.FieldByName("XXX_extensions"); em1.IsValid() {
- em2 := v2.FieldByName("XXX_extensions")
- if !equalExtMap(v1.Type(), em1.Interface().(map[int32]Extension), em2.Interface().(map[int32]Extension)) {
- return false
- }
- }
-
- uf := v1.FieldByName("XXX_unrecognized")
- if !uf.IsValid() {
- return true
- }
-
- u1 := uf.Bytes()
- u2 := v2.FieldByName("XXX_unrecognized").Bytes()
- return bytes.Equal(u1, u2)
-}
-
-// v1 and v2 are known to have the same type.
-// prop may be nil.
-func equalAny(v1, v2 reflect.Value, prop *Properties) bool {
- if v1.Type() == protoMessageType {
- m1, _ := v1.Interface().(Message)
- m2, _ := v2.Interface().(Message)
- return Equal(m1, m2)
- }
- switch v1.Kind() {
- case reflect.Bool:
- return v1.Bool() == v2.Bool()
- case reflect.Float32, reflect.Float64:
- return v1.Float() == v2.Float()
- case reflect.Int32, reflect.Int64:
- return v1.Int() == v2.Int()
- case reflect.Interface:
- // Probably a oneof field; compare the inner values.
- n1, n2 := v1.IsNil(), v2.IsNil()
- if n1 || n2 {
- return n1 == n2
- }
- e1, e2 := v1.Elem(), v2.Elem()
- if e1.Type() != e2.Type() {
- return false
- }
- return equalAny(e1, e2, nil)
- case reflect.Map:
- if v1.Len() != v2.Len() {
- return false
- }
- for _, key := range v1.MapKeys() {
- val2 := v2.MapIndex(key)
- if !val2.IsValid() {
- // This key was not found in the second map.
- return false
- }
- if !equalAny(v1.MapIndex(key), val2, nil) {
- return false
- }
- }
- return true
- case reflect.Ptr:
- // Maps may have nil values in them, so check for nil.
- if v1.IsNil() && v2.IsNil() {
- return true
- }
- if v1.IsNil() != v2.IsNil() {
- return false
- }
- return equalAny(v1.Elem(), v2.Elem(), prop)
- case reflect.Slice:
- if v1.Type().Elem().Kind() == reflect.Uint8 {
- // short circuit: []byte
-
- // Edge case: if this is in a proto3 message, a zero length
- // bytes field is considered the zero value.
- if prop != nil && prop.proto3 && v1.Len() == 0 && v2.Len() == 0 {
- return true
- }
- if v1.IsNil() != v2.IsNil() {
- return false
- }
- return bytes.Equal(v1.Interface().([]byte), v2.Interface().([]byte))
- }
-
- if v1.Len() != v2.Len() {
- return false
- }
- for i := 0; i < v1.Len(); i++ {
- if !equalAny(v1.Index(i), v2.Index(i), prop) {
- return false
- }
- }
- return true
- case reflect.String:
- return v1.Interface().(string) == v2.Interface().(string)
- case reflect.Struct:
- return equalStruct(v1, v2)
- case reflect.Uint32, reflect.Uint64:
- return v1.Uint() == v2.Uint()
- }
-
- // unknown type, so not a protocol buffer
- log.Printf("proto: don't know how to compare %v", v1)
- return false
-}
-
-// base is the struct type that the extensions are based on.
-// x1 and x2 are InternalExtensions.
-func equalExtensions(base reflect.Type, x1, x2 XXX_InternalExtensions) bool {
- em1, _ := x1.extensionsRead()
- em2, _ := x2.extensionsRead()
- return equalExtMap(base, em1, em2)
-}
-
-func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool {
- if len(em1) != len(em2) {
- return false
- }
-
- for extNum, e1 := range em1 {
- e2, ok := em2[extNum]
- if !ok {
- return false
- }
-
- m1, m2 := e1.value, e2.value
-
- if m1 == nil && m2 == nil {
- // Both have only encoded form.
- if bytes.Equal(e1.enc, e2.enc) {
- continue
- }
- // The bytes are different, but the extensions might still be
- // equal. We need to decode them to compare.
- }
-
- if m1 != nil && m2 != nil {
- // Both are unencoded.
- if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {
- return false
- }
- continue
- }
-
- // At least one is encoded. To do a semantically correct comparison
- // we need to unmarshal them first.
- var desc *ExtensionDesc
- if m := extensionMaps[base]; m != nil {
- desc = m[extNum]
- }
- if desc == nil {
- // If both have only encoded form and the bytes are the same,
- // it is handled above. We get here when the bytes are different.
- // We don't know how to decode it, so just compare them as byte
- // slices.
- log.Printf("proto: don't know how to compare extension %d of %v", extNum, base)
- return false
- }
- var err error
- if m1 == nil {
- m1, err = decodeExtension(e1.enc, desc)
- }
- if m2 == nil && err == nil {
- m2, err = decodeExtension(e2.enc, desc)
- }
- if err != nil {
- // The encoded form is invalid.
- log.Printf("proto: badly encoded extension %d of %v: %v", extNum, base, err)
- return false
- }
- if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) {
- return false
- }
- }
-
- return true
-}
diff --git a/vendor/github.com/golang/protobuf/proto/extensions.go b/vendor/github.com/golang/protobuf/proto/extensions.go
deleted file mode 100644
index 816a3b9d6c09faf075c20d839f6eddc0221ffae4..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/extensions.go
+++ /dev/null
@@ -1,543 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Types and routines for supporting protocol buffer extensions.
- */
-
-import (
- "errors"
- "fmt"
- "io"
- "reflect"
- "strconv"
- "sync"
-)
-
-// ErrMissingExtension is the error returned by GetExtension if the named extension is not in the message.
-var ErrMissingExtension = errors.New("proto: missing extension")
-
-// ExtensionRange represents a range of message extensions for a protocol buffer.
-// Used in code generated by the protocol compiler.
-type ExtensionRange struct {
- Start, End int32 // both inclusive
-}
-
-// extendableProto is an interface implemented by any protocol buffer generated by the current
-// proto compiler that may be extended.
-type extendableProto interface {
- Message
- ExtensionRangeArray() []ExtensionRange
- extensionsWrite() map[int32]Extension
- extensionsRead() (map[int32]Extension, sync.Locker)
-}
-
-// extendableProtoV1 is an interface implemented by a protocol buffer generated by the previous
-// version of the proto compiler that may be extended.
-type extendableProtoV1 interface {
- Message
- ExtensionRangeArray() []ExtensionRange
- ExtensionMap() map[int32]Extension
-}
-
-// extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto.
-type extensionAdapter struct {
- extendableProtoV1
-}
-
-func (e extensionAdapter) extensionsWrite() map[int32]Extension {
- return e.ExtensionMap()
-}
-
-func (e extensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) {
- return e.ExtensionMap(), notLocker{}
-}
-
-// notLocker is a sync.Locker whose Lock and Unlock methods are nops.
-type notLocker struct{}
-
-func (n notLocker) Lock() {}
-func (n notLocker) Unlock() {}
-
-// extendable returns the extendableProto interface for the given generated proto message.
-// If the proto message has the old extension format, it returns a wrapper that implements
-// the extendableProto interface.
-func extendable(p interface{}) (extendableProto, error) {
- switch p := p.(type) {
- case extendableProto:
- if isNilPtr(p) {
- return nil, fmt.Errorf("proto: nil %T is not extendable", p)
- }
- return p, nil
- case extendableProtoV1:
- if isNilPtr(p) {
- return nil, fmt.Errorf("proto: nil %T is not extendable", p)
- }
- return extensionAdapter{p}, nil
- }
- // Don't allocate a specific error containing %T:
- // this is the hot path for Clone and MarshalText.
- return nil, errNotExtendable
-}
-
-var errNotExtendable = errors.New("proto: not an extendable proto.Message")
-
-func isNilPtr(x interface{}) bool {
- v := reflect.ValueOf(x)
- return v.Kind() == reflect.Ptr && v.IsNil()
-}
-
-// XXX_InternalExtensions is an internal representation of proto extensions.
-//
-// Each generated message struct type embeds an anonymous XXX_InternalExtensions field,
-// thus gaining the unexported 'extensions' method, which can be called only from the proto package.
-//
-// The methods of XXX_InternalExtensions are not concurrency safe in general,
-// but calls to logically read-only methods such as has and get may be executed concurrently.
-type XXX_InternalExtensions struct {
- // The struct must be indirect so that if a user inadvertently copies a
- // generated message and its embedded XXX_InternalExtensions, they
- // avoid the mayhem of a copied mutex.
- //
- // The mutex serializes all logically read-only operations to p.extensionMap.
- // It is up to the client to ensure that write operations to p.extensionMap are
- // mutually exclusive with other accesses.
- p *struct {
- mu sync.Mutex
- extensionMap map[int32]Extension
- }
-}
-
-// extensionsWrite returns the extension map, creating it on first use.
-func (e *XXX_InternalExtensions) extensionsWrite() map[int32]Extension {
- if e.p == nil {
- e.p = new(struct {
- mu sync.Mutex
- extensionMap map[int32]Extension
- })
- e.p.extensionMap = make(map[int32]Extension)
- }
- return e.p.extensionMap
-}
-
-// extensionsRead returns the extensions map for read-only use. It may be nil.
-// The caller must hold the returned mutex's lock when accessing Elements within the map.
-func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Locker) {
- if e.p == nil {
- return nil, nil
- }
- return e.p.extensionMap, &e.p.mu
-}
-
-// ExtensionDesc represents an extension specification.
-// Used in generated code from the protocol compiler.
-type ExtensionDesc struct {
- ExtendedType Message // nil pointer to the type that is being extended
- ExtensionType interface{} // nil pointer to the extension type
- Field int32 // field number
- Name string // fully-qualified name of extension, for text formatting
- Tag string // protobuf tag style
- Filename string // name of the file in which the extension is defined
-}
-
-func (ed *ExtensionDesc) repeated() bool {
- t := reflect.TypeOf(ed.ExtensionType)
- return t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
-}
-
-// Extension represents an extension in a message.
-type Extension struct {
- // When an extension is stored in a message using SetExtension
- // only desc and value are set. When the message is marshaled
- // enc will be set to the encoded form of the message.
- //
- // When a message is unmarshaled and contains extensions, each
- // extension will have only enc set. When such an extension is
- // accessed using GetExtension (or GetExtensions) desc and value
- // will be set.
- desc *ExtensionDesc
- value interface{}
- enc []byte
-}
-
-// SetRawExtension is for testing only.
-func SetRawExtension(base Message, id int32, b []byte) {
- epb, err := extendable(base)
- if err != nil {
- return
- }
- extmap := epb.extensionsWrite()
- extmap[id] = Extension{enc: b}
-}
-
-// isExtensionField returns true iff the given field number is in an extension range.
-func isExtensionField(pb extendableProto, field int32) bool {
- for _, er := range pb.ExtensionRangeArray() {
- if er.Start <= field && field <= er.End {
- return true
- }
- }
- return false
-}
-
-// checkExtensionTypes checks that the given extension is valid for pb.
-func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error {
- var pbi interface{} = pb
- // Check the extended type.
- if ea, ok := pbi.(extensionAdapter); ok {
- pbi = ea.extendableProtoV1
- }
- if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b {
- return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a)
- }
- // Check the range.
- if !isExtensionField(pb, extension.Field) {
- return errors.New("proto: bad extension number; not in declared ranges")
- }
- return nil
-}
-
-// extPropKey is sufficient to uniquely identify an extension.
-type extPropKey struct {
- base reflect.Type
- field int32
-}
-
-var extProp = struct {
- sync.RWMutex
- m map[extPropKey]*Properties
-}{
- m: make(map[extPropKey]*Properties),
-}
-
-func extensionProperties(ed *ExtensionDesc) *Properties {
- key := extPropKey{base: reflect.TypeOf(ed.ExtendedType), field: ed.Field}
-
- extProp.RLock()
- if prop, ok := extProp.m[key]; ok {
- extProp.RUnlock()
- return prop
- }
- extProp.RUnlock()
-
- extProp.Lock()
- defer extProp.Unlock()
- // Check again.
- if prop, ok := extProp.m[key]; ok {
- return prop
- }
-
- prop := new(Properties)
- prop.Init(reflect.TypeOf(ed.ExtensionType), "unknown_name", ed.Tag, nil)
- extProp.m[key] = prop
- return prop
-}
-
-// HasExtension returns whether the given extension is present in pb.
-func HasExtension(pb Message, extension *ExtensionDesc) bool {
- // TODO: Check types, field numbers, etc.?
- epb, err := extendable(pb)
- if err != nil {
- return false
- }
- extmap, mu := epb.extensionsRead()
- if extmap == nil {
- return false
- }
- mu.Lock()
- _, ok := extmap[extension.Field]
- mu.Unlock()
- return ok
-}
-
-// ClearExtension removes the given extension from pb.
-func ClearExtension(pb Message, extension *ExtensionDesc) {
- epb, err := extendable(pb)
- if err != nil {
- return
- }
- // TODO: Check types, field numbers, etc.?
- extmap := epb.extensionsWrite()
- delete(extmap, extension.Field)
-}
-
-// GetExtension retrieves a proto2 extended field from pb.
-//
-// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil),
-// then GetExtension parses the encoded field and returns a Go value of the specified type.
-// If the field is not present, then the default value is returned (if one is specified),
-// otherwise ErrMissingExtension is reported.
-//
-// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil),
-// then GetExtension returns the raw encoded bytes of the field extension.
-func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) {
- epb, err := extendable(pb)
- if err != nil {
- return nil, err
- }
-
- if extension.ExtendedType != nil {
- // can only check type if this is a complete descriptor
- if err := checkExtensionTypes(epb, extension); err != nil {
- return nil, err
- }
- }
-
- emap, mu := epb.extensionsRead()
- if emap == nil {
- return defaultExtensionValue(extension)
- }
- mu.Lock()
- defer mu.Unlock()
- e, ok := emap[extension.Field]
- if !ok {
- // defaultExtensionValue returns the default value or
- // ErrMissingExtension if there is no default.
- return defaultExtensionValue(extension)
- }
-
- if e.value != nil {
- // Already decoded. Check the descriptor, though.
- if e.desc != extension {
- // This shouldn't happen. If it does, it means that
- // GetExtension was called twice with two different
- // descriptors with the same field number.
- return nil, errors.New("proto: descriptor conflict")
- }
- return e.value, nil
- }
-
- if extension.ExtensionType == nil {
- // incomplete descriptor
- return e.enc, nil
- }
-
- v, err := decodeExtension(e.enc, extension)
- if err != nil {
- return nil, err
- }
-
- // Remember the decoded version and drop the encoded version.
- // That way it is safe to mutate what we return.
- e.value = v
- e.desc = extension
- e.enc = nil
- emap[extension.Field] = e
- return e.value, nil
-}
-
-// defaultExtensionValue returns the default value for extension.
-// If no default for an extension is defined ErrMissingExtension is returned.
-func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) {
- if extension.ExtensionType == nil {
- // incomplete descriptor, so no default
- return nil, ErrMissingExtension
- }
-
- t := reflect.TypeOf(extension.ExtensionType)
- props := extensionProperties(extension)
-
- sf, _, err := fieldDefault(t, props)
- if err != nil {
- return nil, err
- }
-
- if sf == nil || sf.value == nil {
- // There is no default value.
- return nil, ErrMissingExtension
- }
-
- if t.Kind() != reflect.Ptr {
- // We do not need to return a Ptr, we can directly return sf.value.
- return sf.value, nil
- }
-
- // We need to return an interface{} that is a pointer to sf.value.
- value := reflect.New(t).Elem()
- value.Set(reflect.New(value.Type().Elem()))
- if sf.kind == reflect.Int32 {
- // We may have an int32 or an enum, but the underlying data is int32.
- // Since we can't set an int32 into a non int32 reflect.value directly
- // set it as a int32.
- value.Elem().SetInt(int64(sf.value.(int32)))
- } else {
- value.Elem().Set(reflect.ValueOf(sf.value))
- }
- return value.Interface(), nil
-}
-
-// decodeExtension decodes an extension encoded in b.
-func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) {
- t := reflect.TypeOf(extension.ExtensionType)
- unmarshal := typeUnmarshaler(t, extension.Tag)
-
- // t is a pointer to a struct, pointer to basic type or a slice.
- // Allocate space to store the pointer/slice.
- value := reflect.New(t).Elem()
-
- var err error
- for {
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- wire := int(x) & 7
-
- b, err = unmarshal(b, valToPointer(value.Addr()), wire)
- if err != nil {
- return nil, err
- }
-
- if len(b) == 0 {
- break
- }
- }
- return value.Interface(), nil
-}
-
-// GetExtensions returns a slice of the extensions present in pb that are also listed in es.
-// The returned slice has the same length as es; missing extensions will appear as nil elements.
-func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) {
- epb, err := extendable(pb)
- if err != nil {
- return nil, err
- }
- extensions = make([]interface{}, len(es))
- for i, e := range es {
- extensions[i], err = GetExtension(epb, e)
- if err == ErrMissingExtension {
- err = nil
- }
- if err != nil {
- return
- }
- }
- return
-}
-
-// ExtensionDescs returns a new slice containing pb's extension descriptors, in undefined order.
-// For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing
-// just the Field field, which defines the extension's field number.
-func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) {
- epb, err := extendable(pb)
- if err != nil {
- return nil, err
- }
- registeredExtensions := RegisteredExtensions(pb)
-
- emap, mu := epb.extensionsRead()
- if emap == nil {
- return nil, nil
- }
- mu.Lock()
- defer mu.Unlock()
- extensions := make([]*ExtensionDesc, 0, len(emap))
- for extid, e := range emap {
- desc := e.desc
- if desc == nil {
- desc = registeredExtensions[extid]
- if desc == nil {
- desc = &ExtensionDesc{Field: extid}
- }
- }
-
- extensions = append(extensions, desc)
- }
- return extensions, nil
-}
-
-// SetExtension sets the specified extension of pb to the specified value.
-func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error {
- epb, err := extendable(pb)
- if err != nil {
- return err
- }
- if err := checkExtensionTypes(epb, extension); err != nil {
- return err
- }
- typ := reflect.TypeOf(extension.ExtensionType)
- if typ != reflect.TypeOf(value) {
- return errors.New("proto: bad extension value type")
- }
- // nil extension values need to be caught early, because the
- // encoder can't distinguish an ErrNil due to a nil extension
- // from an ErrNil due to a missing field. Extensions are
- // always optional, so the encoder would just swallow the error
- // and drop all the extensions from the encoded message.
- if reflect.ValueOf(value).IsNil() {
- return fmt.Errorf("proto: SetExtension called with nil value of type %T", value)
- }
-
- extmap := epb.extensionsWrite()
- extmap[extension.Field] = Extension{desc: extension, value: value}
- return nil
-}
-
-// ClearAllExtensions clears all extensions from pb.
-func ClearAllExtensions(pb Message) {
- epb, err := extendable(pb)
- if err != nil {
- return
- }
- m := epb.extensionsWrite()
- for k := range m {
- delete(m, k)
- }
-}
-
-// A global registry of extensions.
-// The generated code will register the generated descriptors by calling RegisterExtension.
-
-var extensionMaps = make(map[reflect.Type]map[int32]*ExtensionDesc)
-
-// RegisterExtension is called from the generated code.
-func RegisterExtension(desc *ExtensionDesc) {
- st := reflect.TypeOf(desc.ExtendedType).Elem()
- m := extensionMaps[st]
- if m == nil {
- m = make(map[int32]*ExtensionDesc)
- extensionMaps[st] = m
- }
- if _, ok := m[desc.Field]; ok {
- panic("proto: duplicate extension registered: " + st.String() + " " + strconv.Itoa(int(desc.Field)))
- }
- m[desc.Field] = desc
-}
-
-// RegisteredExtensions returns a map of the registered extensions of a
-// protocol buffer struct, indexed by the extension number.
-// The argument pb should be a nil pointer to the struct type.
-func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc {
- return extensionMaps[reflect.TypeOf(pb).Elem()]
-}
diff --git a/vendor/github.com/golang/protobuf/proto/lib.go b/vendor/github.com/golang/protobuf/proto/lib.go
deleted file mode 100644
index 75565cc6dcf41778c23783504fdeb54eb17a8c85..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/lib.go
+++ /dev/null
@@ -1,979 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-/*
-Package proto converts data structures to and from the wire format of
-protocol buffers. It works in concert with the Go source code generated
-for .proto files by the protocol compiler.
-
-A summary of the properties of the protocol buffer interface
-for a protocol buffer variable v:
-
- - Names are turned from camel_case to CamelCase for export.
- - There are no methods on v to set fields; just treat
- them as structure fields.
- - There are getters that return a field's value if set,
- and return the field's default value if unset.
- The getters work even if the receiver is a nil message.
- - The zero value for a struct is its correct initialization state.
- All desired fields must be set before marshaling.
- - A Reset() method will restore a protobuf struct to its zero state.
- - Non-repeated fields are pointers to the values; nil means unset.
- That is, optional or required field int32 f becomes F *int32.
- - Repeated fields are slices.
- - Helper functions are available to aid the setting of fields.
- msg.Foo = proto.String("hello") // set field
- - Constants are defined to hold the default values of all fields that
- have them. They have the form Default_StructName_FieldName.
- Because the getter methods handle defaulted values,
- direct use of these constants should be rare.
- - Enums are given type names and maps from names to values.
- Enum values are prefixed by the enclosing message's name, or by the
- enum's type name if it is a top-level enum. Enum types have a String
- method, and a Enum method to assist in message construction.
- - Nested messages, groups and enums have type names prefixed with the name of
- the surrounding message type.
- - Extensions are given descriptor names that start with E_,
- followed by an underscore-delimited list of the nested messages
- that contain it (if any) followed by the CamelCased name of the
- extension field itself. HasExtension, ClearExtension, GetExtension
- and SetExtension are functions for manipulating extensions.
- - Oneof field sets are given a single field in their message,
- with distinguished wrapper types for each possible field value.
- - Marshal and Unmarshal are functions to encode and decode the wire format.
-
-When the .proto file specifies `syntax="proto3"`, there are some differences:
-
- - Non-repeated fields of non-message type are values instead of pointers.
- - Enum types do not get an Enum method.
-
-The simplest way to describe this is to see an example.
-Given file test.proto, containing
-
- package example;
-
- enum FOO { X = 17; }
-
- message Test {
- required string label = 1;
- optional int32 type = 2 [default=77];
- repeated int64 reps = 3;
- optional group OptionalGroup = 4 {
- required string RequiredField = 5;
- }
- oneof union {
- int32 number = 6;
- string name = 7;
- }
- }
-
-The resulting file, test.pb.go, is:
-
- package example
-
- import proto "github.com/golang/protobuf/proto"
- import math "math"
-
- type FOO int32
- const (
- FOO_X FOO = 17
- )
- var FOO_name = map[int32]string{
- 17: "X",
- }
- var FOO_value = map[string]int32{
- "X": 17,
- }
-
- func (x FOO) Enum() *FOO {
- p := new(FOO)
- *p = x
- return p
- }
- func (x FOO) String() string {
- return proto.EnumName(FOO_name, int32(x))
- }
- func (x *FOO) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(FOO_value, data)
- if err != nil {
- return err
- }
- *x = FOO(value)
- return nil
- }
-
- type Test struct {
- Label *string `protobuf:"bytes,1,req,name=label" json:"label,omitempty"`
- Type *int32 `protobuf:"varint,2,opt,name=type,def=77" json:"type,omitempty"`
- Reps []int64 `protobuf:"varint,3,rep,name=reps" json:"reps,omitempty"`
- Optionalgroup *Test_OptionalGroup `protobuf:"group,4,opt,name=OptionalGroup" json:"optionalgroup,omitempty"`
- // Types that are valid to be assigned to Union:
- // *Test_Number
- // *Test_Name
- Union isTest_Union `protobuf_oneof:"union"`
- XXX_unrecognized []byte `json:"-"`
- }
- func (m *Test) Reset() { *m = Test{} }
- func (m *Test) String() string { return proto.CompactTextString(m) }
- func (*Test) ProtoMessage() {}
-
- type isTest_Union interface {
- isTest_Union()
- }
-
- type Test_Number struct {
- Number int32 `protobuf:"varint,6,opt,name=number"`
- }
- type Test_Name struct {
- Name string `protobuf:"bytes,7,opt,name=name"`
- }
-
- func (*Test_Number) isTest_Union() {}
- func (*Test_Name) isTest_Union() {}
-
- func (m *Test) GetUnion() isTest_Union {
- if m != nil {
- return m.Union
- }
- return nil
- }
- const Default_Test_Type int32 = 77
-
- func (m *Test) GetLabel() string {
- if m != nil && m.Label != nil {
- return *m.Label
- }
- return ""
- }
-
- func (m *Test) GetType() int32 {
- if m != nil && m.Type != nil {
- return *m.Type
- }
- return Default_Test_Type
- }
-
- func (m *Test) GetOptionalgroup() *Test_OptionalGroup {
- if m != nil {
- return m.Optionalgroup
- }
- return nil
- }
-
- type Test_OptionalGroup struct {
- RequiredField *string `protobuf:"bytes,5,req" json:"RequiredField,omitempty"`
- }
- func (m *Test_OptionalGroup) Reset() { *m = Test_OptionalGroup{} }
- func (m *Test_OptionalGroup) String() string { return proto.CompactTextString(m) }
-
- func (m *Test_OptionalGroup) GetRequiredField() string {
- if m != nil && m.RequiredField != nil {
- return *m.RequiredField
- }
- return ""
- }
-
- func (m *Test) GetNumber() int32 {
- if x, ok := m.GetUnion().(*Test_Number); ok {
- return x.Number
- }
- return 0
- }
-
- func (m *Test) GetName() string {
- if x, ok := m.GetUnion().(*Test_Name); ok {
- return x.Name
- }
- return ""
- }
-
- func init() {
- proto.RegisterEnum("example.FOO", FOO_name, FOO_value)
- }
-
-To create and play with a Test object:
-
- package main
-
- import (
- "log"
-
- "github.com/golang/protobuf/proto"
- pb "./example.pb"
- )
-
- func main() {
- test := &pb.Test{
- Label: proto.String("hello"),
- Type: proto.Int32(17),
- Reps: []int64{1, 2, 3},
- Optionalgroup: &pb.Test_OptionalGroup{
- RequiredField: proto.String("good bye"),
- },
- Union: &pb.Test_Name{"fred"},
- }
- data, err := proto.Marshal(test)
- if err != nil {
- log.Fatal("marshaling error: ", err)
- }
- newTest := &pb.Test{}
- err = proto.Unmarshal(data, newTest)
- if err != nil {
- log.Fatal("unmarshaling error: ", err)
- }
- // Now test and newTest contain the same data.
- if test.GetLabel() != newTest.GetLabel() {
- log.Fatalf("data mismatch %q != %q", test.GetLabel(), newTest.GetLabel())
- }
- // Use a type switch to determine which oneof was set.
- switch u := test.Union.(type) {
- case *pb.Test_Number: // u.Number contains the number.
- case *pb.Test_Name: // u.Name contains the string.
- }
- // etc.
- }
-*/
-package proto
-
-import (
- "encoding/json"
- "fmt"
- "log"
- "reflect"
- "sort"
- "strconv"
- "sync"
-)
-
-// RequiredNotSetError is an error type returned by either Marshal or Unmarshal.
-// Marshal reports this when a required field is not initialized.
-// Unmarshal reports this when a required field is missing from the wire data.
-type RequiredNotSetError struct{ field string }
-
-func (e *RequiredNotSetError) Error() string {
- if e.field == "" {
- return fmt.Sprintf("proto: required field not set")
- }
- return fmt.Sprintf("proto: required field %q not set", e.field)
-}
-func (e *RequiredNotSetError) RequiredNotSet() bool {
- return true
-}
-
-type invalidUTF8Error struct{ field string }
-
-func (e *invalidUTF8Error) Error() string {
- if e.field == "" {
- return "proto: invalid UTF-8 detected"
- }
- return fmt.Sprintf("proto: field %q contains invalid UTF-8", e.field)
-}
-func (e *invalidUTF8Error) InvalidUTF8() bool {
- return true
-}
-
-// errInvalidUTF8 is a sentinel error to identify fields with invalid UTF-8.
-// This error should not be exposed to the external API as such errors should
-// be recreated with the field information.
-var errInvalidUTF8 = &invalidUTF8Error{}
-
-// isNonFatal reports whether the error is either a RequiredNotSet error
-// or a InvalidUTF8 error.
-func isNonFatal(err error) bool {
- if re, ok := err.(interface{ RequiredNotSet() bool }); ok && re.RequiredNotSet() {
- return true
- }
- if re, ok := err.(interface{ InvalidUTF8() bool }); ok && re.InvalidUTF8() {
- return true
- }
- return false
-}
-
-type nonFatal struct{ E error }
-
-// Merge merges err into nf and reports whether it was successful.
-// Otherwise it returns false for any fatal non-nil errors.
-func (nf *nonFatal) Merge(err error) (ok bool) {
- if err == nil {
- return true // not an error
- }
- if !isNonFatal(err) {
- return false // fatal error
- }
- if nf.E == nil {
- nf.E = err // store first instance of non-fatal error
- }
- return true
-}
-
-// Message is implemented by generated protocol buffer messages.
-type Message interface {
- Reset()
- String() string
- ProtoMessage()
-}
-
-// Stats records allocation details about the protocol buffer encoders
-// and decoders. Useful for tuning the library itself.
-type Stats struct {
- Emalloc uint64 // mallocs in encode
- Dmalloc uint64 // mallocs in decode
- Encode uint64 // number of encodes
- Decode uint64 // number of decodes
- Chit uint64 // number of cache hits
- Cmiss uint64 // number of cache misses
- Size uint64 // number of sizes
-}
-
-// Set to true to enable stats collection.
-const collectStats = false
-
-var stats Stats
-
-// GetStats returns a copy of the global Stats structure.
-func GetStats() Stats { return stats }
-
-// A Buffer is a buffer manager for marshaling and unmarshaling
-// protocol buffers. It may be reused between invocations to
-// reduce memory usage. It is not necessary to use a Buffer;
-// the global functions Marshal and Unmarshal create a
-// temporary Buffer and are fine for most applications.
-type Buffer struct {
- buf []byte // encode/decode byte stream
- index int // read point
-
- deterministic bool
-}
-
-// NewBuffer allocates a new Buffer and initializes its internal data to
-// the contents of the argument slice.
-func NewBuffer(e []byte) *Buffer {
- return &Buffer{buf: e}
-}
-
-// Reset resets the Buffer, ready for marshaling a new protocol buffer.
-func (p *Buffer) Reset() {
- p.buf = p.buf[0:0] // for reading/writing
- p.index = 0 // for reading
-}
-
-// SetBuf replaces the internal buffer with the slice,
-// ready for unmarshaling the contents of the slice.
-func (p *Buffer) SetBuf(s []byte) {
- p.buf = s
- p.index = 0
-}
-
-// Bytes returns the contents of the Buffer.
-func (p *Buffer) Bytes() []byte { return p.buf }
-
-// SetDeterministic sets whether to use deterministic serialization.
-//
-// Deterministic serialization guarantees that for a given binary, equal
-// messages will always be serialized to the same bytes. This implies:
-//
-// - Repeated serialization of a message will return the same bytes.
-// - Different processes of the same binary (which may be executing on
-// different machines) will serialize equal messages to the same bytes.
-//
-// Note that the deterministic serialization is NOT canonical across
-// languages. It is not guaranteed to remain stable over time. It is unstable
-// across different builds with schema changes due to unknown fields.
-// Users who need canonical serialization (e.g., persistent storage in a
-// canonical form, fingerprinting, etc.) should define their own
-// canonicalization specification and implement their own serializer rather
-// than relying on this API.
-//
-// If deterministic serialization is requested, map entries will be sorted
-// by keys in lexographical order. This is an implementation detail and
-// subject to change.
-func (p *Buffer) SetDeterministic(deterministic bool) {
- p.deterministic = deterministic
-}
-
-/*
- * Helper routines for simplifying the creation of optional fields of basic type.
- */
-
-// Bool is a helper routine that allocates a new bool value
-// to store v and returns a pointer to it.
-func Bool(v bool) *bool {
- return &v
-}
-
-// Int32 is a helper routine that allocates a new int32 value
-// to store v and returns a pointer to it.
-func Int32(v int32) *int32 {
- return &v
-}
-
-// Int is a helper routine that allocates a new int32 value
-// to store v and returns a pointer to it, but unlike Int32
-// its argument value is an int.
-func Int(v int) *int32 {
- p := new(int32)
- *p = int32(v)
- return p
-}
-
-// Int64 is a helper routine that allocates a new int64 value
-// to store v and returns a pointer to it.
-func Int64(v int64) *int64 {
- return &v
-}
-
-// Float32 is a helper routine that allocates a new float32 value
-// to store v and returns a pointer to it.
-func Float32(v float32) *float32 {
- return &v
-}
-
-// Float64 is a helper routine that allocates a new float64 value
-// to store v and returns a pointer to it.
-func Float64(v float64) *float64 {
- return &v
-}
-
-// Uint32 is a helper routine that allocates a new uint32 value
-// to store v and returns a pointer to it.
-func Uint32(v uint32) *uint32 {
- return &v
-}
-
-// Uint64 is a helper routine that allocates a new uint64 value
-// to store v and returns a pointer to it.
-func Uint64(v uint64) *uint64 {
- return &v
-}
-
-// String is a helper routine that allocates a new string value
-// to store v and returns a pointer to it.
-func String(v string) *string {
- return &v
-}
-
-// EnumName is a helper function to simplify printing protocol buffer enums
-// by name. Given an enum map and a value, it returns a useful string.
-func EnumName(m map[int32]string, v int32) string {
- s, ok := m[v]
- if ok {
- return s
- }
- return strconv.Itoa(int(v))
-}
-
-// UnmarshalJSONEnum is a helper function to simplify recovering enum int values
-// from their JSON-encoded representation. Given a map from the enum's symbolic
-// names to its int values, and a byte buffer containing the JSON-encoded
-// value, it returns an int32 that can be cast to the enum type by the caller.
-//
-// The function can deal with both JSON representations, numeric and symbolic.
-func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) {
- if data[0] == '"' {
- // New style: enums are strings.
- var repr string
- if err := json.Unmarshal(data, &repr); err != nil {
- return -1, err
- }
- val, ok := m[repr]
- if !ok {
- return 0, fmt.Errorf("unrecognized enum %s value %q", enumName, repr)
- }
- return val, nil
- }
- // Old style: enums are ints.
- var val int32
- if err := json.Unmarshal(data, &val); err != nil {
- return 0, fmt.Errorf("cannot unmarshal %#q into enum %s", data, enumName)
- }
- return val, nil
-}
-
-// DebugPrint dumps the encoded data in b in a debugging format with a header
-// including the string s. Used in testing but made available for general debugging.
-func (p *Buffer) DebugPrint(s string, b []byte) {
- var u uint64
-
- obuf := p.buf
- index := p.index
- p.buf = b
- p.index = 0
- depth := 0
-
- fmt.Printf("\n--- %s ---\n", s)
-
-out:
- for {
- for i := 0; i < depth; i++ {
- fmt.Print(" ")
- }
-
- index := p.index
- if index == len(p.buf) {
- break
- }
-
- op, err := p.DecodeVarint()
- if err != nil {
- fmt.Printf("%3d: fetching op err %v\n", index, err)
- break out
- }
- tag := op >> 3
- wire := op & 7
-
- switch wire {
- default:
- fmt.Printf("%3d: t=%3d unknown wire=%d\n",
- index, tag, wire)
- break out
-
- case WireBytes:
- var r []byte
-
- r, err = p.DecodeRawBytes(false)
- if err != nil {
- break out
- }
- fmt.Printf("%3d: t=%3d bytes [%d]", index, tag, len(r))
- if len(r) <= 6 {
- for i := 0; i < len(r); i++ {
- fmt.Printf(" %.2x", r[i])
- }
- } else {
- for i := 0; i < 3; i++ {
- fmt.Printf(" %.2x", r[i])
- }
- fmt.Printf(" ..")
- for i := len(r) - 3; i < len(r); i++ {
- fmt.Printf(" %.2x", r[i])
- }
- }
- fmt.Printf("\n")
-
- case WireFixed32:
- u, err = p.DecodeFixed32()
- if err != nil {
- fmt.Printf("%3d: t=%3d fix32 err %v\n", index, tag, err)
- break out
- }
- fmt.Printf("%3d: t=%3d fix32 %d\n", index, tag, u)
-
- case WireFixed64:
- u, err = p.DecodeFixed64()
- if err != nil {
- fmt.Printf("%3d: t=%3d fix64 err %v\n", index, tag, err)
- break out
- }
- fmt.Printf("%3d: t=%3d fix64 %d\n", index, tag, u)
-
- case WireVarint:
- u, err = p.DecodeVarint()
- if err != nil {
- fmt.Printf("%3d: t=%3d varint err %v\n", index, tag, err)
- break out
- }
- fmt.Printf("%3d: t=%3d varint %d\n", index, tag, u)
-
- case WireStartGroup:
- fmt.Printf("%3d: t=%3d start\n", index, tag)
- depth++
-
- case WireEndGroup:
- depth--
- fmt.Printf("%3d: t=%3d end\n", index, tag)
- }
- }
-
- if depth != 0 {
- fmt.Printf("%3d: start-end not balanced %d\n", p.index, depth)
- }
- fmt.Printf("\n")
-
- p.buf = obuf
- p.index = index
-}
-
-// SetDefaults sets unset protocol buffer fields to their default values.
-// It only modifies fields that are both unset and have defined defaults.
-// It recursively sets default values in any non-nil sub-messages.
-func SetDefaults(pb Message) {
- setDefaults(reflect.ValueOf(pb), true, false)
-}
-
-// v is a pointer to a struct.
-func setDefaults(v reflect.Value, recur, zeros bool) {
- v = v.Elem()
-
- defaultMu.RLock()
- dm, ok := defaults[v.Type()]
- defaultMu.RUnlock()
- if !ok {
- dm = buildDefaultMessage(v.Type())
- defaultMu.Lock()
- defaults[v.Type()] = dm
- defaultMu.Unlock()
- }
-
- for _, sf := range dm.scalars {
- f := v.Field(sf.index)
- if !f.IsNil() {
- // field already set
- continue
- }
- dv := sf.value
- if dv == nil && !zeros {
- // no explicit default, and don't want to set zeros
- continue
- }
- fptr := f.Addr().Interface() // **T
- // TODO: Consider batching the allocations we do here.
- switch sf.kind {
- case reflect.Bool:
- b := new(bool)
- if dv != nil {
- *b = dv.(bool)
- }
- *(fptr.(**bool)) = b
- case reflect.Float32:
- f := new(float32)
- if dv != nil {
- *f = dv.(float32)
- }
- *(fptr.(**float32)) = f
- case reflect.Float64:
- f := new(float64)
- if dv != nil {
- *f = dv.(float64)
- }
- *(fptr.(**float64)) = f
- case reflect.Int32:
- // might be an enum
- if ft := f.Type(); ft != int32PtrType {
- // enum
- f.Set(reflect.New(ft.Elem()))
- if dv != nil {
- f.Elem().SetInt(int64(dv.(int32)))
- }
- } else {
- // int32 field
- i := new(int32)
- if dv != nil {
- *i = dv.(int32)
- }
- *(fptr.(**int32)) = i
- }
- case reflect.Int64:
- i := new(int64)
- if dv != nil {
- *i = dv.(int64)
- }
- *(fptr.(**int64)) = i
- case reflect.String:
- s := new(string)
- if dv != nil {
- *s = dv.(string)
- }
- *(fptr.(**string)) = s
- case reflect.Uint8:
- // exceptional case: []byte
- var b []byte
- if dv != nil {
- db := dv.([]byte)
- b = make([]byte, len(db))
- copy(b, db)
- } else {
- b = []byte{}
- }
- *(fptr.(*[]byte)) = b
- case reflect.Uint32:
- u := new(uint32)
- if dv != nil {
- *u = dv.(uint32)
- }
- *(fptr.(**uint32)) = u
- case reflect.Uint64:
- u := new(uint64)
- if dv != nil {
- *u = dv.(uint64)
- }
- *(fptr.(**uint64)) = u
- default:
- log.Printf("proto: can't set default for field %v (sf.kind=%v)", f, sf.kind)
- }
- }
-
- for _, ni := range dm.nested {
- f := v.Field(ni)
- // f is *T or []*T or map[T]*T
- switch f.Kind() {
- case reflect.Ptr:
- if f.IsNil() {
- continue
- }
- setDefaults(f, recur, zeros)
-
- case reflect.Slice:
- for i := 0; i < f.Len(); i++ {
- e := f.Index(i)
- if e.IsNil() {
- continue
- }
- setDefaults(e, recur, zeros)
- }
-
- case reflect.Map:
- for _, k := range f.MapKeys() {
- e := f.MapIndex(k)
- if e.IsNil() {
- continue
- }
- setDefaults(e, recur, zeros)
- }
- }
- }
-}
-
-var (
- // defaults maps a protocol buffer struct type to a slice of the fields,
- // with its scalar fields set to their proto-declared non-zero default values.
- defaultMu sync.RWMutex
- defaults = make(map[reflect.Type]defaultMessage)
-
- int32PtrType = reflect.TypeOf((*int32)(nil))
-)
-
-// defaultMessage represents information about the default values of a message.
-type defaultMessage struct {
- scalars []scalarField
- nested []int // struct field index of nested messages
-}
-
-type scalarField struct {
- index int // struct field index
- kind reflect.Kind // element type (the T in *T or []T)
- value interface{} // the proto-declared default value, or nil
-}
-
-// t is a struct type.
-func buildDefaultMessage(t reflect.Type) (dm defaultMessage) {
- sprop := GetProperties(t)
- for _, prop := range sprop.Prop {
- fi, ok := sprop.decoderTags.get(prop.Tag)
- if !ok {
- // XXX_unrecognized
- continue
- }
- ft := t.Field(fi).Type
-
- sf, nested, err := fieldDefault(ft, prop)
- switch {
- case err != nil:
- log.Print(err)
- case nested:
- dm.nested = append(dm.nested, fi)
- case sf != nil:
- sf.index = fi
- dm.scalars = append(dm.scalars, *sf)
- }
- }
-
- return dm
-}
-
-// fieldDefault returns the scalarField for field type ft.
-// sf will be nil if the field can not have a default.
-// nestedMessage will be true if this is a nested message.
-// Note that sf.index is not set on return.
-func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) {
- var canHaveDefault bool
- switch ft.Kind() {
- case reflect.Ptr:
- if ft.Elem().Kind() == reflect.Struct {
- nestedMessage = true
- } else {
- canHaveDefault = true // proto2 scalar field
- }
-
- case reflect.Slice:
- switch ft.Elem().Kind() {
- case reflect.Ptr:
- nestedMessage = true // repeated message
- case reflect.Uint8:
- canHaveDefault = true // bytes field
- }
-
- case reflect.Map:
- if ft.Elem().Kind() == reflect.Ptr {
- nestedMessage = true // map with message values
- }
- }
-
- if !canHaveDefault {
- if nestedMessage {
- return nil, true, nil
- }
- return nil, false, nil
- }
-
- // We now know that ft is a pointer or slice.
- sf = &scalarField{kind: ft.Elem().Kind()}
-
- // scalar fields without defaults
- if !prop.HasDefault {
- return sf, false, nil
- }
-
- // a scalar field: either *T or []byte
- switch ft.Elem().Kind() {
- case reflect.Bool:
- x, err := strconv.ParseBool(prop.Default)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default bool %q: %v", prop.Default, err)
- }
- sf.value = x
- case reflect.Float32:
- x, err := strconv.ParseFloat(prop.Default, 32)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default float32 %q: %v", prop.Default, err)
- }
- sf.value = float32(x)
- case reflect.Float64:
- x, err := strconv.ParseFloat(prop.Default, 64)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default float64 %q: %v", prop.Default, err)
- }
- sf.value = x
- case reflect.Int32:
- x, err := strconv.ParseInt(prop.Default, 10, 32)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default int32 %q: %v", prop.Default, err)
- }
- sf.value = int32(x)
- case reflect.Int64:
- x, err := strconv.ParseInt(prop.Default, 10, 64)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default int64 %q: %v", prop.Default, err)
- }
- sf.value = x
- case reflect.String:
- sf.value = prop.Default
- case reflect.Uint8:
- // []byte (not *uint8)
- sf.value = []byte(prop.Default)
- case reflect.Uint32:
- x, err := strconv.ParseUint(prop.Default, 10, 32)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default uint32 %q: %v", prop.Default, err)
- }
- sf.value = uint32(x)
- case reflect.Uint64:
- x, err := strconv.ParseUint(prop.Default, 10, 64)
- if err != nil {
- return nil, false, fmt.Errorf("proto: bad default uint64 %q: %v", prop.Default, err)
- }
- sf.value = x
- default:
- return nil, false, fmt.Errorf("proto: unhandled def kind %v", ft.Elem().Kind())
- }
-
- return sf, false, nil
-}
-
-// mapKeys returns a sort.Interface to be used for sorting the map keys.
-// Map fields may have key types of non-float scalars, strings and enums.
-func mapKeys(vs []reflect.Value) sort.Interface {
- s := mapKeySorter{vs: vs}
-
- // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps.
- if len(vs) == 0 {
- return s
- }
- switch vs[0].Kind() {
- case reflect.Int32, reflect.Int64:
- s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() }
- case reflect.Uint32, reflect.Uint64:
- s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() }
- case reflect.Bool:
- s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true
- case reflect.String:
- s.less = func(a, b reflect.Value) bool { return a.String() < b.String() }
- default:
- panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind()))
- }
-
- return s
-}
-
-type mapKeySorter struct {
- vs []reflect.Value
- less func(a, b reflect.Value) bool
-}
-
-func (s mapKeySorter) Len() int { return len(s.vs) }
-func (s mapKeySorter) Swap(i, j int) { s.vs[i], s.vs[j] = s.vs[j], s.vs[i] }
-func (s mapKeySorter) Less(i, j int) bool {
- return s.less(s.vs[i], s.vs[j])
-}
-
-// isProto3Zero reports whether v is a zero proto3 value.
-func isProto3Zero(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint32, reflect.Uint64:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.String:
- return v.String() == ""
- }
- return false
-}
-
-// ProtoPackageIsVersion2 is referenced from generated protocol buffer files
-// to assert that that code is compatible with this version of the proto package.
-const ProtoPackageIsVersion2 = true
-
-// ProtoPackageIsVersion1 is referenced from generated protocol buffer files
-// to assert that that code is compatible with this version of the proto package.
-const ProtoPackageIsVersion1 = true
-
-// InternalMessageInfo is a type used internally by generated .pb.go files.
-// This type is not intended to be used by non-generated code.
-// This type is not subject to any compatibility guarantee.
-type InternalMessageInfo struct {
- marshal *marshalInfo
- unmarshal *unmarshalInfo
- merge *mergeInfo
- discard *discardInfo
-}
diff --git a/vendor/github.com/golang/protobuf/proto/message_set.go b/vendor/github.com/golang/protobuf/proto/message_set.go
deleted file mode 100644
index 3b6ca41d5e5543dddafc5831203d3b8dcb109ba5..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/message_set.go
+++ /dev/null
@@ -1,314 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Support for message sets.
- */
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "reflect"
- "sort"
- "sync"
-)
-
-// errNoMessageTypeID occurs when a protocol buffer does not have a message type ID.
-// A message type ID is required for storing a protocol buffer in a message set.
-var errNoMessageTypeID = errors.New("proto does not have a message type ID")
-
-// The first two types (_MessageSet_Item and messageSet)
-// model what the protocol compiler produces for the following protocol message:
-// message MessageSet {
-// repeated group Item = 1 {
-// required int32 type_id = 2;
-// required string message = 3;
-// };
-// }
-// That is the MessageSet wire format. We can't use a proto to generate these
-// because that would introduce a circular dependency between it and this package.
-
-type _MessageSet_Item struct {
- TypeId *int32 `protobuf:"varint,2,req,name=type_id"`
- Message []byte `protobuf:"bytes,3,req,name=message"`
-}
-
-type messageSet struct {
- Item []*_MessageSet_Item `protobuf:"group,1,rep"`
- XXX_unrecognized []byte
- // TODO: caching?
-}
-
-// Make sure messageSet is a Message.
-var _ Message = (*messageSet)(nil)
-
-// messageTypeIder is an interface satisfied by a protocol buffer type
-// that may be stored in a MessageSet.
-type messageTypeIder interface {
- MessageTypeId() int32
-}
-
-func (ms *messageSet) find(pb Message) *_MessageSet_Item {
- mti, ok := pb.(messageTypeIder)
- if !ok {
- return nil
- }
- id := mti.MessageTypeId()
- for _, item := range ms.Item {
- if *item.TypeId == id {
- return item
- }
- }
- return nil
-}
-
-func (ms *messageSet) Has(pb Message) bool {
- return ms.find(pb) != nil
-}
-
-func (ms *messageSet) Unmarshal(pb Message) error {
- if item := ms.find(pb); item != nil {
- return Unmarshal(item.Message, pb)
- }
- if _, ok := pb.(messageTypeIder); !ok {
- return errNoMessageTypeID
- }
- return nil // TODO: return error instead?
-}
-
-func (ms *messageSet) Marshal(pb Message) error {
- msg, err := Marshal(pb)
- if err != nil {
- return err
- }
- if item := ms.find(pb); item != nil {
- // reuse existing item
- item.Message = msg
- return nil
- }
-
- mti, ok := pb.(messageTypeIder)
- if !ok {
- return errNoMessageTypeID
- }
-
- mtid := mti.MessageTypeId()
- ms.Item = append(ms.Item, &_MessageSet_Item{
- TypeId: &mtid,
- Message: msg,
- })
- return nil
-}
-
-func (ms *messageSet) Reset() { *ms = messageSet{} }
-func (ms *messageSet) String() string { return CompactTextString(ms) }
-func (*messageSet) ProtoMessage() {}
-
-// Support for the message_set_wire_format message option.
-
-func skipVarint(buf []byte) []byte {
- i := 0
- for ; buf[i]&0x80 != 0; i++ {
- }
- return buf[i+1:]
-}
-
-// MarshalMessageSet encodes the extension map represented by m in the message set wire format.
-// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option.
-func MarshalMessageSet(exts interface{}) ([]byte, error) {
- return marshalMessageSet(exts, false)
-}
-
-// marshaMessageSet implements above function, with the opt to turn on / off deterministic during Marshal.
-func marshalMessageSet(exts interface{}, deterministic bool) ([]byte, error) {
- switch exts := exts.(type) {
- case *XXX_InternalExtensions:
- var u marshalInfo
- siz := u.sizeMessageSet(exts)
- b := make([]byte, 0, siz)
- return u.appendMessageSet(b, exts, deterministic)
-
- case map[int32]Extension:
- // This is an old-style extension map.
- // Wrap it in a new-style XXX_InternalExtensions.
- ie := XXX_InternalExtensions{
- p: &struct {
- mu sync.Mutex
- extensionMap map[int32]Extension
- }{
- extensionMap: exts,
- },
- }
-
- var u marshalInfo
- siz := u.sizeMessageSet(&ie)
- b := make([]byte, 0, siz)
- return u.appendMessageSet(b, &ie, deterministic)
-
- default:
- return nil, errors.New("proto: not an extension map")
- }
-}
-
-// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format.
-// It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option.
-func UnmarshalMessageSet(buf []byte, exts interface{}) error {
- var m map[int32]Extension
- switch exts := exts.(type) {
- case *XXX_InternalExtensions:
- m = exts.extensionsWrite()
- case map[int32]Extension:
- m = exts
- default:
- return errors.New("proto: not an extension map")
- }
-
- ms := new(messageSet)
- if err := Unmarshal(buf, ms); err != nil {
- return err
- }
- for _, item := range ms.Item {
- id := *item.TypeId
- msg := item.Message
-
- // Restore wire type and field number varint, plus length varint.
- // Be careful to preserve duplicate items.
- b := EncodeVarint(uint64(id)<<3 | WireBytes)
- if ext, ok := m[id]; ok {
- // Existing data; rip off the tag and length varint
- // so we join the new data correctly.
- // We can assume that ext.enc is set because we are unmarshaling.
- o := ext.enc[len(b):] // skip wire type and field number
- _, n := DecodeVarint(o) // calculate length of length varint
- o = o[n:] // skip length varint
- msg = append(o, msg...) // join old data and new data
- }
- b = append(b, EncodeVarint(uint64(len(msg)))...)
- b = append(b, msg...)
-
- m[id] = Extension{enc: b}
- }
- return nil
-}
-
-// MarshalMessageSetJSON encodes the extension map represented by m in JSON format.
-// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
-func MarshalMessageSetJSON(exts interface{}) ([]byte, error) {
- var m map[int32]Extension
- switch exts := exts.(type) {
- case *XXX_InternalExtensions:
- var mu sync.Locker
- m, mu = exts.extensionsRead()
- if m != nil {
- // Keep the extensions map locked until we're done marshaling to prevent
- // races between marshaling and unmarshaling the lazily-{en,de}coded
- // values.
- mu.Lock()
- defer mu.Unlock()
- }
- case map[int32]Extension:
- m = exts
- default:
- return nil, errors.New("proto: not an extension map")
- }
- var b bytes.Buffer
- b.WriteByte('{')
-
- // Process the map in key order for deterministic output.
- ids := make([]int32, 0, len(m))
- for id := range m {
- ids = append(ids, id)
- }
- sort.Sort(int32Slice(ids)) // int32Slice defined in text.go
-
- for i, id := range ids {
- ext := m[id]
- msd, ok := messageSetMap[id]
- if !ok {
- // Unknown type; we can't render it, so skip it.
- continue
- }
-
- if i > 0 && b.Len() > 1 {
- b.WriteByte(',')
- }
-
- fmt.Fprintf(&b, `"[%s]":`, msd.name)
-
- x := ext.value
- if x == nil {
- x = reflect.New(msd.t.Elem()).Interface()
- if err := Unmarshal(ext.enc, x.(Message)); err != nil {
- return nil, err
- }
- }
- d, err := json.Marshal(x)
- if err != nil {
- return nil, err
- }
- b.Write(d)
- }
- b.WriteByte('}')
- return b.Bytes(), nil
-}
-
-// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format.
-// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option.
-func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error {
- // Common-case fast path.
- if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) {
- return nil
- }
-
- // This is fairly tricky, and it's not clear that it is needed.
- return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented")
-}
-
-// A global registry of types that can be used in a MessageSet.
-
-var messageSetMap = make(map[int32]messageSetDesc)
-
-type messageSetDesc struct {
- t reflect.Type // pointer to struct
- name string
-}
-
-// RegisterMessageSetType is called from the generated code.
-func RegisterMessageSetType(m Message, fieldNum int32, name string) {
- messageSetMap[fieldNum] = messageSetDesc{
- t: reflect.TypeOf(m),
- name: name,
- }
-}
diff --git a/vendor/github.com/golang/protobuf/proto/pointer_reflect.go b/vendor/github.com/golang/protobuf/proto/pointer_reflect.go
deleted file mode 100644
index b6cad90834b31a7e1ce445486d849285e9454573..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/pointer_reflect.go
+++ /dev/null
@@ -1,357 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// +build purego appengine js
-
-// This file contains an implementation of proto field accesses using package reflect.
-// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can
-// be used on App Engine.
-
-package proto
-
-import (
- "reflect"
- "sync"
-)
-
-const unsafeAllowed = false
-
-// A field identifies a field in a struct, accessible from a pointer.
-// In this implementation, a field is identified by the sequence of field indices
-// passed to reflect's FieldByIndex.
-type field []int
-
-// toField returns a field equivalent to the given reflect field.
-func toField(f *reflect.StructField) field {
- return f.Index
-}
-
-// invalidField is an invalid field identifier.
-var invalidField = field(nil)
-
-// zeroField is a noop when calling pointer.offset.
-var zeroField = field([]int{})
-
-// IsValid reports whether the field identifier is valid.
-func (f field) IsValid() bool { return f != nil }
-
-// The pointer type is for the table-driven decoder.
-// The implementation here uses a reflect.Value of pointer type to
-// create a generic pointer. In pointer_unsafe.go we use unsafe
-// instead of reflect to implement the same (but faster) interface.
-type pointer struct {
- v reflect.Value
-}
-
-// toPointer converts an interface of pointer type to a pointer
-// that points to the same target.
-func toPointer(i *Message) pointer {
- return pointer{v: reflect.ValueOf(*i)}
-}
-
-// toAddrPointer converts an interface to a pointer that points to
-// the interface data.
-func toAddrPointer(i *interface{}, isptr bool) pointer {
- v := reflect.ValueOf(*i)
- u := reflect.New(v.Type())
- u.Elem().Set(v)
- return pointer{v: u}
-}
-
-// valToPointer converts v to a pointer. v must be of pointer type.
-func valToPointer(v reflect.Value) pointer {
- return pointer{v: v}
-}
-
-// offset converts from a pointer to a structure to a pointer to
-// one of its fields.
-func (p pointer) offset(f field) pointer {
- return pointer{v: p.v.Elem().FieldByIndex(f).Addr()}
-}
-
-func (p pointer) isNil() bool {
- return p.v.IsNil()
-}
-
-// grow updates the slice s in place to make it one element longer.
-// s must be addressable.
-// Returns the (addressable) new element.
-func grow(s reflect.Value) reflect.Value {
- n, m := s.Len(), s.Cap()
- if n < m {
- s.SetLen(n + 1)
- } else {
- s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem())))
- }
- return s.Index(n)
-}
-
-func (p pointer) toInt64() *int64 {
- return p.v.Interface().(*int64)
-}
-func (p pointer) toInt64Ptr() **int64 {
- return p.v.Interface().(**int64)
-}
-func (p pointer) toInt64Slice() *[]int64 {
- return p.v.Interface().(*[]int64)
-}
-
-var int32ptr = reflect.TypeOf((*int32)(nil))
-
-func (p pointer) toInt32() *int32 {
- return p.v.Convert(int32ptr).Interface().(*int32)
-}
-
-// The toInt32Ptr/Slice methods don't work because of enums.
-// Instead, we must use set/get methods for the int32ptr/slice case.
-/*
- func (p pointer) toInt32Ptr() **int32 {
- return p.v.Interface().(**int32)
-}
- func (p pointer) toInt32Slice() *[]int32 {
- return p.v.Interface().(*[]int32)
-}
-*/
-func (p pointer) getInt32Ptr() *int32 {
- if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) {
- // raw int32 type
- return p.v.Elem().Interface().(*int32)
- }
- // an enum
- return p.v.Elem().Convert(int32PtrType).Interface().(*int32)
-}
-func (p pointer) setInt32Ptr(v int32) {
- // Allocate value in a *int32. Possibly convert that to a *enum.
- // Then assign it to a **int32 or **enum.
- // Note: we can convert *int32 to *enum, but we can't convert
- // **int32 to **enum!
- p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem()))
-}
-
-// getInt32Slice copies []int32 from p as a new slice.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) getInt32Slice() []int32 {
- if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) {
- // raw int32 type
- return p.v.Elem().Interface().([]int32)
- }
- // an enum
- // Allocate a []int32, then assign []enum's values into it.
- // Note: we can't convert []enum to []int32.
- slice := p.v.Elem()
- s := make([]int32, slice.Len())
- for i := 0; i < slice.Len(); i++ {
- s[i] = int32(slice.Index(i).Int())
- }
- return s
-}
-
-// setInt32Slice copies []int32 into p as a new slice.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) setInt32Slice(v []int32) {
- if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) {
- // raw int32 type
- p.v.Elem().Set(reflect.ValueOf(v))
- return
- }
- // an enum
- // Allocate a []enum, then assign []int32's values into it.
- // Note: we can't convert []enum to []int32.
- slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v))
- for i, x := range v {
- slice.Index(i).SetInt(int64(x))
- }
- p.v.Elem().Set(slice)
-}
-func (p pointer) appendInt32Slice(v int32) {
- grow(p.v.Elem()).SetInt(int64(v))
-}
-
-func (p pointer) toUint64() *uint64 {
- return p.v.Interface().(*uint64)
-}
-func (p pointer) toUint64Ptr() **uint64 {
- return p.v.Interface().(**uint64)
-}
-func (p pointer) toUint64Slice() *[]uint64 {
- return p.v.Interface().(*[]uint64)
-}
-func (p pointer) toUint32() *uint32 {
- return p.v.Interface().(*uint32)
-}
-func (p pointer) toUint32Ptr() **uint32 {
- return p.v.Interface().(**uint32)
-}
-func (p pointer) toUint32Slice() *[]uint32 {
- return p.v.Interface().(*[]uint32)
-}
-func (p pointer) toBool() *bool {
- return p.v.Interface().(*bool)
-}
-func (p pointer) toBoolPtr() **bool {
- return p.v.Interface().(**bool)
-}
-func (p pointer) toBoolSlice() *[]bool {
- return p.v.Interface().(*[]bool)
-}
-func (p pointer) toFloat64() *float64 {
- return p.v.Interface().(*float64)
-}
-func (p pointer) toFloat64Ptr() **float64 {
- return p.v.Interface().(**float64)
-}
-func (p pointer) toFloat64Slice() *[]float64 {
- return p.v.Interface().(*[]float64)
-}
-func (p pointer) toFloat32() *float32 {
- return p.v.Interface().(*float32)
-}
-func (p pointer) toFloat32Ptr() **float32 {
- return p.v.Interface().(**float32)
-}
-func (p pointer) toFloat32Slice() *[]float32 {
- return p.v.Interface().(*[]float32)
-}
-func (p pointer) toString() *string {
- return p.v.Interface().(*string)
-}
-func (p pointer) toStringPtr() **string {
- return p.v.Interface().(**string)
-}
-func (p pointer) toStringSlice() *[]string {
- return p.v.Interface().(*[]string)
-}
-func (p pointer) toBytes() *[]byte {
- return p.v.Interface().(*[]byte)
-}
-func (p pointer) toBytesSlice() *[][]byte {
- return p.v.Interface().(*[][]byte)
-}
-func (p pointer) toExtensions() *XXX_InternalExtensions {
- return p.v.Interface().(*XXX_InternalExtensions)
-}
-func (p pointer) toOldExtensions() *map[int32]Extension {
- return p.v.Interface().(*map[int32]Extension)
-}
-func (p pointer) getPointer() pointer {
- return pointer{v: p.v.Elem()}
-}
-func (p pointer) setPointer(q pointer) {
- p.v.Elem().Set(q.v)
-}
-func (p pointer) appendPointer(q pointer) {
- grow(p.v.Elem()).Set(q.v)
-}
-
-// getPointerSlice copies []*T from p as a new []pointer.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) getPointerSlice() []pointer {
- if p.v.IsNil() {
- return nil
- }
- n := p.v.Elem().Len()
- s := make([]pointer, n)
- for i := 0; i < n; i++ {
- s[i] = pointer{v: p.v.Elem().Index(i)}
- }
- return s
-}
-
-// setPointerSlice copies []pointer into p as a new []*T.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) setPointerSlice(v []pointer) {
- if v == nil {
- p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem())
- return
- }
- s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v))
- for _, p := range v {
- s = reflect.Append(s, p.v)
- }
- p.v.Elem().Set(s)
-}
-
-// getInterfacePointer returns a pointer that points to the
-// interface data of the interface pointed by p.
-func (p pointer) getInterfacePointer() pointer {
- if p.v.Elem().IsNil() {
- return pointer{v: p.v.Elem()}
- }
- return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct
-}
-
-func (p pointer) asPointerTo(t reflect.Type) reflect.Value {
- // TODO: check that p.v.Type().Elem() == t?
- return p.v
-}
-
-func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- return *p
-}
-func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- *p = v
-}
-func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- return *p
-}
-func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- *p = v
-}
-func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- return *p
-}
-func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- *p = v
-}
-func atomicLoadDiscardInfo(p **discardInfo) *discardInfo {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- return *p
-}
-func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) {
- atomicLock.Lock()
- defer atomicLock.Unlock()
- *p = v
-}
-
-var atomicLock sync.Mutex
diff --git a/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go b/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go
deleted file mode 100644
index d55a335d9453204ae01c7c21d474efdbefa7d120..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go
+++ /dev/null
@@ -1,308 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2012 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// +build !purego,!appengine,!js
-
-// This file contains the implementation of the proto field accesses using package unsafe.
-
-package proto
-
-import (
- "reflect"
- "sync/atomic"
- "unsafe"
-)
-
-const unsafeAllowed = true
-
-// A field identifies a field in a struct, accessible from a pointer.
-// In this implementation, a field is identified by its byte offset from the start of the struct.
-type field uintptr
-
-// toField returns a field equivalent to the given reflect field.
-func toField(f *reflect.StructField) field {
- return field(f.Offset)
-}
-
-// invalidField is an invalid field identifier.
-const invalidField = ^field(0)
-
-// zeroField is a noop when calling pointer.offset.
-const zeroField = field(0)
-
-// IsValid reports whether the field identifier is valid.
-func (f field) IsValid() bool {
- return f != invalidField
-}
-
-// The pointer type below is for the new table-driven encoder/decoder.
-// The implementation here uses unsafe.Pointer to create a generic pointer.
-// In pointer_reflect.go we use reflect instead of unsafe to implement
-// the same (but slower) interface.
-type pointer struct {
- p unsafe.Pointer
-}
-
-// size of pointer
-var ptrSize = unsafe.Sizeof(uintptr(0))
-
-// toPointer converts an interface of pointer type to a pointer
-// that points to the same target.
-func toPointer(i *Message) pointer {
- // Super-tricky - read pointer out of data word of interface value.
- // Saves ~25ns over the equivalent:
- // return valToPointer(reflect.ValueOf(*i))
- return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]}
-}
-
-// toAddrPointer converts an interface to a pointer that points to
-// the interface data.
-func toAddrPointer(i *interface{}, isptr bool) pointer {
- // Super-tricky - read or get the address of data word of interface value.
- if isptr {
- // The interface is of pointer type, thus it is a direct interface.
- // The data word is the pointer data itself. We take its address.
- return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)}
- }
- // The interface is not of pointer type. The data word is the pointer
- // to the data.
- return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]}
-}
-
-// valToPointer converts v to a pointer. v must be of pointer type.
-func valToPointer(v reflect.Value) pointer {
- return pointer{p: unsafe.Pointer(v.Pointer())}
-}
-
-// offset converts from a pointer to a structure to a pointer to
-// one of its fields.
-func (p pointer) offset(f field) pointer {
- // For safety, we should panic if !f.IsValid, however calling panic causes
- // this to no longer be inlineable, which is a serious performance cost.
- /*
- if !f.IsValid() {
- panic("invalid field")
- }
- */
- return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))}
-}
-
-func (p pointer) isNil() bool {
- return p.p == nil
-}
-
-func (p pointer) toInt64() *int64 {
- return (*int64)(p.p)
-}
-func (p pointer) toInt64Ptr() **int64 {
- return (**int64)(p.p)
-}
-func (p pointer) toInt64Slice() *[]int64 {
- return (*[]int64)(p.p)
-}
-func (p pointer) toInt32() *int32 {
- return (*int32)(p.p)
-}
-
-// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist.
-/*
- func (p pointer) toInt32Ptr() **int32 {
- return (**int32)(p.p)
- }
- func (p pointer) toInt32Slice() *[]int32 {
- return (*[]int32)(p.p)
- }
-*/
-func (p pointer) getInt32Ptr() *int32 {
- return *(**int32)(p.p)
-}
-func (p pointer) setInt32Ptr(v int32) {
- *(**int32)(p.p) = &v
-}
-
-// getInt32Slice loads a []int32 from p.
-// The value returned is aliased with the original slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) getInt32Slice() []int32 {
- return *(*[]int32)(p.p)
-}
-
-// setInt32Slice stores a []int32 to p.
-// The value set is aliased with the input slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) setInt32Slice(v []int32) {
- *(*[]int32)(p.p) = v
-}
-
-// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead?
-func (p pointer) appendInt32Slice(v int32) {
- s := (*[]int32)(p.p)
- *s = append(*s, v)
-}
-
-func (p pointer) toUint64() *uint64 {
- return (*uint64)(p.p)
-}
-func (p pointer) toUint64Ptr() **uint64 {
- return (**uint64)(p.p)
-}
-func (p pointer) toUint64Slice() *[]uint64 {
- return (*[]uint64)(p.p)
-}
-func (p pointer) toUint32() *uint32 {
- return (*uint32)(p.p)
-}
-func (p pointer) toUint32Ptr() **uint32 {
- return (**uint32)(p.p)
-}
-func (p pointer) toUint32Slice() *[]uint32 {
- return (*[]uint32)(p.p)
-}
-func (p pointer) toBool() *bool {
- return (*bool)(p.p)
-}
-func (p pointer) toBoolPtr() **bool {
- return (**bool)(p.p)
-}
-func (p pointer) toBoolSlice() *[]bool {
- return (*[]bool)(p.p)
-}
-func (p pointer) toFloat64() *float64 {
- return (*float64)(p.p)
-}
-func (p pointer) toFloat64Ptr() **float64 {
- return (**float64)(p.p)
-}
-func (p pointer) toFloat64Slice() *[]float64 {
- return (*[]float64)(p.p)
-}
-func (p pointer) toFloat32() *float32 {
- return (*float32)(p.p)
-}
-func (p pointer) toFloat32Ptr() **float32 {
- return (**float32)(p.p)
-}
-func (p pointer) toFloat32Slice() *[]float32 {
- return (*[]float32)(p.p)
-}
-func (p pointer) toString() *string {
- return (*string)(p.p)
-}
-func (p pointer) toStringPtr() **string {
- return (**string)(p.p)
-}
-func (p pointer) toStringSlice() *[]string {
- return (*[]string)(p.p)
-}
-func (p pointer) toBytes() *[]byte {
- return (*[]byte)(p.p)
-}
-func (p pointer) toBytesSlice() *[][]byte {
- return (*[][]byte)(p.p)
-}
-func (p pointer) toExtensions() *XXX_InternalExtensions {
- return (*XXX_InternalExtensions)(p.p)
-}
-func (p pointer) toOldExtensions() *map[int32]Extension {
- return (*map[int32]Extension)(p.p)
-}
-
-// getPointerSlice loads []*T from p as a []pointer.
-// The value returned is aliased with the original slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) getPointerSlice() []pointer {
- // Super-tricky - p should point to a []*T where T is a
- // message type. We load it as []pointer.
- return *(*[]pointer)(p.p)
-}
-
-// setPointerSlice stores []pointer into p as a []*T.
-// The value set is aliased with the input slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) setPointerSlice(v []pointer) {
- // Super-tricky - p should point to a []*T where T is a
- // message type. We store it as []pointer.
- *(*[]pointer)(p.p) = v
-}
-
-// getPointer loads the pointer at p and returns it.
-func (p pointer) getPointer() pointer {
- return pointer{p: *(*unsafe.Pointer)(p.p)}
-}
-
-// setPointer stores the pointer q at p.
-func (p pointer) setPointer(q pointer) {
- *(*unsafe.Pointer)(p.p) = q.p
-}
-
-// append q to the slice pointed to by p.
-func (p pointer) appendPointer(q pointer) {
- s := (*[]unsafe.Pointer)(p.p)
- *s = append(*s, q.p)
-}
-
-// getInterfacePointer returns a pointer that points to the
-// interface data of the interface pointed by p.
-func (p pointer) getInterfacePointer() pointer {
- // Super-tricky - read pointer out of data word of interface value.
- return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]}
-}
-
-// asPointerTo returns a reflect.Value that is a pointer to an
-// object of type t stored at p.
-func (p pointer) asPointerTo(t reflect.Type) reflect.Value {
- return reflect.NewAt(t, p.p)
-}
-
-func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo {
- return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
-}
-func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) {
- atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
-}
-func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo {
- return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
-}
-func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) {
- atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
-}
-func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo {
- return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
-}
-func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) {
- atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
-}
-func atomicLoadDiscardInfo(p **discardInfo) *discardInfo {
- return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p))))
-}
-func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) {
- atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v))
-}
diff --git a/vendor/github.com/golang/protobuf/proto/properties.go b/vendor/github.com/golang/protobuf/proto/properties.go
deleted file mode 100644
index 50b99b83a8c79b001ce4efe70986717c89bdee5f..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/properties.go
+++ /dev/null
@@ -1,544 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-/*
- * Routines for encoding data into the wire format for protocol buffers.
- */
-
-import (
- "fmt"
- "log"
- "os"
- "reflect"
- "sort"
- "strconv"
- "strings"
- "sync"
-)
-
-const debug bool = false
-
-// Constants that identify the encoding of a value on the wire.
-const (
- WireVarint = 0
- WireFixed64 = 1
- WireBytes = 2
- WireStartGroup = 3
- WireEndGroup = 4
- WireFixed32 = 5
-)
-
-// tagMap is an optimization over map[int]int for typical protocol buffer
-// use-cases. Encoded protocol buffers are often in tag order with small tag
-// numbers.
-type tagMap struct {
- fastTags []int
- slowTags map[int]int
-}
-
-// tagMapFastLimit is the upper bound on the tag number that will be stored in
-// the tagMap slice rather than its map.
-const tagMapFastLimit = 1024
-
-func (p *tagMap) get(t int) (int, bool) {
- if t > 0 && t < tagMapFastLimit {
- if t >= len(p.fastTags) {
- return 0, false
- }
- fi := p.fastTags[t]
- return fi, fi >= 0
- }
- fi, ok := p.slowTags[t]
- return fi, ok
-}
-
-func (p *tagMap) put(t int, fi int) {
- if t > 0 && t < tagMapFastLimit {
- for len(p.fastTags) < t+1 {
- p.fastTags = append(p.fastTags, -1)
- }
- p.fastTags[t] = fi
- return
- }
- if p.slowTags == nil {
- p.slowTags = make(map[int]int)
- }
- p.slowTags[t] = fi
-}
-
-// StructProperties represents properties for all the fields of a struct.
-// decoderTags and decoderOrigNames should only be used by the decoder.
-type StructProperties struct {
- Prop []*Properties // properties for each field
- reqCount int // required count
- decoderTags tagMap // map from proto tag to struct field number
- decoderOrigNames map[string]int // map from original name to struct field number
- order []int // list of struct field numbers in tag order
-
- // OneofTypes contains information about the oneof fields in this message.
- // It is keyed by the original name of a field.
- OneofTypes map[string]*OneofProperties
-}
-
-// OneofProperties represents information about a specific field in a oneof.
-type OneofProperties struct {
- Type reflect.Type // pointer to generated struct type for this oneof field
- Field int // struct field number of the containing oneof in the message
- Prop *Properties
-}
-
-// Implement the sorting interface so we can sort the fields in tag order, as recommended by the spec.
-// See encode.go, (*Buffer).enc_struct.
-
-func (sp *StructProperties) Len() int { return len(sp.order) }
-func (sp *StructProperties) Less(i, j int) bool {
- return sp.Prop[sp.order[i]].Tag < sp.Prop[sp.order[j]].Tag
-}
-func (sp *StructProperties) Swap(i, j int) { sp.order[i], sp.order[j] = sp.order[j], sp.order[i] }
-
-// Properties represents the protocol-specific behavior of a single struct field.
-type Properties struct {
- Name string // name of the field, for error messages
- OrigName string // original name before protocol compiler (always set)
- JSONName string // name to use for JSON; determined by protoc
- Wire string
- WireType int
- Tag int
- Required bool
- Optional bool
- Repeated bool
- Packed bool // relevant for repeated primitives only
- Enum string // set for enum types only
- proto3 bool // whether this is known to be a proto3 field
- oneof bool // whether this is a oneof field
-
- Default string // default value
- HasDefault bool // whether an explicit default was provided
-
- stype reflect.Type // set for struct types only
- sprop *StructProperties // set for struct types only
-
- mtype reflect.Type // set for map types only
- MapKeyProp *Properties // set for map types only
- MapValProp *Properties // set for map types only
-}
-
-// String formats the properties in the protobuf struct field tag style.
-func (p *Properties) String() string {
- s := p.Wire
- s += ","
- s += strconv.Itoa(p.Tag)
- if p.Required {
- s += ",req"
- }
- if p.Optional {
- s += ",opt"
- }
- if p.Repeated {
- s += ",rep"
- }
- if p.Packed {
- s += ",packed"
- }
- s += ",name=" + p.OrigName
- if p.JSONName != p.OrigName {
- s += ",json=" + p.JSONName
- }
- if p.proto3 {
- s += ",proto3"
- }
- if p.oneof {
- s += ",oneof"
- }
- if len(p.Enum) > 0 {
- s += ",enum=" + p.Enum
- }
- if p.HasDefault {
- s += ",def=" + p.Default
- }
- return s
-}
-
-// Parse populates p by parsing a string in the protobuf struct field tag style.
-func (p *Properties) Parse(s string) {
- // "bytes,49,opt,name=foo,def=hello!"
- fields := strings.Split(s, ",") // breaks def=, but handled below.
- if len(fields) < 2 {
- fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s)
- return
- }
-
- p.Wire = fields[0]
- switch p.Wire {
- case "varint":
- p.WireType = WireVarint
- case "fixed32":
- p.WireType = WireFixed32
- case "fixed64":
- p.WireType = WireFixed64
- case "zigzag32":
- p.WireType = WireVarint
- case "zigzag64":
- p.WireType = WireVarint
- case "bytes", "group":
- p.WireType = WireBytes
- // no numeric converter for non-numeric types
- default:
- fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s)
- return
- }
-
- var err error
- p.Tag, err = strconv.Atoi(fields[1])
- if err != nil {
- return
- }
-
-outer:
- for i := 2; i < len(fields); i++ {
- f := fields[i]
- switch {
- case f == "req":
- p.Required = true
- case f == "opt":
- p.Optional = true
- case f == "rep":
- p.Repeated = true
- case f == "packed":
- p.Packed = true
- case strings.HasPrefix(f, "name="):
- p.OrigName = f[5:]
- case strings.HasPrefix(f, "json="):
- p.JSONName = f[5:]
- case strings.HasPrefix(f, "enum="):
- p.Enum = f[5:]
- case f == "proto3":
- p.proto3 = true
- case f == "oneof":
- p.oneof = true
- case strings.HasPrefix(f, "def="):
- p.HasDefault = true
- p.Default = f[4:] // rest of string
- if i+1 < len(fields) {
- // Commas aren't escaped, and def is always last.
- p.Default += "," + strings.Join(fields[i+1:], ",")
- break outer
- }
- }
- }
-}
-
-var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem()
-
-// setFieldProps initializes the field properties for submessages and maps.
-func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) {
- switch t1 := typ; t1.Kind() {
- case reflect.Ptr:
- if t1.Elem().Kind() == reflect.Struct {
- p.stype = t1.Elem()
- }
-
- case reflect.Slice:
- if t2 := t1.Elem(); t2.Kind() == reflect.Ptr && t2.Elem().Kind() == reflect.Struct {
- p.stype = t2.Elem()
- }
-
- case reflect.Map:
- p.mtype = t1
- p.MapKeyProp = &Properties{}
- p.MapKeyProp.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp)
- p.MapValProp = &Properties{}
- vtype := p.mtype.Elem()
- if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice {
- // The value type is not a message (*T) or bytes ([]byte),
- // so we need encoders for the pointer to this type.
- vtype = reflect.PtrTo(vtype)
- }
- p.MapValProp.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp)
- }
-
- if p.stype != nil {
- if lockGetProp {
- p.sprop = GetProperties(p.stype)
- } else {
- p.sprop = getPropertiesLocked(p.stype)
- }
- }
-}
-
-var (
- marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem()
-)
-
-// Init populates the properties from a protocol buffer struct tag.
-func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) {
- p.init(typ, name, tag, f, true)
-}
-
-func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructField, lockGetProp bool) {
- // "bytes,49,opt,def=hello!"
- p.Name = name
- p.OrigName = name
- if tag == "" {
- return
- }
- p.Parse(tag)
- p.setFieldProps(typ, f, lockGetProp)
-}
-
-var (
- propertiesMu sync.RWMutex
- propertiesMap = make(map[reflect.Type]*StructProperties)
-)
-
-// GetProperties returns the list of properties for the type represented by t.
-// t must represent a generated struct type of a protocol message.
-func GetProperties(t reflect.Type) *StructProperties {
- if t.Kind() != reflect.Struct {
- panic("proto: type must have kind struct")
- }
-
- // Most calls to GetProperties in a long-running program will be
- // retrieving details for types we have seen before.
- propertiesMu.RLock()
- sprop, ok := propertiesMap[t]
- propertiesMu.RUnlock()
- if ok {
- if collectStats {
- stats.Chit++
- }
- return sprop
- }
-
- propertiesMu.Lock()
- sprop = getPropertiesLocked(t)
- propertiesMu.Unlock()
- return sprop
-}
-
-// getPropertiesLocked requires that propertiesMu is held.
-func getPropertiesLocked(t reflect.Type) *StructProperties {
- if prop, ok := propertiesMap[t]; ok {
- if collectStats {
- stats.Chit++
- }
- return prop
- }
- if collectStats {
- stats.Cmiss++
- }
-
- prop := new(StructProperties)
- // in case of recursive protos, fill this in now.
- propertiesMap[t] = prop
-
- // build properties
- prop.Prop = make([]*Properties, t.NumField())
- prop.order = make([]int, t.NumField())
-
- for i := 0; i < t.NumField(); i++ {
- f := t.Field(i)
- p := new(Properties)
- name := f.Name
- p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false)
-
- oneof := f.Tag.Get("protobuf_oneof") // special case
- if oneof != "" {
- // Oneof fields don't use the traditional protobuf tag.
- p.OrigName = oneof
- }
- prop.Prop[i] = p
- prop.order[i] = i
- if debug {
- print(i, " ", f.Name, " ", t.String(), " ")
- if p.Tag > 0 {
- print(p.String())
- }
- print("\n")
- }
- }
-
- // Re-order prop.order.
- sort.Sort(prop)
-
- type oneofMessage interface {
- XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
- }
- if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok {
- var oots []interface{}
- _, _, _, oots = om.XXX_OneofFuncs()
-
- // Interpret oneof metadata.
- prop.OneofTypes = make(map[string]*OneofProperties)
- for _, oot := range oots {
- oop := &OneofProperties{
- Type: reflect.ValueOf(oot).Type(), // *T
- Prop: new(Properties),
- }
- sft := oop.Type.Elem().Field(0)
- oop.Prop.Name = sft.Name
- oop.Prop.Parse(sft.Tag.Get("protobuf"))
- // There will be exactly one interface field that
- // this new value is assignable to.
- for i := 0; i < t.NumField(); i++ {
- f := t.Field(i)
- if f.Type.Kind() != reflect.Interface {
- continue
- }
- if !oop.Type.AssignableTo(f.Type) {
- continue
- }
- oop.Field = i
- break
- }
- prop.OneofTypes[oop.Prop.OrigName] = oop
- }
- }
-
- // build required counts
- // build tags
- reqCount := 0
- prop.decoderOrigNames = make(map[string]int)
- for i, p := range prop.Prop {
- if strings.HasPrefix(p.Name, "XXX_") {
- // Internal fields should not appear in tags/origNames maps.
- // They are handled specially when encoding and decoding.
- continue
- }
- if p.Required {
- reqCount++
- }
- prop.decoderTags.put(p.Tag, i)
- prop.decoderOrigNames[p.OrigName] = i
- }
- prop.reqCount = reqCount
-
- return prop
-}
-
-// A global registry of enum types.
-// The generated code will register the generated maps by calling RegisterEnum.
-
-var enumValueMaps = make(map[string]map[string]int32)
-
-// RegisterEnum is called from the generated code to install the enum descriptor
-// maps into the global table to aid parsing text format protocol buffers.
-func RegisterEnum(typeName string, unusedNameMap map[int32]string, valueMap map[string]int32) {
- if _, ok := enumValueMaps[typeName]; ok {
- panic("proto: duplicate enum registered: " + typeName)
- }
- enumValueMaps[typeName] = valueMap
-}
-
-// EnumValueMap returns the mapping from names to integers of the
-// enum type enumType, or a nil if not found.
-func EnumValueMap(enumType string) map[string]int32 {
- return enumValueMaps[enumType]
-}
-
-// A registry of all linked message types.
-// The string is a fully-qualified proto name ("pkg.Message").
-var (
- protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers
- protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types
- revProtoTypes = make(map[reflect.Type]string)
-)
-
-// RegisterType is called from generated code and maps from the fully qualified
-// proto name to the type (pointer to struct) of the protocol buffer.
-func RegisterType(x Message, name string) {
- if _, ok := protoTypedNils[name]; ok {
- // TODO: Some day, make this a panic.
- log.Printf("proto: duplicate proto type registered: %s", name)
- return
- }
- t := reflect.TypeOf(x)
- if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 {
- // Generated code always calls RegisterType with nil x.
- // This check is just for extra safety.
- protoTypedNils[name] = x
- } else {
- protoTypedNils[name] = reflect.Zero(t).Interface().(Message)
- }
- revProtoTypes[t] = name
-}
-
-// RegisterMapType is called from generated code and maps from the fully qualified
-// proto name to the native map type of the proto map definition.
-func RegisterMapType(x interface{}, name string) {
- if reflect.TypeOf(x).Kind() != reflect.Map {
- panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name))
- }
- if _, ok := protoMapTypes[name]; ok {
- log.Printf("proto: duplicate proto type registered: %s", name)
- return
- }
- t := reflect.TypeOf(x)
- protoMapTypes[name] = t
- revProtoTypes[t] = name
-}
-
-// MessageName returns the fully-qualified proto name for the given message type.
-func MessageName(x Message) string {
- type xname interface {
- XXX_MessageName() string
- }
- if m, ok := x.(xname); ok {
- return m.XXX_MessageName()
- }
- return revProtoTypes[reflect.TypeOf(x)]
-}
-
-// MessageType returns the message type (pointer to struct) for a named message.
-// The type is not guaranteed to implement proto.Message if the name refers to a
-// map entry.
-func MessageType(name string) reflect.Type {
- if t, ok := protoTypedNils[name]; ok {
- return reflect.TypeOf(t)
- }
- return protoMapTypes[name]
-}
-
-// A registry of all linked proto files.
-var (
- protoFiles = make(map[string][]byte) // file name => fileDescriptor
-)
-
-// RegisterFile is called from generated code and maps from the
-// full file name of a .proto file to its compressed FileDescriptorProto.
-func RegisterFile(filename string, fileDescriptor []byte) {
- protoFiles[filename] = fileDescriptor
-}
-
-// FileDescriptor returns the compressed FileDescriptorProto for a .proto file.
-func FileDescriptor(filename string) []byte { return protoFiles[filename] }
diff --git a/vendor/github.com/golang/protobuf/proto/table_marshal.go b/vendor/github.com/golang/protobuf/proto/table_marshal.go
deleted file mode 100644
index b16794496f5f1d4b0448489e7259f1d103681b9c..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/table_marshal.go
+++ /dev/null
@@ -1,2767 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
- "errors"
- "fmt"
- "math"
- "reflect"
- "sort"
- "strconv"
- "strings"
- "sync"
- "sync/atomic"
- "unicode/utf8"
-)
-
-// a sizer takes a pointer to a field and the size of its tag, computes the size of
-// the encoded data.
-type sizer func(pointer, int) int
-
-// a marshaler takes a byte slice, a pointer to a field, and its tag (in wire format),
-// marshals the field to the end of the slice, returns the slice and error (if any).
-type marshaler func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error)
-
-// marshalInfo is the information used for marshaling a message.
-type marshalInfo struct {
- typ reflect.Type
- fields []*marshalFieldInfo
- unrecognized field // offset of XXX_unrecognized
- extensions field // offset of XXX_InternalExtensions
- v1extensions field // offset of XXX_extensions
- sizecache field // offset of XXX_sizecache
- initialized int32 // 0 -- only typ is set, 1 -- fully initialized
- messageset bool // uses message set wire format
- hasmarshaler bool // has custom marshaler
- sync.RWMutex // protect extElems map, also for initialization
- extElems map[int32]*marshalElemInfo // info of extension elements
-}
-
-// marshalFieldInfo is the information used for marshaling a field of a message.
-type marshalFieldInfo struct {
- field field
- wiretag uint64 // tag in wire format
- tagsize int // size of tag in wire format
- sizer sizer
- marshaler marshaler
- isPointer bool
- required bool // field is required
- name string // name of the field, for error reporting
- oneofElems map[reflect.Type]*marshalElemInfo // info of oneof elements
-}
-
-// marshalElemInfo is the information used for marshaling an extension or oneof element.
-type marshalElemInfo struct {
- wiretag uint64 // tag in wire format
- tagsize int // size of tag in wire format
- sizer sizer
- marshaler marshaler
- isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only)
-}
-
-var (
- marshalInfoMap = map[reflect.Type]*marshalInfo{}
- marshalInfoLock sync.Mutex
-)
-
-// getMarshalInfo returns the information to marshal a given type of message.
-// The info it returns may not necessarily initialized.
-// t is the type of the message (NOT the pointer to it).
-func getMarshalInfo(t reflect.Type) *marshalInfo {
- marshalInfoLock.Lock()
- u, ok := marshalInfoMap[t]
- if !ok {
- u = &marshalInfo{typ: t}
- marshalInfoMap[t] = u
- }
- marshalInfoLock.Unlock()
- return u
-}
-
-// Size is the entry point from generated code,
-// and should be ONLY called by generated code.
-// It computes the size of encoded data of msg.
-// a is a pointer to a place to store cached marshal info.
-func (a *InternalMessageInfo) Size(msg Message) int {
- u := getMessageMarshalInfo(msg, a)
- ptr := toPointer(&msg)
- if ptr.isNil() {
- // We get here if msg is a typed nil ((*SomeMessage)(nil)),
- // so it satisfies the interface, and msg == nil wouldn't
- // catch it. We don't want crash in this case.
- return 0
- }
- return u.size(ptr)
-}
-
-// Marshal is the entry point from generated code,
-// and should be ONLY called by generated code.
-// It marshals msg to the end of b.
-// a is a pointer to a place to store cached marshal info.
-func (a *InternalMessageInfo) Marshal(b []byte, msg Message, deterministic bool) ([]byte, error) {
- u := getMessageMarshalInfo(msg, a)
- ptr := toPointer(&msg)
- if ptr.isNil() {
- // We get here if msg is a typed nil ((*SomeMessage)(nil)),
- // so it satisfies the interface, and msg == nil wouldn't
- // catch it. We don't want crash in this case.
- return b, ErrNil
- }
- return u.marshal(b, ptr, deterministic)
-}
-
-func getMessageMarshalInfo(msg interface{}, a *InternalMessageInfo) *marshalInfo {
- // u := a.marshal, but atomically.
- // We use an atomic here to ensure memory consistency.
- u := atomicLoadMarshalInfo(&a.marshal)
- if u == nil {
- // Get marshal information from type of message.
- t := reflect.ValueOf(msg).Type()
- if t.Kind() != reflect.Ptr {
- panic(fmt.Sprintf("cannot handle non-pointer message type %v", t))
- }
- u = getMarshalInfo(t.Elem())
- // Store it in the cache for later users.
- // a.marshal = u, but atomically.
- atomicStoreMarshalInfo(&a.marshal, u)
- }
- return u
-}
-
-// size is the main function to compute the size of the encoded data of a message.
-// ptr is the pointer to the message.
-func (u *marshalInfo) size(ptr pointer) int {
- if atomic.LoadInt32(&u.initialized) == 0 {
- u.computeMarshalInfo()
- }
-
- // If the message can marshal itself, let it do it, for compatibility.
- // NOTE: This is not efficient.
- if u.hasmarshaler {
- m := ptr.asPointerTo(u.typ).Interface().(Marshaler)
- b, _ := m.Marshal()
- return len(b)
- }
-
- n := 0
- for _, f := range u.fields {
- if f.isPointer && ptr.offset(f.field).getPointer().isNil() {
- // nil pointer always marshals to nothing
- continue
- }
- n += f.sizer(ptr.offset(f.field), f.tagsize)
- }
- if u.extensions.IsValid() {
- e := ptr.offset(u.extensions).toExtensions()
- if u.messageset {
- n += u.sizeMessageSet(e)
- } else {
- n += u.sizeExtensions(e)
- }
- }
- if u.v1extensions.IsValid() {
- m := *ptr.offset(u.v1extensions).toOldExtensions()
- n += u.sizeV1Extensions(m)
- }
- if u.unrecognized.IsValid() {
- s := *ptr.offset(u.unrecognized).toBytes()
- n += len(s)
- }
- // cache the result for use in marshal
- if u.sizecache.IsValid() {
- atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n))
- }
- return n
-}
-
-// cachedsize gets the size from cache. If there is no cache (i.e. message is not generated),
-// fall back to compute the size.
-func (u *marshalInfo) cachedsize(ptr pointer) int {
- if u.sizecache.IsValid() {
- return int(atomic.LoadInt32(ptr.offset(u.sizecache).toInt32()))
- }
- return u.size(ptr)
-}
-
-// marshal is the main function to marshal a message. It takes a byte slice and appends
-// the encoded data to the end of the slice, returns the slice and error (if any).
-// ptr is the pointer to the message.
-// If deterministic is true, map is marshaled in deterministic order.
-func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte, error) {
- if atomic.LoadInt32(&u.initialized) == 0 {
- u.computeMarshalInfo()
- }
-
- // If the message can marshal itself, let it do it, for compatibility.
- // NOTE: This is not efficient.
- if u.hasmarshaler {
- m := ptr.asPointerTo(u.typ).Interface().(Marshaler)
- b1, err := m.Marshal()
- b = append(b, b1...)
- return b, err
- }
-
- var err, errLater error
- // The old marshaler encodes extensions at beginning.
- if u.extensions.IsValid() {
- e := ptr.offset(u.extensions).toExtensions()
- if u.messageset {
- b, err = u.appendMessageSet(b, e, deterministic)
- } else {
- b, err = u.appendExtensions(b, e, deterministic)
- }
- if err != nil {
- return b, err
- }
- }
- if u.v1extensions.IsValid() {
- m := *ptr.offset(u.v1extensions).toOldExtensions()
- b, err = u.appendV1Extensions(b, m, deterministic)
- if err != nil {
- return b, err
- }
- }
- for _, f := range u.fields {
- if f.required {
- if ptr.offset(f.field).getPointer().isNil() {
- // Required field is not set.
- // We record the error but keep going, to give a complete marshaling.
- if errLater == nil {
- errLater = &RequiredNotSetError{f.name}
- }
- continue
- }
- }
- if f.isPointer && ptr.offset(f.field).getPointer().isNil() {
- // nil pointer always marshals to nothing
- continue
- }
- b, err = f.marshaler(b, ptr.offset(f.field), f.wiretag, deterministic)
- if err != nil {
- if err1, ok := err.(*RequiredNotSetError); ok {
- // Required field in submessage is not set.
- // We record the error but keep going, to give a complete marshaling.
- if errLater == nil {
- errLater = &RequiredNotSetError{f.name + "." + err1.field}
- }
- continue
- }
- if err == errRepeatedHasNil {
- err = errors.New("proto: repeated field " + f.name + " has nil element")
- }
- if err == errInvalidUTF8 {
- if errLater == nil {
- fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name
- errLater = &invalidUTF8Error{fullName}
- }
- continue
- }
- return b, err
- }
- }
- if u.unrecognized.IsValid() {
- s := *ptr.offset(u.unrecognized).toBytes()
- b = append(b, s...)
- }
- return b, errLater
-}
-
-// computeMarshalInfo initializes the marshal info.
-func (u *marshalInfo) computeMarshalInfo() {
- u.Lock()
- defer u.Unlock()
- if u.initialized != 0 { // non-atomic read is ok as it is protected by the lock
- return
- }
-
- t := u.typ
- u.unrecognized = invalidField
- u.extensions = invalidField
- u.v1extensions = invalidField
- u.sizecache = invalidField
-
- // If the message can marshal itself, let it do it, for compatibility.
- // NOTE: This is not efficient.
- if reflect.PtrTo(t).Implements(marshalerType) {
- u.hasmarshaler = true
- atomic.StoreInt32(&u.initialized, 1)
- return
- }
-
- // get oneof implementers
- var oneofImplementers []interface{}
- if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok {
- _, _, _, oneofImplementers = m.XXX_OneofFuncs()
- }
-
- n := t.NumField()
-
- // deal with XXX fields first
- for i := 0; i < t.NumField(); i++ {
- f := t.Field(i)
- if !strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- switch f.Name {
- case "XXX_sizecache":
- u.sizecache = toField(&f)
- case "XXX_unrecognized":
- u.unrecognized = toField(&f)
- case "XXX_InternalExtensions":
- u.extensions = toField(&f)
- u.messageset = f.Tag.Get("protobuf_messageset") == "1"
- case "XXX_extensions":
- u.v1extensions = toField(&f)
- case "XXX_NoUnkeyedLiteral":
- // nothing to do
- default:
- panic("unknown XXX field: " + f.Name)
- }
- n--
- }
-
- // normal fields
- fields := make([]marshalFieldInfo, n) // batch allocation
- u.fields = make([]*marshalFieldInfo, 0, n)
- for i, j := 0, 0; i < t.NumField(); i++ {
- f := t.Field(i)
-
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
- field := &fields[j]
- j++
- field.name = f.Name
- u.fields = append(u.fields, field)
- if f.Tag.Get("protobuf_oneof") != "" {
- field.computeOneofFieldInfo(&f, oneofImplementers)
- continue
- }
- if f.Tag.Get("protobuf") == "" {
- // field has no tag (not in generated message), ignore it
- u.fields = u.fields[:len(u.fields)-1]
- j--
- continue
- }
- field.computeMarshalFieldInfo(&f)
- }
-
- // fields are marshaled in tag order on the wire.
- sort.Sort(byTag(u.fields))
-
- atomic.StoreInt32(&u.initialized, 1)
-}
-
-// helper for sorting fields by tag
-type byTag []*marshalFieldInfo
-
-func (a byTag) Len() int { return len(a) }
-func (a byTag) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-func (a byTag) Less(i, j int) bool { return a[i].wiretag < a[j].wiretag }
-
-// getExtElemInfo returns the information to marshal an extension element.
-// The info it returns is initialized.
-func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo {
- // get from cache first
- u.RLock()
- e, ok := u.extElems[desc.Field]
- u.RUnlock()
- if ok {
- return e
- }
-
- t := reflect.TypeOf(desc.ExtensionType) // pointer or slice to basic type or struct
- tags := strings.Split(desc.Tag, ",")
- tag, err := strconv.Atoi(tags[1])
- if err != nil {
- panic("tag is not an integer")
- }
- wt := wiretype(tags[0])
- sizer, marshaler := typeMarshaler(t, tags, false, false)
- e = &marshalElemInfo{
- wiretag: uint64(tag)<<3 | wt,
- tagsize: SizeVarint(uint64(tag) << 3),
- sizer: sizer,
- marshaler: marshaler,
- isptr: t.Kind() == reflect.Ptr,
- }
-
- // update cache
- u.Lock()
- if u.extElems == nil {
- u.extElems = make(map[int32]*marshalElemInfo)
- }
- u.extElems[desc.Field] = e
- u.Unlock()
- return e
-}
-
-// computeMarshalFieldInfo fills up the information to marshal a field.
-func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) {
- // parse protobuf tag of the field.
- // tag has format of "bytes,49,opt,name=foo,def=hello!"
- tags := strings.Split(f.Tag.Get("protobuf"), ",")
- if tags[0] == "" {
- return
- }
- tag, err := strconv.Atoi(tags[1])
- if err != nil {
- panic("tag is not an integer")
- }
- wt := wiretype(tags[0])
- if tags[2] == "req" {
- fi.required = true
- }
- fi.setTag(f, tag, wt)
- fi.setMarshaler(f, tags)
-}
-
-func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) {
- fi.field = toField(f)
- fi.wiretag = 1<<31 - 1 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire.
- fi.isPointer = true
- fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f)
- fi.oneofElems = make(map[reflect.Type]*marshalElemInfo)
-
- ityp := f.Type // interface type
- for _, o := range oneofImplementers {
- t := reflect.TypeOf(o)
- if !t.Implements(ityp) {
- continue
- }
- sf := t.Elem().Field(0) // oneof implementer is a struct with a single field
- tags := strings.Split(sf.Tag.Get("protobuf"), ",")
- tag, err := strconv.Atoi(tags[1])
- if err != nil {
- panic("tag is not an integer")
- }
- wt := wiretype(tags[0])
- sizer, marshaler := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value
- fi.oneofElems[t.Elem()] = &marshalElemInfo{
- wiretag: uint64(tag)<<3 | wt,
- tagsize: SizeVarint(uint64(tag) << 3),
- sizer: sizer,
- marshaler: marshaler,
- }
- }
-}
-
-type oneofMessage interface {
- XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{})
-}
-
-// wiretype returns the wire encoding of the type.
-func wiretype(encoding string) uint64 {
- switch encoding {
- case "fixed32":
- return WireFixed32
- case "fixed64":
- return WireFixed64
- case "varint", "zigzag32", "zigzag64":
- return WireVarint
- case "bytes":
- return WireBytes
- case "group":
- return WireStartGroup
- }
- panic("unknown wire type " + encoding)
-}
-
-// setTag fills up the tag (in wire format) and its size in the info of a field.
-func (fi *marshalFieldInfo) setTag(f *reflect.StructField, tag int, wt uint64) {
- fi.field = toField(f)
- fi.wiretag = uint64(tag)<<3 | wt
- fi.tagsize = SizeVarint(uint64(tag) << 3)
-}
-
-// setMarshaler fills up the sizer and marshaler in the info of a field.
-func (fi *marshalFieldInfo) setMarshaler(f *reflect.StructField, tags []string) {
- switch f.Type.Kind() {
- case reflect.Map:
- // map field
- fi.isPointer = true
- fi.sizer, fi.marshaler = makeMapMarshaler(f)
- return
- case reflect.Ptr, reflect.Slice:
- fi.isPointer = true
- }
- fi.sizer, fi.marshaler = typeMarshaler(f.Type, tags, true, false)
-}
-
-// typeMarshaler returns the sizer and marshaler of a given field.
-// t is the type of the field.
-// tags is the generated "protobuf" tag of the field.
-// If nozero is true, zero value is not marshaled to the wire.
-// If oneof is true, it is a oneof field.
-func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, marshaler) {
- encoding := tags[0]
-
- pointer := false
- slice := false
- if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 {
- slice = true
- t = t.Elem()
- }
- if t.Kind() == reflect.Ptr {
- pointer = true
- t = t.Elem()
- }
-
- packed := false
- proto3 := false
- validateUTF8 := true
- for i := 2; i < len(tags); i++ {
- if tags[i] == "packed" {
- packed = true
- }
- if tags[i] == "proto3" {
- proto3 = true
- }
- }
- validateUTF8 = validateUTF8 && proto3
-
- switch t.Kind() {
- case reflect.Bool:
- if pointer {
- return sizeBoolPtr, appendBoolPtr
- }
- if slice {
- if packed {
- return sizeBoolPackedSlice, appendBoolPackedSlice
- }
- return sizeBoolSlice, appendBoolSlice
- }
- if nozero {
- return sizeBoolValueNoZero, appendBoolValueNoZero
- }
- return sizeBoolValue, appendBoolValue
- case reflect.Uint32:
- switch encoding {
- case "fixed32":
- if pointer {
- return sizeFixed32Ptr, appendFixed32Ptr
- }
- if slice {
- if packed {
- return sizeFixed32PackedSlice, appendFixed32PackedSlice
- }
- return sizeFixed32Slice, appendFixed32Slice
- }
- if nozero {
- return sizeFixed32ValueNoZero, appendFixed32ValueNoZero
- }
- return sizeFixed32Value, appendFixed32Value
- case "varint":
- if pointer {
- return sizeVarint32Ptr, appendVarint32Ptr
- }
- if slice {
- if packed {
- return sizeVarint32PackedSlice, appendVarint32PackedSlice
- }
- return sizeVarint32Slice, appendVarint32Slice
- }
- if nozero {
- return sizeVarint32ValueNoZero, appendVarint32ValueNoZero
- }
- return sizeVarint32Value, appendVarint32Value
- }
- case reflect.Int32:
- switch encoding {
- case "fixed32":
- if pointer {
- return sizeFixedS32Ptr, appendFixedS32Ptr
- }
- if slice {
- if packed {
- return sizeFixedS32PackedSlice, appendFixedS32PackedSlice
- }
- return sizeFixedS32Slice, appendFixedS32Slice
- }
- if nozero {
- return sizeFixedS32ValueNoZero, appendFixedS32ValueNoZero
- }
- return sizeFixedS32Value, appendFixedS32Value
- case "varint":
- if pointer {
- return sizeVarintS32Ptr, appendVarintS32Ptr
- }
- if slice {
- if packed {
- return sizeVarintS32PackedSlice, appendVarintS32PackedSlice
- }
- return sizeVarintS32Slice, appendVarintS32Slice
- }
- if nozero {
- return sizeVarintS32ValueNoZero, appendVarintS32ValueNoZero
- }
- return sizeVarintS32Value, appendVarintS32Value
- case "zigzag32":
- if pointer {
- return sizeZigzag32Ptr, appendZigzag32Ptr
- }
- if slice {
- if packed {
- return sizeZigzag32PackedSlice, appendZigzag32PackedSlice
- }
- return sizeZigzag32Slice, appendZigzag32Slice
- }
- if nozero {
- return sizeZigzag32ValueNoZero, appendZigzag32ValueNoZero
- }
- return sizeZigzag32Value, appendZigzag32Value
- }
- case reflect.Uint64:
- switch encoding {
- case "fixed64":
- if pointer {
- return sizeFixed64Ptr, appendFixed64Ptr
- }
- if slice {
- if packed {
- return sizeFixed64PackedSlice, appendFixed64PackedSlice
- }
- return sizeFixed64Slice, appendFixed64Slice
- }
- if nozero {
- return sizeFixed64ValueNoZero, appendFixed64ValueNoZero
- }
- return sizeFixed64Value, appendFixed64Value
- case "varint":
- if pointer {
- return sizeVarint64Ptr, appendVarint64Ptr
- }
- if slice {
- if packed {
- return sizeVarint64PackedSlice, appendVarint64PackedSlice
- }
- return sizeVarint64Slice, appendVarint64Slice
- }
- if nozero {
- return sizeVarint64ValueNoZero, appendVarint64ValueNoZero
- }
- return sizeVarint64Value, appendVarint64Value
- }
- case reflect.Int64:
- switch encoding {
- case "fixed64":
- if pointer {
- return sizeFixedS64Ptr, appendFixedS64Ptr
- }
- if slice {
- if packed {
- return sizeFixedS64PackedSlice, appendFixedS64PackedSlice
- }
- return sizeFixedS64Slice, appendFixedS64Slice
- }
- if nozero {
- return sizeFixedS64ValueNoZero, appendFixedS64ValueNoZero
- }
- return sizeFixedS64Value, appendFixedS64Value
- case "varint":
- if pointer {
- return sizeVarintS64Ptr, appendVarintS64Ptr
- }
- if slice {
- if packed {
- return sizeVarintS64PackedSlice, appendVarintS64PackedSlice
- }
- return sizeVarintS64Slice, appendVarintS64Slice
- }
- if nozero {
- return sizeVarintS64ValueNoZero, appendVarintS64ValueNoZero
- }
- return sizeVarintS64Value, appendVarintS64Value
- case "zigzag64":
- if pointer {
- return sizeZigzag64Ptr, appendZigzag64Ptr
- }
- if slice {
- if packed {
- return sizeZigzag64PackedSlice, appendZigzag64PackedSlice
- }
- return sizeZigzag64Slice, appendZigzag64Slice
- }
- if nozero {
- return sizeZigzag64ValueNoZero, appendZigzag64ValueNoZero
- }
- return sizeZigzag64Value, appendZigzag64Value
- }
- case reflect.Float32:
- if pointer {
- return sizeFloat32Ptr, appendFloat32Ptr
- }
- if slice {
- if packed {
- return sizeFloat32PackedSlice, appendFloat32PackedSlice
- }
- return sizeFloat32Slice, appendFloat32Slice
- }
- if nozero {
- return sizeFloat32ValueNoZero, appendFloat32ValueNoZero
- }
- return sizeFloat32Value, appendFloat32Value
- case reflect.Float64:
- if pointer {
- return sizeFloat64Ptr, appendFloat64Ptr
- }
- if slice {
- if packed {
- return sizeFloat64PackedSlice, appendFloat64PackedSlice
- }
- return sizeFloat64Slice, appendFloat64Slice
- }
- if nozero {
- return sizeFloat64ValueNoZero, appendFloat64ValueNoZero
- }
- return sizeFloat64Value, appendFloat64Value
- case reflect.String:
- if validateUTF8 {
- if pointer {
- return sizeStringPtr, appendUTF8StringPtr
- }
- if slice {
- return sizeStringSlice, appendUTF8StringSlice
- }
- if nozero {
- return sizeStringValueNoZero, appendUTF8StringValueNoZero
- }
- return sizeStringValue, appendUTF8StringValue
- }
- if pointer {
- return sizeStringPtr, appendStringPtr
- }
- if slice {
- return sizeStringSlice, appendStringSlice
- }
- if nozero {
- return sizeStringValueNoZero, appendStringValueNoZero
- }
- return sizeStringValue, appendStringValue
- case reflect.Slice:
- if slice {
- return sizeBytesSlice, appendBytesSlice
- }
- if oneof {
- // Oneof bytes field may also have "proto3" tag.
- // We want to marshal it as a oneof field. Do this
- // check before the proto3 check.
- return sizeBytesOneof, appendBytesOneof
- }
- if proto3 {
- return sizeBytes3, appendBytes3
- }
- return sizeBytes, appendBytes
- case reflect.Struct:
- switch encoding {
- case "group":
- if slice {
- return makeGroupSliceMarshaler(getMarshalInfo(t))
- }
- return makeGroupMarshaler(getMarshalInfo(t))
- case "bytes":
- if slice {
- return makeMessageSliceMarshaler(getMarshalInfo(t))
- }
- return makeMessageMarshaler(getMarshalInfo(t))
- }
- }
- panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding))
-}
-
-// Below are functions to size/marshal a specific type of a field.
-// They are stored in the field's info, and called by function pointers.
-// They have type sizer or marshaler.
-
-func sizeFixed32Value(_ pointer, tagsize int) int {
- return 4 + tagsize
-}
-func sizeFixed32ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toUint32()
- if v == 0 {
- return 0
- }
- return 4 + tagsize
-}
-func sizeFixed32Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toUint32Ptr()
- if p == nil {
- return 0
- }
- return 4 + tagsize
-}
-func sizeFixed32Slice(ptr pointer, tagsize int) int {
- s := *ptr.toUint32Slice()
- return (4 + tagsize) * len(s)
-}
-func sizeFixed32PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toUint32Slice()
- if len(s) == 0 {
- return 0
- }
- return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize
-}
-func sizeFixedS32Value(_ pointer, tagsize int) int {
- return 4 + tagsize
-}
-func sizeFixedS32ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toInt32()
- if v == 0 {
- return 0
- }
- return 4 + tagsize
-}
-func sizeFixedS32Ptr(ptr pointer, tagsize int) int {
- p := ptr.getInt32Ptr()
- if p == nil {
- return 0
- }
- return 4 + tagsize
-}
-func sizeFixedS32Slice(ptr pointer, tagsize int) int {
- s := ptr.getInt32Slice()
- return (4 + tagsize) * len(s)
-}
-func sizeFixedS32PackedSlice(ptr pointer, tagsize int) int {
- s := ptr.getInt32Slice()
- if len(s) == 0 {
- return 0
- }
- return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize
-}
-func sizeFloat32Value(_ pointer, tagsize int) int {
- return 4 + tagsize
-}
-func sizeFloat32ValueNoZero(ptr pointer, tagsize int) int {
- v := math.Float32bits(*ptr.toFloat32())
- if v == 0 {
- return 0
- }
- return 4 + tagsize
-}
-func sizeFloat32Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toFloat32Ptr()
- if p == nil {
- return 0
- }
- return 4 + tagsize
-}
-func sizeFloat32Slice(ptr pointer, tagsize int) int {
- s := *ptr.toFloat32Slice()
- return (4 + tagsize) * len(s)
-}
-func sizeFloat32PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toFloat32Slice()
- if len(s) == 0 {
- return 0
- }
- return 4*len(s) + SizeVarint(uint64(4*len(s))) + tagsize
-}
-func sizeFixed64Value(_ pointer, tagsize int) int {
- return 8 + tagsize
-}
-func sizeFixed64ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toUint64()
- if v == 0 {
- return 0
- }
- return 8 + tagsize
-}
-func sizeFixed64Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toUint64Ptr()
- if p == nil {
- return 0
- }
- return 8 + tagsize
-}
-func sizeFixed64Slice(ptr pointer, tagsize int) int {
- s := *ptr.toUint64Slice()
- return (8 + tagsize) * len(s)
-}
-func sizeFixed64PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toUint64Slice()
- if len(s) == 0 {
- return 0
- }
- return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize
-}
-func sizeFixedS64Value(_ pointer, tagsize int) int {
- return 8 + tagsize
-}
-func sizeFixedS64ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toInt64()
- if v == 0 {
- return 0
- }
- return 8 + tagsize
-}
-func sizeFixedS64Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toInt64Ptr()
- if p == nil {
- return 0
- }
- return 8 + tagsize
-}
-func sizeFixedS64Slice(ptr pointer, tagsize int) int {
- s := *ptr.toInt64Slice()
- return (8 + tagsize) * len(s)
-}
-func sizeFixedS64PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toInt64Slice()
- if len(s) == 0 {
- return 0
- }
- return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize
-}
-func sizeFloat64Value(_ pointer, tagsize int) int {
- return 8 + tagsize
-}
-func sizeFloat64ValueNoZero(ptr pointer, tagsize int) int {
- v := math.Float64bits(*ptr.toFloat64())
- if v == 0 {
- return 0
- }
- return 8 + tagsize
-}
-func sizeFloat64Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toFloat64Ptr()
- if p == nil {
- return 0
- }
- return 8 + tagsize
-}
-func sizeFloat64Slice(ptr pointer, tagsize int) int {
- s := *ptr.toFloat64Slice()
- return (8 + tagsize) * len(s)
-}
-func sizeFloat64PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toFloat64Slice()
- if len(s) == 0 {
- return 0
- }
- return 8*len(s) + SizeVarint(uint64(8*len(s))) + tagsize
-}
-func sizeVarint32Value(ptr pointer, tagsize int) int {
- v := *ptr.toUint32()
- return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarint32ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toUint32()
- if v == 0 {
- return 0
- }
- return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarint32Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toUint32Ptr()
- if p == nil {
- return 0
- }
- return SizeVarint(uint64(*p)) + tagsize
-}
-func sizeVarint32Slice(ptr pointer, tagsize int) int {
- s := *ptr.toUint32Slice()
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v)) + tagsize
- }
- return n
-}
-func sizeVarint32PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toUint32Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v))
- }
- return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeVarintS32Value(ptr pointer, tagsize int) int {
- v := *ptr.toInt32()
- return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarintS32ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toInt32()
- if v == 0 {
- return 0
- }
- return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarintS32Ptr(ptr pointer, tagsize int) int {
- p := ptr.getInt32Ptr()
- if p == nil {
- return 0
- }
- return SizeVarint(uint64(*p)) + tagsize
-}
-func sizeVarintS32Slice(ptr pointer, tagsize int) int {
- s := ptr.getInt32Slice()
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v)) + tagsize
- }
- return n
-}
-func sizeVarintS32PackedSlice(ptr pointer, tagsize int) int {
- s := ptr.getInt32Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v))
- }
- return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeVarint64Value(ptr pointer, tagsize int) int {
- v := *ptr.toUint64()
- return SizeVarint(v) + tagsize
-}
-func sizeVarint64ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toUint64()
- if v == 0 {
- return 0
- }
- return SizeVarint(v) + tagsize
-}
-func sizeVarint64Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toUint64Ptr()
- if p == nil {
- return 0
- }
- return SizeVarint(*p) + tagsize
-}
-func sizeVarint64Slice(ptr pointer, tagsize int) int {
- s := *ptr.toUint64Slice()
- n := 0
- for _, v := range s {
- n += SizeVarint(v) + tagsize
- }
- return n
-}
-func sizeVarint64PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toUint64Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += SizeVarint(v)
- }
- return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeVarintS64Value(ptr pointer, tagsize int) int {
- v := *ptr.toInt64()
- return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarintS64ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toInt64()
- if v == 0 {
- return 0
- }
- return SizeVarint(uint64(v)) + tagsize
-}
-func sizeVarintS64Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toInt64Ptr()
- if p == nil {
- return 0
- }
- return SizeVarint(uint64(*p)) + tagsize
-}
-func sizeVarintS64Slice(ptr pointer, tagsize int) int {
- s := *ptr.toInt64Slice()
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v)) + tagsize
- }
- return n
-}
-func sizeVarintS64PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toInt64Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v))
- }
- return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeZigzag32Value(ptr pointer, tagsize int) int {
- v := *ptr.toInt32()
- return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize
-}
-func sizeZigzag32ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toInt32()
- if v == 0 {
- return 0
- }
- return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize
-}
-func sizeZigzag32Ptr(ptr pointer, tagsize int) int {
- p := ptr.getInt32Ptr()
- if p == nil {
- return 0
- }
- v := *p
- return SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize
-}
-func sizeZigzag32Slice(ptr pointer, tagsize int) int {
- s := ptr.getInt32Slice()
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64((uint32(v)<<1)^uint32((int32(v)>>31)))) + tagsize
- }
- return n
-}
-func sizeZigzag32PackedSlice(ptr pointer, tagsize int) int {
- s := ptr.getInt32Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31))))
- }
- return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeZigzag64Value(ptr pointer, tagsize int) int {
- v := *ptr.toInt64()
- return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize
-}
-func sizeZigzag64ValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toInt64()
- if v == 0 {
- return 0
- }
- return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize
-}
-func sizeZigzag64Ptr(ptr pointer, tagsize int) int {
- p := *ptr.toInt64Ptr()
- if p == nil {
- return 0
- }
- v := *p
- return SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize
-}
-func sizeZigzag64Slice(ptr pointer, tagsize int) int {
- s := *ptr.toInt64Slice()
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v<<1)^uint64((int64(v)>>63))) + tagsize
- }
- return n
-}
-func sizeZigzag64PackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toInt64Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63)))
- }
- return n + SizeVarint(uint64(n)) + tagsize
-}
-func sizeBoolValue(_ pointer, tagsize int) int {
- return 1 + tagsize
-}
-func sizeBoolValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toBool()
- if !v {
- return 0
- }
- return 1 + tagsize
-}
-func sizeBoolPtr(ptr pointer, tagsize int) int {
- p := *ptr.toBoolPtr()
- if p == nil {
- return 0
- }
- return 1 + tagsize
-}
-func sizeBoolSlice(ptr pointer, tagsize int) int {
- s := *ptr.toBoolSlice()
- return (1 + tagsize) * len(s)
-}
-func sizeBoolPackedSlice(ptr pointer, tagsize int) int {
- s := *ptr.toBoolSlice()
- if len(s) == 0 {
- return 0
- }
- return len(s) + SizeVarint(uint64(len(s))) + tagsize
-}
-func sizeStringValue(ptr pointer, tagsize int) int {
- v := *ptr.toString()
- return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeStringValueNoZero(ptr pointer, tagsize int) int {
- v := *ptr.toString()
- if v == "" {
- return 0
- }
- return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeStringPtr(ptr pointer, tagsize int) int {
- p := *ptr.toStringPtr()
- if p == nil {
- return 0
- }
- v := *p
- return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeStringSlice(ptr pointer, tagsize int) int {
- s := *ptr.toStringSlice()
- n := 0
- for _, v := range s {
- n += len(v) + SizeVarint(uint64(len(v))) + tagsize
- }
- return n
-}
-func sizeBytes(ptr pointer, tagsize int) int {
- v := *ptr.toBytes()
- if v == nil {
- return 0
- }
- return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeBytes3(ptr pointer, tagsize int) int {
- v := *ptr.toBytes()
- if len(v) == 0 {
- return 0
- }
- return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeBytesOneof(ptr pointer, tagsize int) int {
- v := *ptr.toBytes()
- return len(v) + SizeVarint(uint64(len(v))) + tagsize
-}
-func sizeBytesSlice(ptr pointer, tagsize int) int {
- s := *ptr.toBytesSlice()
- n := 0
- for _, v := range s {
- n += len(v) + SizeVarint(uint64(len(v))) + tagsize
- }
- return n
-}
-
-// appendFixed32 appends an encoded fixed32 to b.
-func appendFixed32(b []byte, v uint32) []byte {
- b = append(b,
- byte(v),
- byte(v>>8),
- byte(v>>16),
- byte(v>>24))
- return b
-}
-
-// appendFixed64 appends an encoded fixed64 to b.
-func appendFixed64(b []byte, v uint64) []byte {
- b = append(b,
- byte(v),
- byte(v>>8),
- byte(v>>16),
- byte(v>>24),
- byte(v>>32),
- byte(v>>40),
- byte(v>>48),
- byte(v>>56))
- return b
-}
-
-// appendVarint appends an encoded varint to b.
-func appendVarint(b []byte, v uint64) []byte {
- // TODO: make 1-byte (maybe 2-byte) case inline-able, once we
- // have non-leaf inliner.
- switch {
- case v < 1<<7:
- b = append(b, byte(v))
- case v < 1<<14:
- b = append(b,
- byte(v&0x7f|0x80),
- byte(v>>7))
- case v < 1<<21:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte(v>>14))
- case v < 1<<28:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte(v>>21))
- case v < 1<<35:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte(v>>28))
- case v < 1<<42:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte(v>>35))
- case v < 1<<49:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte((v>>35)&0x7f|0x80),
- byte(v>>42))
- case v < 1<<56:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte((v>>35)&0x7f|0x80),
- byte((v>>42)&0x7f|0x80),
- byte(v>>49))
- case v < 1<<63:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte((v>>35)&0x7f|0x80),
- byte((v>>42)&0x7f|0x80),
- byte((v>>49)&0x7f|0x80),
- byte(v>>56))
- default:
- b = append(b,
- byte(v&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte((v>>35)&0x7f|0x80),
- byte((v>>42)&0x7f|0x80),
- byte((v>>49)&0x7f|0x80),
- byte((v>>56)&0x7f|0x80),
- 1)
- }
- return b
-}
-
-func appendFixed32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint32()
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, v)
- return b, nil
-}
-func appendFixed32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint32()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, v)
- return b, nil
-}
-func appendFixed32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toUint32Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, *p)
- return b, nil
-}
-func appendFixed32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint32Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, v)
- }
- return b, nil
-}
-func appendFixed32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(4*len(s)))
- for _, v := range s {
- b = appendFixed32(b, v)
- }
- return b, nil
-}
-func appendFixedS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt32()
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, uint32(v))
- return b, nil
-}
-func appendFixedS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt32()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, uint32(v))
- return b, nil
-}
-func appendFixedS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := ptr.getInt32Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, uint32(*p))
- return b, nil
-}
-func appendFixedS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := ptr.getInt32Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, uint32(v))
- }
- return b, nil
-}
-func appendFixedS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := ptr.getInt32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(4*len(s)))
- for _, v := range s {
- b = appendFixed32(b, uint32(v))
- }
- return b, nil
-}
-func appendFloat32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := math.Float32bits(*ptr.toFloat32())
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, v)
- return b, nil
-}
-func appendFloat32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := math.Float32bits(*ptr.toFloat32())
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, v)
- return b, nil
-}
-func appendFloat32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toFloat32Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, math.Float32bits(*p))
- return b, nil
-}
-func appendFloat32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toFloat32Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendFixed32(b, math.Float32bits(v))
- }
- return b, nil
-}
-func appendFloat32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toFloat32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(4*len(s)))
- for _, v := range s {
- b = appendFixed32(b, math.Float32bits(v))
- }
- return b, nil
-}
-func appendFixed64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint64()
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, v)
- return b, nil
-}
-func appendFixed64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint64()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, v)
- return b, nil
-}
-func appendFixed64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toUint64Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, *p)
- return b, nil
-}
-func appendFixed64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint64Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, v)
- }
- return b, nil
-}
-func appendFixed64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(8*len(s)))
- for _, v := range s {
- b = appendFixed64(b, v)
- }
- return b, nil
-}
-func appendFixedS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt64()
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, uint64(v))
- return b, nil
-}
-func appendFixedS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt64()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, uint64(v))
- return b, nil
-}
-func appendFixedS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toInt64Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, uint64(*p))
- return b, nil
-}
-func appendFixedS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toInt64Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, uint64(v))
- }
- return b, nil
-}
-func appendFixedS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toInt64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(8*len(s)))
- for _, v := range s {
- b = appendFixed64(b, uint64(v))
- }
- return b, nil
-}
-func appendFloat64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := math.Float64bits(*ptr.toFloat64())
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, v)
- return b, nil
-}
-func appendFloat64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := math.Float64bits(*ptr.toFloat64())
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, v)
- return b, nil
-}
-func appendFloat64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toFloat64Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, math.Float64bits(*p))
- return b, nil
-}
-func appendFloat64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toFloat64Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendFixed64(b, math.Float64bits(v))
- }
- return b, nil
-}
-func appendFloat64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toFloat64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(8*len(s)))
- for _, v := range s {
- b = appendFixed64(b, math.Float64bits(v))
- }
- return b, nil
-}
-func appendVarint32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint32()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- return b, nil
-}
-func appendVarint32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint32()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- return b, nil
-}
-func appendVarint32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toUint32Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(*p))
- return b, nil
-}
-func appendVarint32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint32Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- }
- return b, nil
-}
-func appendVarint32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- // compute size
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v))
- }
- b = appendVarint(b, uint64(n))
- for _, v := range s {
- b = appendVarint(b, uint64(v))
- }
- return b, nil
-}
-func appendVarintS32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt32()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- return b, nil
-}
-func appendVarintS32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt32()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- return b, nil
-}
-func appendVarintS32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := ptr.getInt32Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(*p))
- return b, nil
-}
-func appendVarintS32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := ptr.getInt32Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- }
- return b, nil
-}
-func appendVarintS32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := ptr.getInt32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- // compute size
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v))
- }
- b = appendVarint(b, uint64(n))
- for _, v := range s {
- b = appendVarint(b, uint64(v))
- }
- return b, nil
-}
-func appendVarint64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint64()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, v)
- return b, nil
-}
-func appendVarint64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toUint64()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, v)
- return b, nil
-}
-func appendVarint64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toUint64Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, *p)
- return b, nil
-}
-func appendVarint64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint64Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, v)
- }
- return b, nil
-}
-func appendVarint64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toUint64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- // compute size
- n := 0
- for _, v := range s {
- n += SizeVarint(v)
- }
- b = appendVarint(b, uint64(n))
- for _, v := range s {
- b = appendVarint(b, v)
- }
- return b, nil
-}
-func appendVarintS64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt64()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- return b, nil
-}
-func appendVarintS64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt64()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- return b, nil
-}
-func appendVarintS64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toInt64Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(*p))
- return b, nil
-}
-func appendVarintS64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toInt64Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v))
- }
- return b, nil
-}
-func appendVarintS64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toInt64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- // compute size
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v))
- }
- b = appendVarint(b, uint64(n))
- for _, v := range s {
- b = appendVarint(b, uint64(v))
- }
- return b, nil
-}
-func appendZigzag32Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt32()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
- return b, nil
-}
-func appendZigzag32ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt32()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
- return b, nil
-}
-func appendZigzag32Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := ptr.getInt32Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- v := *p
- b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
- return b, nil
-}
-func appendZigzag32Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := ptr.getInt32Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
- }
- return b, nil
-}
-func appendZigzag32PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := ptr.getInt32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- // compute size
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31))))
- }
- b = appendVarint(b, uint64(n))
- for _, v := range s {
- b = appendVarint(b, uint64((uint32(v)<<1)^uint32((int32(v)>>31))))
- }
- return b, nil
-}
-func appendZigzag64Value(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt64()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
- return b, nil
-}
-func appendZigzag64ValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toInt64()
- if v == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
- return b, nil
-}
-func appendZigzag64Ptr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toInt64Ptr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- v := *p
- b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
- return b, nil
-}
-func appendZigzag64Slice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toInt64Slice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
- }
- return b, nil
-}
-func appendZigzag64PackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toInt64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- // compute size
- n := 0
- for _, v := range s {
- n += SizeVarint(uint64(v<<1) ^ uint64((int64(v) >> 63)))
- }
- b = appendVarint(b, uint64(n))
- for _, v := range s {
- b = appendVarint(b, uint64(v<<1)^uint64((int64(v)>>63)))
- }
- return b, nil
-}
-func appendBoolValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toBool()
- b = appendVarint(b, wiretag)
- if v {
- b = append(b, 1)
- } else {
- b = append(b, 0)
- }
- return b, nil
-}
-func appendBoolValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toBool()
- if !v {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = append(b, 1)
- return b, nil
-}
-
-func appendBoolPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toBoolPtr()
- if p == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- if *p {
- b = append(b, 1)
- } else {
- b = append(b, 0)
- }
- return b, nil
-}
-func appendBoolSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toBoolSlice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- if v {
- b = append(b, 1)
- } else {
- b = append(b, 0)
- }
- }
- return b, nil
-}
-func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toBoolSlice()
- if len(s) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag&^7|WireBytes)
- b = appendVarint(b, uint64(len(s)))
- for _, v := range s {
- if v {
- b = append(b, 1)
- } else {
- b = append(b, 0)
- }
- }
- return b, nil
-}
-func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toString()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- return b, nil
-}
-func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toString()
- if v == "" {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- return b, nil
-}
-func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- p := *ptr.toStringPtr()
- if p == nil {
- return b, nil
- }
- v := *p
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- return b, nil
-}
-func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toStringSlice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- }
- return b, nil
-}
-func appendUTF8StringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- var invalidUTF8 bool
- v := *ptr.toString()
- if !utf8.ValidString(v) {
- invalidUTF8 = true
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- if invalidUTF8 {
- return b, errInvalidUTF8
- }
- return b, nil
-}
-func appendUTF8StringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- var invalidUTF8 bool
- v := *ptr.toString()
- if v == "" {
- return b, nil
- }
- if !utf8.ValidString(v) {
- invalidUTF8 = true
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- if invalidUTF8 {
- return b, errInvalidUTF8
- }
- return b, nil
-}
-func appendUTF8StringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- var invalidUTF8 bool
- p := *ptr.toStringPtr()
- if p == nil {
- return b, nil
- }
- v := *p
- if !utf8.ValidString(v) {
- invalidUTF8 = true
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- if invalidUTF8 {
- return b, errInvalidUTF8
- }
- return b, nil
-}
-func appendUTF8StringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- var invalidUTF8 bool
- s := *ptr.toStringSlice()
- for _, v := range s {
- if !utf8.ValidString(v) {
- invalidUTF8 = true
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- }
- if invalidUTF8 {
- return b, errInvalidUTF8
- }
- return b, nil
-}
-func appendBytes(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toBytes()
- if v == nil {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- return b, nil
-}
-func appendBytes3(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toBytes()
- if len(v) == 0 {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- return b, nil
-}
-func appendBytesOneof(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- v := *ptr.toBytes()
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- return b, nil
-}
-func appendBytesSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
- s := *ptr.toBytesSlice()
- for _, v := range s {
- b = appendVarint(b, wiretag)
- b = appendVarint(b, uint64(len(v)))
- b = append(b, v...)
- }
- return b, nil
-}
-
-// makeGroupMarshaler returns the sizer and marshaler for a group.
-// u is the marshal info of the underlying message.
-func makeGroupMarshaler(u *marshalInfo) (sizer, marshaler) {
- return func(ptr pointer, tagsize int) int {
- p := ptr.getPointer()
- if p.isNil() {
- return 0
- }
- return u.size(p) + 2*tagsize
- },
- func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
- p := ptr.getPointer()
- if p.isNil() {
- return b, nil
- }
- var err error
- b = appendVarint(b, wiretag) // start group
- b, err = u.marshal(b, p, deterministic)
- b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group
- return b, err
- }
-}
-
-// makeGroupSliceMarshaler returns the sizer and marshaler for a group slice.
-// u is the marshal info of the underlying message.
-func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) {
- return func(ptr pointer, tagsize int) int {
- s := ptr.getPointerSlice()
- n := 0
- for _, v := range s {
- if v.isNil() {
- continue
- }
- n += u.size(v) + 2*tagsize
- }
- return n
- },
- func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
- s := ptr.getPointerSlice()
- var err error
- var nerr nonFatal
- for _, v := range s {
- if v.isNil() {
- return b, errRepeatedHasNil
- }
- b = appendVarint(b, wiretag) // start group
- b, err = u.marshal(b, v, deterministic)
- b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group
- if !nerr.Merge(err) {
- if err == ErrNil {
- err = errRepeatedHasNil
- }
- return b, err
- }
- }
- return b, nerr.E
- }
-}
-
-// makeMessageMarshaler returns the sizer and marshaler for a message field.
-// u is the marshal info of the message.
-func makeMessageMarshaler(u *marshalInfo) (sizer, marshaler) {
- return func(ptr pointer, tagsize int) int {
- p := ptr.getPointer()
- if p.isNil() {
- return 0
- }
- siz := u.size(p)
- return siz + SizeVarint(uint64(siz)) + tagsize
- },
- func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
- p := ptr.getPointer()
- if p.isNil() {
- return b, nil
- }
- b = appendVarint(b, wiretag)
- siz := u.cachedsize(p)
- b = appendVarint(b, uint64(siz))
- return u.marshal(b, p, deterministic)
- }
-}
-
-// makeMessageSliceMarshaler returns the sizer and marshaler for a message slice.
-// u is the marshal info of the message.
-func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) {
- return func(ptr pointer, tagsize int) int {
- s := ptr.getPointerSlice()
- n := 0
- for _, v := range s {
- if v.isNil() {
- continue
- }
- siz := u.size(v)
- n += siz + SizeVarint(uint64(siz)) + tagsize
- }
- return n
- },
- func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
- s := ptr.getPointerSlice()
- var err error
- var nerr nonFatal
- for _, v := range s {
- if v.isNil() {
- return b, errRepeatedHasNil
- }
- b = appendVarint(b, wiretag)
- siz := u.cachedsize(v)
- b = appendVarint(b, uint64(siz))
- b, err = u.marshal(b, v, deterministic)
-
- if !nerr.Merge(err) {
- if err == ErrNil {
- err = errRepeatedHasNil
- }
- return b, err
- }
- }
- return b, nerr.E
- }
-}
-
-// makeMapMarshaler returns the sizer and marshaler for a map field.
-// f is the pointer to the reflect data structure of the field.
-func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) {
- // figure out key and value type
- t := f.Type
- keyType := t.Key()
- valType := t.Elem()
- keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",")
- valTags := strings.Split(f.Tag.Get("protobuf_val"), ",")
- keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map
- valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map
- keyWireTag := 1<<3 | wiretype(keyTags[0])
- valWireTag := 2<<3 | wiretype(valTags[0])
-
- // We create an interface to get the addresses of the map key and value.
- // If value is pointer-typed, the interface is a direct interface, the
- // idata itself is the value. Otherwise, the idata is the pointer to the
- // value.
- // Key cannot be pointer-typed.
- valIsPtr := valType.Kind() == reflect.Ptr
-
- // If value is a message with nested maps, calling
- // valSizer in marshal may be quadratic. We should use
- // cached version in marshal (but not in size).
- // If value is not message type, we don't have size cache,
- // but it cannot be nested either. Just use valSizer.
- valCachedSizer := valSizer
- if valIsPtr && valType.Elem().Kind() == reflect.Struct {
- u := getMarshalInfo(valType.Elem())
- valCachedSizer = func(ptr pointer, tagsize int) int {
- // Same as message sizer, but use cache.
- p := ptr.getPointer()
- if p.isNil() {
- return 0
- }
- siz := u.cachedsize(p)
- return siz + SizeVarint(uint64(siz)) + tagsize
- }
- }
- return func(ptr pointer, tagsize int) int {
- m := ptr.asPointerTo(t).Elem() // the map
- n := 0
- for _, k := range m.MapKeys() {
- ki := k.Interface()
- vi := m.MapIndex(k).Interface()
- kaddr := toAddrPointer(&ki, false) // pointer to key
- vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value
- siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1)
- n += siz + SizeVarint(uint64(siz)) + tagsize
- }
- return n
- },
- func(b []byte, ptr pointer, tag uint64, deterministic bool) ([]byte, error) {
- m := ptr.asPointerTo(t).Elem() // the map
- var err error
- keys := m.MapKeys()
- if len(keys) > 1 && deterministic {
- sort.Sort(mapKeys(keys))
- }
-
- var nerr nonFatal
- for _, k := range keys {
- ki := k.Interface()
- vi := m.MapIndex(k).Interface()
- kaddr := toAddrPointer(&ki, false) // pointer to key
- vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value
- b = appendVarint(b, tag)
- siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1)
- b = appendVarint(b, uint64(siz))
- b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic)
- if !nerr.Merge(err) {
- return b, err
- }
- b, err = valMarshaler(b, vaddr, valWireTag, deterministic)
- if err != ErrNil && !nerr.Merge(err) { // allow nil value in map
- return b, err
- }
- }
- return b, nerr.E
- }
-}
-
-// makeOneOfMarshaler returns the sizer and marshaler for a oneof field.
-// fi is the marshal info of the field.
-// f is the pointer to the reflect data structure of the field.
-func makeOneOfMarshaler(fi *marshalFieldInfo, f *reflect.StructField) (sizer, marshaler) {
- // Oneof field is an interface. We need to get the actual data type on the fly.
- t := f.Type
- return func(ptr pointer, _ int) int {
- p := ptr.getInterfacePointer()
- if p.isNil() {
- return 0
- }
- v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct
- telem := v.Type()
- e := fi.oneofElems[telem]
- return e.sizer(p, e.tagsize)
- },
- func(b []byte, ptr pointer, _ uint64, deterministic bool) ([]byte, error) {
- p := ptr.getInterfacePointer()
- if p.isNil() {
- return b, nil
- }
- v := ptr.asPointerTo(t).Elem().Elem().Elem() // *interface -> interface -> *struct -> struct
- telem := v.Type()
- if telem.Field(0).Type.Kind() == reflect.Ptr && p.getPointer().isNil() {
- return b, errOneofHasNil
- }
- e := fi.oneofElems[telem]
- return e.marshaler(b, p, e.wiretag, deterministic)
- }
-}
-
-// sizeExtensions computes the size of encoded data for a XXX_InternalExtensions field.
-func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int {
- m, mu := ext.extensionsRead()
- if m == nil {
- return 0
- }
- mu.Lock()
-
- n := 0
- for _, e := range m {
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- n += len(e.enc)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr)
- n += ei.sizer(p, ei.tagsize)
- }
- mu.Unlock()
- return n
-}
-
-// appendExtensions marshals a XXX_InternalExtensions field to the end of byte slice b.
-func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) {
- m, mu := ext.extensionsRead()
- if m == nil {
- return b, nil
- }
- mu.Lock()
- defer mu.Unlock()
-
- var err error
- var nerr nonFatal
-
- // Fast-path for common cases: zero or one extensions.
- // Don't bother sorting the keys.
- if len(m) <= 1 {
- for _, e := range m {
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- b = append(b, e.enc...)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr)
- b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
- if !nerr.Merge(err) {
- return b, err
- }
- }
- return b, nerr.E
- }
-
- // Sort the keys to provide a deterministic encoding.
- // Not sure this is required, but the old code does it.
- keys := make([]int, 0, len(m))
- for k := range m {
- keys = append(keys, int(k))
- }
- sort.Ints(keys)
-
- for _, k := range keys {
- e := m[int32(k)]
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- b = append(b, e.enc...)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr)
- b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
- if !nerr.Merge(err) {
- return b, err
- }
- }
- return b, nerr.E
-}
-
-// message set format is:
-// message MessageSet {
-// repeated group Item = 1 {
-// required int32 type_id = 2;
-// required string message = 3;
-// };
-// }
-
-// sizeMessageSet computes the size of encoded data for a XXX_InternalExtensions field
-// in message set format (above).
-func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int {
- m, mu := ext.extensionsRead()
- if m == nil {
- return 0
- }
- mu.Lock()
-
- n := 0
- for id, e := range m {
- n += 2 // start group, end group. tag = 1 (size=1)
- n += SizeVarint(uint64(id)) + 1 // type_id, tag = 2 (size=1)
-
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint
- siz := len(msgWithLen)
- n += siz + 1 // message, tag = 3 (size=1)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr)
- n += ei.sizer(p, 1) // message, tag = 3 (size=1)
- }
- mu.Unlock()
- return n
-}
-
-// appendMessageSet marshals a XXX_InternalExtensions field in message set format (above)
-// to the end of byte slice b.
-func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, deterministic bool) ([]byte, error) {
- m, mu := ext.extensionsRead()
- if m == nil {
- return b, nil
- }
- mu.Lock()
- defer mu.Unlock()
-
- var err error
- var nerr nonFatal
-
- // Fast-path for common cases: zero or one extensions.
- // Don't bother sorting the keys.
- if len(m) <= 1 {
- for id, e := range m {
- b = append(b, 1<<3|WireStartGroup)
- b = append(b, 2<<3|WireVarint)
- b = appendVarint(b, uint64(id))
-
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint
- b = append(b, 3<<3|WireBytes)
- b = append(b, msgWithLen...)
- b = append(b, 1<<3|WireEndGroup)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr)
- b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic)
- if !nerr.Merge(err) {
- return b, err
- }
- b = append(b, 1<<3|WireEndGroup)
- }
- return b, nerr.E
- }
-
- // Sort the keys to provide a deterministic encoding.
- keys := make([]int, 0, len(m))
- for k := range m {
- keys = append(keys, int(k))
- }
- sort.Ints(keys)
-
- for _, id := range keys {
- e := m[int32(id)]
- b = append(b, 1<<3|WireStartGroup)
- b = append(b, 2<<3|WireVarint)
- b = appendVarint(b, uint64(id))
-
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- msgWithLen := skipVarint(e.enc) // skip old tag, but leave the length varint
- b = append(b, 3<<3|WireBytes)
- b = append(b, msgWithLen...)
- b = append(b, 1<<3|WireEndGroup)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr)
- b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic)
- b = append(b, 1<<3|WireEndGroup)
- if !nerr.Merge(err) {
- return b, err
- }
- }
- return b, nerr.E
-}
-
-// sizeV1Extensions computes the size of encoded data for a V1-API extension field.
-func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int {
- if m == nil {
- return 0
- }
-
- n := 0
- for _, e := range m {
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- n += len(e.enc)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr)
- n += ei.sizer(p, ei.tagsize)
- }
- return n
-}
-
-// appendV1Extensions marshals a V1-API extension field to the end of byte slice b.
-func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, deterministic bool) ([]byte, error) {
- if m == nil {
- return b, nil
- }
-
- // Sort the keys to provide a deterministic encoding.
- keys := make([]int, 0, len(m))
- for k := range m {
- keys = append(keys, int(k))
- }
- sort.Ints(keys)
-
- var err error
- var nerr nonFatal
- for _, k := range keys {
- e := m[int32(k)]
- if e.value == nil || e.desc == nil {
- // Extension is only in its encoded form.
- b = append(b, e.enc...)
- continue
- }
-
- // We don't skip extensions that have an encoded form set,
- // because the extension value may have been mutated after
- // the last time this function was called.
-
- ei := u.getExtElemInfo(e.desc)
- v := e.value
- p := toAddrPointer(&v, ei.isptr)
- b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
- if !nerr.Merge(err) {
- return b, err
- }
- }
- return b, nerr.E
-}
-
-// newMarshaler is the interface representing objects that can marshal themselves.
-//
-// This exists to support protoc-gen-go generated messages.
-// The proto package will stop type-asserting to this interface in the future.
-//
-// DO NOT DEPEND ON THIS.
-type newMarshaler interface {
- XXX_Size() int
- XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
-}
-
-// Size returns the encoded size of a protocol buffer message.
-// This is the main entry point.
-func Size(pb Message) int {
- if m, ok := pb.(newMarshaler); ok {
- return m.XXX_Size()
- }
- if m, ok := pb.(Marshaler); ok {
- // If the message can marshal itself, let it do it, for compatibility.
- // NOTE: This is not efficient.
- b, _ := m.Marshal()
- return len(b)
- }
- // in case somehow we didn't generate the wrapper
- if pb == nil {
- return 0
- }
- var info InternalMessageInfo
- return info.Size(pb)
-}
-
-// Marshal takes a protocol buffer message
-// and encodes it into the wire format, returning the data.
-// This is the main entry point.
-func Marshal(pb Message) ([]byte, error) {
- if m, ok := pb.(newMarshaler); ok {
- siz := m.XXX_Size()
- b := make([]byte, 0, siz)
- return m.XXX_Marshal(b, false)
- }
- if m, ok := pb.(Marshaler); ok {
- // If the message can marshal itself, let it do it, for compatibility.
- // NOTE: This is not efficient.
- return m.Marshal()
- }
- // in case somehow we didn't generate the wrapper
- if pb == nil {
- return nil, ErrNil
- }
- var info InternalMessageInfo
- siz := info.Size(pb)
- b := make([]byte, 0, siz)
- return info.Marshal(b, pb, false)
-}
-
-// Marshal takes a protocol buffer message
-// and encodes it into the wire format, writing the result to the
-// Buffer.
-// This is an alternative entry point. It is not necessary to use
-// a Buffer for most applications.
-func (p *Buffer) Marshal(pb Message) error {
- var err error
- if m, ok := pb.(newMarshaler); ok {
- siz := m.XXX_Size()
- p.grow(siz) // make sure buf has enough capacity
- p.buf, err = m.XXX_Marshal(p.buf, p.deterministic)
- return err
- }
- if m, ok := pb.(Marshaler); ok {
- // If the message can marshal itself, let it do it, for compatibility.
- // NOTE: This is not efficient.
- b, err := m.Marshal()
- p.buf = append(p.buf, b...)
- return err
- }
- // in case somehow we didn't generate the wrapper
- if pb == nil {
- return ErrNil
- }
- var info InternalMessageInfo
- siz := info.Size(pb)
- p.grow(siz) // make sure buf has enough capacity
- p.buf, err = info.Marshal(p.buf, pb, p.deterministic)
- return err
-}
-
-// grow grows the buffer's capacity, if necessary, to guarantee space for
-// another n bytes. After grow(n), at least n bytes can be written to the
-// buffer without another allocation.
-func (p *Buffer) grow(n int) {
- need := len(p.buf) + n
- if need <= cap(p.buf) {
- return
- }
- newCap := len(p.buf) * 2
- if newCap < need {
- newCap = need
- }
- p.buf = append(make([]byte, 0, newCap), p.buf...)
-}
diff --git a/vendor/github.com/golang/protobuf/proto/table_merge.go b/vendor/github.com/golang/protobuf/proto/table_merge.go
deleted file mode 100644
index 5525def6a5da89fee6a0528924cefdbc5ef987e1..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/table_merge.go
+++ /dev/null
@@ -1,654 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
- "fmt"
- "reflect"
- "strings"
- "sync"
- "sync/atomic"
-)
-
-// Merge merges the src message into dst.
-// This assumes that dst and src of the same type and are non-nil.
-func (a *InternalMessageInfo) Merge(dst, src Message) {
- mi := atomicLoadMergeInfo(&a.merge)
- if mi == nil {
- mi = getMergeInfo(reflect.TypeOf(dst).Elem())
- atomicStoreMergeInfo(&a.merge, mi)
- }
- mi.merge(toPointer(&dst), toPointer(&src))
-}
-
-type mergeInfo struct {
- typ reflect.Type
-
- initialized int32 // 0: only typ is valid, 1: everything is valid
- lock sync.Mutex
-
- fields []mergeFieldInfo
- unrecognized field // Offset of XXX_unrecognized
-}
-
-type mergeFieldInfo struct {
- field field // Offset of field, guaranteed to be valid
-
- // isPointer reports whether the value in the field is a pointer.
- // This is true for the following situations:
- // * Pointer to struct
- // * Pointer to basic type (proto2 only)
- // * Slice (first value in slice header is a pointer)
- // * String (first value in string header is a pointer)
- isPointer bool
-
- // basicWidth reports the width of the field assuming that it is directly
- // embedded in the struct (as is the case for basic types in proto3).
- // The possible values are:
- // 0: invalid
- // 1: bool
- // 4: int32, uint32, float32
- // 8: int64, uint64, float64
- basicWidth int
-
- // Where dst and src are pointers to the types being merged.
- merge func(dst, src pointer)
-}
-
-var (
- mergeInfoMap = map[reflect.Type]*mergeInfo{}
- mergeInfoLock sync.Mutex
-)
-
-func getMergeInfo(t reflect.Type) *mergeInfo {
- mergeInfoLock.Lock()
- defer mergeInfoLock.Unlock()
- mi := mergeInfoMap[t]
- if mi == nil {
- mi = &mergeInfo{typ: t}
- mergeInfoMap[t] = mi
- }
- return mi
-}
-
-// merge merges src into dst assuming they are both of type *mi.typ.
-func (mi *mergeInfo) merge(dst, src pointer) {
- if dst.isNil() {
- panic("proto: nil destination")
- }
- if src.isNil() {
- return // Nothing to do.
- }
-
- if atomic.LoadInt32(&mi.initialized) == 0 {
- mi.computeMergeInfo()
- }
-
- for _, fi := range mi.fields {
- sfp := src.offset(fi.field)
-
- // As an optimization, we can avoid the merge function call cost
- // if we know for sure that the source will have no effect
- // by checking if it is the zero value.
- if unsafeAllowed {
- if fi.isPointer && sfp.getPointer().isNil() { // Could be slice or string
- continue
- }
- if fi.basicWidth > 0 {
- switch {
- case fi.basicWidth == 1 && !*sfp.toBool():
- continue
- case fi.basicWidth == 4 && *sfp.toUint32() == 0:
- continue
- case fi.basicWidth == 8 && *sfp.toUint64() == 0:
- continue
- }
- }
- }
-
- dfp := dst.offset(fi.field)
- fi.merge(dfp, sfp)
- }
-
- // TODO: Make this faster?
- out := dst.asPointerTo(mi.typ).Elem()
- in := src.asPointerTo(mi.typ).Elem()
- if emIn, err := extendable(in.Addr().Interface()); err == nil {
- emOut, _ := extendable(out.Addr().Interface())
- mIn, muIn := emIn.extensionsRead()
- if mIn != nil {
- mOut := emOut.extensionsWrite()
- muIn.Lock()
- mergeExtension(mOut, mIn)
- muIn.Unlock()
- }
- }
-
- if mi.unrecognized.IsValid() {
- if b := *src.offset(mi.unrecognized).toBytes(); len(b) > 0 {
- *dst.offset(mi.unrecognized).toBytes() = append([]byte(nil), b...)
- }
- }
-}
-
-func (mi *mergeInfo) computeMergeInfo() {
- mi.lock.Lock()
- defer mi.lock.Unlock()
- if mi.initialized != 0 {
- return
- }
- t := mi.typ
- n := t.NumField()
-
- props := GetProperties(t)
- for i := 0; i < n; i++ {
- f := t.Field(i)
- if strings.HasPrefix(f.Name, "XXX_") {
- continue
- }
-
- mfi := mergeFieldInfo{field: toField(&f)}
- tf := f.Type
-
- // As an optimization, we can avoid the merge function call cost
- // if we know for sure that the source will have no effect
- // by checking if it is the zero value.
- if unsafeAllowed {
- switch tf.Kind() {
- case reflect.Ptr, reflect.Slice, reflect.String:
- // As a special case, we assume slices and strings are pointers
- // since we know that the first field in the SliceSlice or
- // StringHeader is a data pointer.
- mfi.isPointer = true
- case reflect.Bool:
- mfi.basicWidth = 1
- case reflect.Int32, reflect.Uint32, reflect.Float32:
- mfi.basicWidth = 4
- case reflect.Int64, reflect.Uint64, reflect.Float64:
- mfi.basicWidth = 8
- }
- }
-
- // Unwrap tf to get at its most basic type.
- var isPointer, isSlice bool
- if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 {
- isSlice = true
- tf = tf.Elem()
- }
- if tf.Kind() == reflect.Ptr {
- isPointer = true
- tf = tf.Elem()
- }
- if isPointer && isSlice && tf.Kind() != reflect.Struct {
- panic("both pointer and slice for basic type in " + tf.Name())
- }
-
- switch tf.Kind() {
- case reflect.Int32:
- switch {
- case isSlice: // E.g., []int32
- mfi.merge = func(dst, src pointer) {
- // NOTE: toInt32Slice is not defined (see pointer_reflect.go).
- /*
- sfsp := src.toInt32Slice()
- if *sfsp != nil {
- dfsp := dst.toInt32Slice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []int64{}
- }
- }
- */
- sfs := src.getInt32Slice()
- if sfs != nil {
- dfs := dst.getInt32Slice()
- dfs = append(dfs, sfs...)
- if dfs == nil {
- dfs = []int32{}
- }
- dst.setInt32Slice(dfs)
- }
- }
- case isPointer: // E.g., *int32
- mfi.merge = func(dst, src pointer) {
- // NOTE: toInt32Ptr is not defined (see pointer_reflect.go).
- /*
- sfpp := src.toInt32Ptr()
- if *sfpp != nil {
- dfpp := dst.toInt32Ptr()
- if *dfpp == nil {
- *dfpp = Int32(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- */
- sfp := src.getInt32Ptr()
- if sfp != nil {
- dfp := dst.getInt32Ptr()
- if dfp == nil {
- dst.setInt32Ptr(*sfp)
- } else {
- *dfp = *sfp
- }
- }
- }
- default: // E.g., int32
- mfi.merge = func(dst, src pointer) {
- if v := *src.toInt32(); v != 0 {
- *dst.toInt32() = v
- }
- }
- }
- case reflect.Int64:
- switch {
- case isSlice: // E.g., []int64
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toInt64Slice()
- if *sfsp != nil {
- dfsp := dst.toInt64Slice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []int64{}
- }
- }
- }
- case isPointer: // E.g., *int64
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toInt64Ptr()
- if *sfpp != nil {
- dfpp := dst.toInt64Ptr()
- if *dfpp == nil {
- *dfpp = Int64(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., int64
- mfi.merge = func(dst, src pointer) {
- if v := *src.toInt64(); v != 0 {
- *dst.toInt64() = v
- }
- }
- }
- case reflect.Uint32:
- switch {
- case isSlice: // E.g., []uint32
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toUint32Slice()
- if *sfsp != nil {
- dfsp := dst.toUint32Slice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []uint32{}
- }
- }
- }
- case isPointer: // E.g., *uint32
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toUint32Ptr()
- if *sfpp != nil {
- dfpp := dst.toUint32Ptr()
- if *dfpp == nil {
- *dfpp = Uint32(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., uint32
- mfi.merge = func(dst, src pointer) {
- if v := *src.toUint32(); v != 0 {
- *dst.toUint32() = v
- }
- }
- }
- case reflect.Uint64:
- switch {
- case isSlice: // E.g., []uint64
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toUint64Slice()
- if *sfsp != nil {
- dfsp := dst.toUint64Slice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []uint64{}
- }
- }
- }
- case isPointer: // E.g., *uint64
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toUint64Ptr()
- if *sfpp != nil {
- dfpp := dst.toUint64Ptr()
- if *dfpp == nil {
- *dfpp = Uint64(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., uint64
- mfi.merge = func(dst, src pointer) {
- if v := *src.toUint64(); v != 0 {
- *dst.toUint64() = v
- }
- }
- }
- case reflect.Float32:
- switch {
- case isSlice: // E.g., []float32
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toFloat32Slice()
- if *sfsp != nil {
- dfsp := dst.toFloat32Slice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []float32{}
- }
- }
- }
- case isPointer: // E.g., *float32
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toFloat32Ptr()
- if *sfpp != nil {
- dfpp := dst.toFloat32Ptr()
- if *dfpp == nil {
- *dfpp = Float32(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., float32
- mfi.merge = func(dst, src pointer) {
- if v := *src.toFloat32(); v != 0 {
- *dst.toFloat32() = v
- }
- }
- }
- case reflect.Float64:
- switch {
- case isSlice: // E.g., []float64
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toFloat64Slice()
- if *sfsp != nil {
- dfsp := dst.toFloat64Slice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []float64{}
- }
- }
- }
- case isPointer: // E.g., *float64
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toFloat64Ptr()
- if *sfpp != nil {
- dfpp := dst.toFloat64Ptr()
- if *dfpp == nil {
- *dfpp = Float64(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., float64
- mfi.merge = func(dst, src pointer) {
- if v := *src.toFloat64(); v != 0 {
- *dst.toFloat64() = v
- }
- }
- }
- case reflect.Bool:
- switch {
- case isSlice: // E.g., []bool
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toBoolSlice()
- if *sfsp != nil {
- dfsp := dst.toBoolSlice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []bool{}
- }
- }
- }
- case isPointer: // E.g., *bool
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toBoolPtr()
- if *sfpp != nil {
- dfpp := dst.toBoolPtr()
- if *dfpp == nil {
- *dfpp = Bool(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., bool
- mfi.merge = func(dst, src pointer) {
- if v := *src.toBool(); v {
- *dst.toBool() = v
- }
- }
- }
- case reflect.String:
- switch {
- case isSlice: // E.g., []string
- mfi.merge = func(dst, src pointer) {
- sfsp := src.toStringSlice()
- if *sfsp != nil {
- dfsp := dst.toStringSlice()
- *dfsp = append(*dfsp, *sfsp...)
- if *dfsp == nil {
- *dfsp = []string{}
- }
- }
- }
- case isPointer: // E.g., *string
- mfi.merge = func(dst, src pointer) {
- sfpp := src.toStringPtr()
- if *sfpp != nil {
- dfpp := dst.toStringPtr()
- if *dfpp == nil {
- *dfpp = String(**sfpp)
- } else {
- **dfpp = **sfpp
- }
- }
- }
- default: // E.g., string
- mfi.merge = func(dst, src pointer) {
- if v := *src.toString(); v != "" {
- *dst.toString() = v
- }
- }
- }
- case reflect.Slice:
- isProto3 := props.Prop[i].proto3
- switch {
- case isPointer:
- panic("bad pointer in byte slice case in " + tf.Name())
- case tf.Elem().Kind() != reflect.Uint8:
- panic("bad element kind in byte slice case in " + tf.Name())
- case isSlice: // E.g., [][]byte
- mfi.merge = func(dst, src pointer) {
- sbsp := src.toBytesSlice()
- if *sbsp != nil {
- dbsp := dst.toBytesSlice()
- for _, sb := range *sbsp {
- if sb == nil {
- *dbsp = append(*dbsp, nil)
- } else {
- *dbsp = append(*dbsp, append([]byte{}, sb...))
- }
- }
- if *dbsp == nil {
- *dbsp = [][]byte{}
- }
- }
- }
- default: // E.g., []byte
- mfi.merge = func(dst, src pointer) {
- sbp := src.toBytes()
- if *sbp != nil {
- dbp := dst.toBytes()
- if !isProto3 || len(*sbp) > 0 {
- *dbp = append([]byte{}, *sbp...)
- }
- }
- }
- }
- case reflect.Struct:
- switch {
- case !isPointer:
- panic(fmt.Sprintf("message field %s without pointer", tf))
- case isSlice: // E.g., []*pb.T
- mi := getMergeInfo(tf)
- mfi.merge = func(dst, src pointer) {
- sps := src.getPointerSlice()
- if sps != nil {
- dps := dst.getPointerSlice()
- for _, sp := range sps {
- var dp pointer
- if !sp.isNil() {
- dp = valToPointer(reflect.New(tf))
- mi.merge(dp, sp)
- }
- dps = append(dps, dp)
- }
- if dps == nil {
- dps = []pointer{}
- }
- dst.setPointerSlice(dps)
- }
- }
- default: // E.g., *pb.T
- mi := getMergeInfo(tf)
- mfi.merge = func(dst, src pointer) {
- sp := src.getPointer()
- if !sp.isNil() {
- dp := dst.getPointer()
- if dp.isNil() {
- dp = valToPointer(reflect.New(tf))
- dst.setPointer(dp)
- }
- mi.merge(dp, sp)
- }
- }
- }
- case reflect.Map:
- switch {
- case isPointer || isSlice:
- panic("bad pointer or slice in map case in " + tf.Name())
- default: // E.g., map[K]V
- mfi.merge = func(dst, src pointer) {
- sm := src.asPointerTo(tf).Elem()
- if sm.Len() == 0 {
- return
- }
- dm := dst.asPointerTo(tf).Elem()
- if dm.IsNil() {
- dm.Set(reflect.MakeMap(tf))
- }
-
- switch tf.Elem().Kind() {
- case reflect.Ptr: // Proto struct (e.g., *T)
- for _, key := range sm.MapKeys() {
- val := sm.MapIndex(key)
- val = reflect.ValueOf(Clone(val.Interface().(Message)))
- dm.SetMapIndex(key, val)
- }
- case reflect.Slice: // E.g. Bytes type (e.g., []byte)
- for _, key := range sm.MapKeys() {
- val := sm.MapIndex(key)
- val = reflect.ValueOf(append([]byte{}, val.Bytes()...))
- dm.SetMapIndex(key, val)
- }
- default: // Basic type (e.g., string)
- for _, key := range sm.MapKeys() {
- val := sm.MapIndex(key)
- dm.SetMapIndex(key, val)
- }
- }
- }
- }
- case reflect.Interface:
- // Must be oneof field.
- switch {
- case isPointer || isSlice:
- panic("bad pointer or slice in interface case in " + tf.Name())
- default: // E.g., interface{}
- // TODO: Make this faster?
- mfi.merge = func(dst, src pointer) {
- su := src.asPointerTo(tf).Elem()
- if !su.IsNil() {
- du := dst.asPointerTo(tf).Elem()
- typ := su.Elem().Type()
- if du.IsNil() || du.Elem().Type() != typ {
- du.Set(reflect.New(typ.Elem())) // Initialize interface if empty
- }
- sv := su.Elem().Elem().Field(0)
- if sv.Kind() == reflect.Ptr && sv.IsNil() {
- return
- }
- dv := du.Elem().Elem().Field(0)
- if dv.Kind() == reflect.Ptr && dv.IsNil() {
- dv.Set(reflect.New(sv.Type().Elem())) // Initialize proto message if empty
- }
- switch sv.Type().Kind() {
- case reflect.Ptr: // Proto struct (e.g., *T)
- Merge(dv.Interface().(Message), sv.Interface().(Message))
- case reflect.Slice: // E.g. Bytes type (e.g., []byte)
- dv.Set(reflect.ValueOf(append([]byte{}, sv.Bytes()...)))
- default: // Basic type (e.g., string)
- dv.Set(sv)
- }
- }
- }
- }
- default:
- panic(fmt.Sprintf("merger not found for type:%s", tf))
- }
- mi.fields = append(mi.fields, mfi)
- }
-
- mi.unrecognized = invalidField
- if f, ok := t.FieldByName("XXX_unrecognized"); ok {
- if f.Type != reflect.TypeOf([]byte{}) {
- panic("expected XXX_unrecognized to be of type []byte")
- }
- mi.unrecognized = toField(&f)
- }
-
- atomic.StoreInt32(&mi.initialized, 1)
-}
diff --git a/vendor/github.com/golang/protobuf/proto/table_unmarshal.go b/vendor/github.com/golang/protobuf/proto/table_unmarshal.go
deleted file mode 100644
index ebf1caa56a268dc6552a5aa4d26af5890e2d8834..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/table_unmarshal.go
+++ /dev/null
@@ -1,2051 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2016 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-import (
- "errors"
- "fmt"
- "io"
- "math"
- "reflect"
- "strconv"
- "strings"
- "sync"
- "sync/atomic"
- "unicode/utf8"
-)
-
-// Unmarshal is the entry point from the generated .pb.go files.
-// This function is not intended to be used by non-generated code.
-// This function is not subject to any compatibility guarantee.
-// msg contains a pointer to a protocol buffer struct.
-// b is the data to be unmarshaled into the protocol buffer.
-// a is a pointer to a place to store cached unmarshal information.
-func (a *InternalMessageInfo) Unmarshal(msg Message, b []byte) error {
- // Load the unmarshal information for this message type.
- // The atomic load ensures memory consistency.
- u := atomicLoadUnmarshalInfo(&a.unmarshal)
- if u == nil {
- // Slow path: find unmarshal info for msg, update a with it.
- u = getUnmarshalInfo(reflect.TypeOf(msg).Elem())
- atomicStoreUnmarshalInfo(&a.unmarshal, u)
- }
- // Then do the unmarshaling.
- err := u.unmarshal(toPointer(&msg), b)
- return err
-}
-
-type unmarshalInfo struct {
- typ reflect.Type // type of the protobuf struct
-
- // 0 = only typ field is initialized
- // 1 = completely initialized
- initialized int32
- lock sync.Mutex // prevents double initialization
- dense []unmarshalFieldInfo // fields indexed by tag #
- sparse map[uint64]unmarshalFieldInfo // fields indexed by tag #
- reqFields []string // names of required fields
- reqMask uint64 // 1< 0 {
- // Read tag and wire type.
- // Special case 1 and 2 byte varints.
- var x uint64
- if b[0] < 128 {
- x = uint64(b[0])
- b = b[1:]
- } else if len(b) >= 2 && b[1] < 128 {
- x = uint64(b[0]&0x7f) + uint64(b[1])<<7
- b = b[2:]
- } else {
- var n int
- x, n = decodeVarint(b)
- if n == 0 {
- return io.ErrUnexpectedEOF
- }
- b = b[n:]
- }
- tag := x >> 3
- wire := int(x) & 7
-
- // Dispatch on the tag to one of the unmarshal* functions below.
- var f unmarshalFieldInfo
- if tag < uint64(len(u.dense)) {
- f = u.dense[tag]
- } else {
- f = u.sparse[tag]
- }
- if fn := f.unmarshal; fn != nil {
- var err error
- b, err = fn(b, m.offset(f.field), wire)
- if err == nil {
- reqMask |= f.reqMask
- continue
- }
- if r, ok := err.(*RequiredNotSetError); ok {
- // Remember this error, but keep parsing. We need to produce
- // a full parse even if a required field is missing.
- if errLater == nil {
- errLater = r
- }
- reqMask |= f.reqMask
- continue
- }
- if err != errInternalBadWireType {
- if err == errInvalidUTF8 {
- if errLater == nil {
- fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name
- errLater = &invalidUTF8Error{fullName}
- }
- continue
- }
- return err
- }
- // Fragments with bad wire type are treated as unknown fields.
- }
-
- // Unknown tag.
- if !u.unrecognized.IsValid() {
- // Don't keep unrecognized data; just skip it.
- var err error
- b, err = skipField(b, wire)
- if err != nil {
- return err
- }
- continue
- }
- // Keep unrecognized data around.
- // maybe in extensions, maybe in the unrecognized field.
- z := m.offset(u.unrecognized).toBytes()
- var emap map[int32]Extension
- var e Extension
- for _, r := range u.extensionRanges {
- if uint64(r.Start) <= tag && tag <= uint64(r.End) {
- if u.extensions.IsValid() {
- mp := m.offset(u.extensions).toExtensions()
- emap = mp.extensionsWrite()
- e = emap[int32(tag)]
- z = &e.enc
- break
- }
- if u.oldExtensions.IsValid() {
- p := m.offset(u.oldExtensions).toOldExtensions()
- emap = *p
- if emap == nil {
- emap = map[int32]Extension{}
- *p = emap
- }
- e = emap[int32(tag)]
- z = &e.enc
- break
- }
- panic("no extensions field available")
- }
- }
-
- // Use wire type to skip data.
- var err error
- b0 := b
- b, err = skipField(b, wire)
- if err != nil {
- return err
- }
- *z = encodeVarint(*z, tag<<3|uint64(wire))
- *z = append(*z, b0[:len(b0)-len(b)]...)
-
- if emap != nil {
- emap[int32(tag)] = e
- }
- }
- if reqMask != u.reqMask && errLater == nil {
- // A required field of this message is missing.
- for _, n := range u.reqFields {
- if reqMask&1 == 0 {
- errLater = &RequiredNotSetError{n}
- }
- reqMask >>= 1
- }
- }
- return errLater
-}
-
-// computeUnmarshalInfo fills in u with information for use
-// in unmarshaling protocol buffers of type u.typ.
-func (u *unmarshalInfo) computeUnmarshalInfo() {
- u.lock.Lock()
- defer u.lock.Unlock()
- if u.initialized != 0 {
- return
- }
- t := u.typ
- n := t.NumField()
-
- // Set up the "not found" value for the unrecognized byte buffer.
- // This is the default for proto3.
- u.unrecognized = invalidField
- u.extensions = invalidField
- u.oldExtensions = invalidField
-
- // List of the generated type and offset for each oneof field.
- type oneofField struct {
- ityp reflect.Type // interface type of oneof field
- field field // offset in containing message
- }
- var oneofFields []oneofField
-
- for i := 0; i < n; i++ {
- f := t.Field(i)
- if f.Name == "XXX_unrecognized" {
- // The byte slice used to hold unrecognized input is special.
- if f.Type != reflect.TypeOf(([]byte)(nil)) {
- panic("bad type for XXX_unrecognized field: " + f.Type.Name())
- }
- u.unrecognized = toField(&f)
- continue
- }
- if f.Name == "XXX_InternalExtensions" {
- // Ditto here.
- if f.Type != reflect.TypeOf(XXX_InternalExtensions{}) {
- panic("bad type for XXX_InternalExtensions field: " + f.Type.Name())
- }
- u.extensions = toField(&f)
- if f.Tag.Get("protobuf_messageset") == "1" {
- u.isMessageSet = true
- }
- continue
- }
- if f.Name == "XXX_extensions" {
- // An older form of the extensions field.
- if f.Type != reflect.TypeOf((map[int32]Extension)(nil)) {
- panic("bad type for XXX_extensions field: " + f.Type.Name())
- }
- u.oldExtensions = toField(&f)
- continue
- }
- if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" {
- continue
- }
-
- oneof := f.Tag.Get("protobuf_oneof")
- if oneof != "" {
- oneofFields = append(oneofFields, oneofField{f.Type, toField(&f)})
- // The rest of oneof processing happens below.
- continue
- }
-
- tags := f.Tag.Get("protobuf")
- tagArray := strings.Split(tags, ",")
- if len(tagArray) < 2 {
- panic("protobuf tag not enough fields in " + t.Name() + "." + f.Name + ": " + tags)
- }
- tag, err := strconv.Atoi(tagArray[1])
- if err != nil {
- panic("protobuf tag field not an integer: " + tagArray[1])
- }
-
- name := ""
- for _, tag := range tagArray[3:] {
- if strings.HasPrefix(tag, "name=") {
- name = tag[5:]
- }
- }
-
- // Extract unmarshaling function from the field (its type and tags).
- unmarshal := fieldUnmarshaler(&f)
-
- // Required field?
- var reqMask uint64
- if tagArray[2] == "req" {
- bit := len(u.reqFields)
- u.reqFields = append(u.reqFields, name)
- reqMask = uint64(1) << uint(bit)
- // TODO: if we have more than 64 required fields, we end up
- // not verifying that all required fields are present.
- // Fix this, perhaps using a count of required fields?
- }
-
- // Store the info in the correct slot in the message.
- u.setTag(tag, toField(&f), unmarshal, reqMask, name)
- }
-
- // Find any types associated with oneof fields.
- // TODO: XXX_OneofFuncs returns more info than we need. Get rid of some of it?
- fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("XXX_OneofFuncs")
- if fn.IsValid() {
- res := fn.Call(nil)[3] // last return value from XXX_OneofFuncs: []interface{}
- for i := res.Len() - 1; i >= 0; i-- {
- v := res.Index(i) // interface{}
- tptr := reflect.ValueOf(v.Interface()).Type() // *Msg_X
- typ := tptr.Elem() // Msg_X
-
- f := typ.Field(0) // oneof implementers have one field
- baseUnmarshal := fieldUnmarshaler(&f)
- tags := strings.Split(f.Tag.Get("protobuf"), ",")
- fieldNum, err := strconv.Atoi(tags[1])
- if err != nil {
- panic("protobuf tag field not an integer: " + tags[1])
- }
- var name string
- for _, tag := range tags {
- if strings.HasPrefix(tag, "name=") {
- name = strings.TrimPrefix(tag, "name=")
- break
- }
- }
-
- // Find the oneof field that this struct implements.
- // Might take O(n^2) to process all of the oneofs, but who cares.
- for _, of := range oneofFields {
- if tptr.Implements(of.ityp) {
- // We have found the corresponding interface for this struct.
- // That lets us know where this struct should be stored
- // when we encounter it during unmarshaling.
- unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal)
- u.setTag(fieldNum, of.field, unmarshal, 0, name)
- }
- }
- }
- }
-
- // Get extension ranges, if any.
- fn = reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray")
- if fn.IsValid() {
- if !u.extensions.IsValid() && !u.oldExtensions.IsValid() {
- panic("a message with extensions, but no extensions field in " + t.Name())
- }
- u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange)
- }
-
- // Explicitly disallow tag 0. This will ensure we flag an error
- // when decoding a buffer of all zeros. Without this code, we
- // would decode and skip an all-zero buffer of even length.
- // [0 0] is [tag=0/wiretype=varint varint-encoded-0].
- u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) {
- return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w)
- }, 0, "")
-
- // Set mask for required field check.
- u.reqMask = uint64(1)<= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here?
- for len(u.dense) <= tag {
- u.dense = append(u.dense, unmarshalFieldInfo{})
- }
- u.dense[tag] = i
- return
- }
- if u.sparse == nil {
- u.sparse = map[uint64]unmarshalFieldInfo{}
- }
- u.sparse[uint64(tag)] = i
-}
-
-// fieldUnmarshaler returns an unmarshaler for the given field.
-func fieldUnmarshaler(f *reflect.StructField) unmarshaler {
- if f.Type.Kind() == reflect.Map {
- return makeUnmarshalMap(f)
- }
- return typeUnmarshaler(f.Type, f.Tag.Get("protobuf"))
-}
-
-// typeUnmarshaler returns an unmarshaler for the given field type / field tag pair.
-func typeUnmarshaler(t reflect.Type, tags string) unmarshaler {
- tagArray := strings.Split(tags, ",")
- encoding := tagArray[0]
- name := "unknown"
- proto3 := false
- validateUTF8 := true
- for _, tag := range tagArray[3:] {
- if strings.HasPrefix(tag, "name=") {
- name = tag[5:]
- }
- if tag == "proto3" {
- proto3 = true
- }
- }
- validateUTF8 = validateUTF8 && proto3
-
- // Figure out packaging (pointer, slice, or both)
- slice := false
- pointer := false
- if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 {
- slice = true
- t = t.Elem()
- }
- if t.Kind() == reflect.Ptr {
- pointer = true
- t = t.Elem()
- }
-
- // We'll never have both pointer and slice for basic types.
- if pointer && slice && t.Kind() != reflect.Struct {
- panic("both pointer and slice for basic type in " + t.Name())
- }
-
- switch t.Kind() {
- case reflect.Bool:
- if pointer {
- return unmarshalBoolPtr
- }
- if slice {
- return unmarshalBoolSlice
- }
- return unmarshalBoolValue
- case reflect.Int32:
- switch encoding {
- case "fixed32":
- if pointer {
- return unmarshalFixedS32Ptr
- }
- if slice {
- return unmarshalFixedS32Slice
- }
- return unmarshalFixedS32Value
- case "varint":
- // this could be int32 or enum
- if pointer {
- return unmarshalInt32Ptr
- }
- if slice {
- return unmarshalInt32Slice
- }
- return unmarshalInt32Value
- case "zigzag32":
- if pointer {
- return unmarshalSint32Ptr
- }
- if slice {
- return unmarshalSint32Slice
- }
- return unmarshalSint32Value
- }
- case reflect.Int64:
- switch encoding {
- case "fixed64":
- if pointer {
- return unmarshalFixedS64Ptr
- }
- if slice {
- return unmarshalFixedS64Slice
- }
- return unmarshalFixedS64Value
- case "varint":
- if pointer {
- return unmarshalInt64Ptr
- }
- if slice {
- return unmarshalInt64Slice
- }
- return unmarshalInt64Value
- case "zigzag64":
- if pointer {
- return unmarshalSint64Ptr
- }
- if slice {
- return unmarshalSint64Slice
- }
- return unmarshalSint64Value
- }
- case reflect.Uint32:
- switch encoding {
- case "fixed32":
- if pointer {
- return unmarshalFixed32Ptr
- }
- if slice {
- return unmarshalFixed32Slice
- }
- return unmarshalFixed32Value
- case "varint":
- if pointer {
- return unmarshalUint32Ptr
- }
- if slice {
- return unmarshalUint32Slice
- }
- return unmarshalUint32Value
- }
- case reflect.Uint64:
- switch encoding {
- case "fixed64":
- if pointer {
- return unmarshalFixed64Ptr
- }
- if slice {
- return unmarshalFixed64Slice
- }
- return unmarshalFixed64Value
- case "varint":
- if pointer {
- return unmarshalUint64Ptr
- }
- if slice {
- return unmarshalUint64Slice
- }
- return unmarshalUint64Value
- }
- case reflect.Float32:
- if pointer {
- return unmarshalFloat32Ptr
- }
- if slice {
- return unmarshalFloat32Slice
- }
- return unmarshalFloat32Value
- case reflect.Float64:
- if pointer {
- return unmarshalFloat64Ptr
- }
- if slice {
- return unmarshalFloat64Slice
- }
- return unmarshalFloat64Value
- case reflect.Map:
- panic("map type in typeUnmarshaler in " + t.Name())
- case reflect.Slice:
- if pointer {
- panic("bad pointer in slice case in " + t.Name())
- }
- if slice {
- return unmarshalBytesSlice
- }
- return unmarshalBytesValue
- case reflect.String:
- if validateUTF8 {
- if pointer {
- return unmarshalUTF8StringPtr
- }
- if slice {
- return unmarshalUTF8StringSlice
- }
- return unmarshalUTF8StringValue
- }
- if pointer {
- return unmarshalStringPtr
- }
- if slice {
- return unmarshalStringSlice
- }
- return unmarshalStringValue
- case reflect.Struct:
- // message or group field
- if !pointer {
- panic(fmt.Sprintf("message/group field %s:%s without pointer", t, encoding))
- }
- switch encoding {
- case "bytes":
- if slice {
- return makeUnmarshalMessageSlicePtr(getUnmarshalInfo(t), name)
- }
- return makeUnmarshalMessagePtr(getUnmarshalInfo(t), name)
- case "group":
- if slice {
- return makeUnmarshalGroupSlicePtr(getUnmarshalInfo(t), name)
- }
- return makeUnmarshalGroupPtr(getUnmarshalInfo(t), name)
- }
- }
- panic(fmt.Sprintf("unmarshaler not found type:%s encoding:%s", t, encoding))
-}
-
-// Below are all the unmarshalers for individual fields of various types.
-
-func unmarshalInt64Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x)
- *f.toInt64() = v
- return b, nil
-}
-
-func unmarshalInt64Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x)
- *f.toInt64Ptr() = &v
- return b, nil
-}
-
-func unmarshalInt64Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x)
- s := f.toInt64Slice()
- *s = append(*s, v)
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x)
- s := f.toInt64Slice()
- *s = append(*s, v)
- return b, nil
-}
-
-func unmarshalSint64Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x>>1) ^ int64(x)<<63>>63
- *f.toInt64() = v
- return b, nil
-}
-
-func unmarshalSint64Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x>>1) ^ int64(x)<<63>>63
- *f.toInt64Ptr() = &v
- return b, nil
-}
-
-func unmarshalSint64Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x>>1) ^ int64(x)<<63>>63
- s := f.toInt64Slice()
- *s = append(*s, v)
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int64(x>>1) ^ int64(x)<<63>>63
- s := f.toInt64Slice()
- *s = append(*s, v)
- return b, nil
-}
-
-func unmarshalUint64Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint64(x)
- *f.toUint64() = v
- return b, nil
-}
-
-func unmarshalUint64Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint64(x)
- *f.toUint64Ptr() = &v
- return b, nil
-}
-
-func unmarshalUint64Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint64(x)
- s := f.toUint64Slice()
- *s = append(*s, v)
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint64(x)
- s := f.toUint64Slice()
- *s = append(*s, v)
- return b, nil
-}
-
-func unmarshalInt32Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x)
- *f.toInt32() = v
- return b, nil
-}
-
-func unmarshalInt32Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x)
- f.setInt32Ptr(v)
- return b, nil
-}
-
-func unmarshalInt32Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x)
- f.appendInt32Slice(v)
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x)
- f.appendInt32Slice(v)
- return b, nil
-}
-
-func unmarshalSint32Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x>>1) ^ int32(x)<<31>>31
- *f.toInt32() = v
- return b, nil
-}
-
-func unmarshalSint32Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x>>1) ^ int32(x)<<31>>31
- f.setInt32Ptr(v)
- return b, nil
-}
-
-func unmarshalSint32Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x>>1) ^ int32(x)<<31>>31
- f.appendInt32Slice(v)
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := int32(x>>1) ^ int32(x)<<31>>31
- f.appendInt32Slice(v)
- return b, nil
-}
-
-func unmarshalUint32Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint32(x)
- *f.toUint32() = v
- return b, nil
-}
-
-func unmarshalUint32Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint32(x)
- *f.toUint32Ptr() = &v
- return b, nil
-}
-
-func unmarshalUint32Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint32(x)
- s := f.toUint32Slice()
- *s = append(*s, v)
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- v := uint32(x)
- s := f.toUint32Slice()
- *s = append(*s, v)
- return b, nil
-}
-
-func unmarshalFixed64Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
- *f.toUint64() = v
- return b[8:], nil
-}
-
-func unmarshalFixed64Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
- *f.toUint64Ptr() = &v
- return b[8:], nil
-}
-
-func unmarshalFixed64Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
- s := f.toUint64Slice()
- *s = append(*s, v)
- b = b[8:]
- }
- return res, nil
- }
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
- s := f.toUint64Slice()
- *s = append(*s, v)
- return b[8:], nil
-}
-
-func unmarshalFixedS64Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56
- *f.toInt64() = v
- return b[8:], nil
-}
-
-func unmarshalFixedS64Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56
- *f.toInt64Ptr() = &v
- return b[8:], nil
-}
-
-func unmarshalFixedS64Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56
- s := f.toInt64Slice()
- *s = append(*s, v)
- b = b[8:]
- }
- return res, nil
- }
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int64(b[0]) | int64(b[1])<<8 | int64(b[2])<<16 | int64(b[3])<<24 | int64(b[4])<<32 | int64(b[5])<<40 | int64(b[6])<<48 | int64(b[7])<<56
- s := f.toInt64Slice()
- *s = append(*s, v)
- return b[8:], nil
-}
-
-func unmarshalFixed32Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
- *f.toUint32() = v
- return b[4:], nil
-}
-
-func unmarshalFixed32Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
- *f.toUint32Ptr() = &v
- return b[4:], nil
-}
-
-func unmarshalFixed32Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
- s := f.toUint32Slice()
- *s = append(*s, v)
- b = b[4:]
- }
- return res, nil
- }
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
- s := f.toUint32Slice()
- *s = append(*s, v)
- return b[4:], nil
-}
-
-func unmarshalFixedS32Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24
- *f.toInt32() = v
- return b[4:], nil
-}
-
-func unmarshalFixedS32Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24
- f.setInt32Ptr(v)
- return b[4:], nil
-}
-
-func unmarshalFixedS32Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24
- f.appendInt32Slice(v)
- b = b[4:]
- }
- return res, nil
- }
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24
- f.appendInt32Slice(v)
- return b[4:], nil
-}
-
-func unmarshalBoolValue(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- // Note: any length varint is allowed, even though any sane
- // encoder will use one byte.
- // See https://github.com/golang/protobuf/issues/76
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- // TODO: check if x>1? Tests seem to indicate no.
- v := x != 0
- *f.toBool() = v
- return b[n:], nil
-}
-
-func unmarshalBoolPtr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- v := x != 0
- *f.toBoolPtr() = &v
- return b[n:], nil
-}
-
-func unmarshalBoolSlice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- x, n = decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- v := x != 0
- s := f.toBoolSlice()
- *s = append(*s, v)
- b = b[n:]
- }
- return res, nil
- }
- if w != WireVarint {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- v := x != 0
- s := f.toBoolSlice()
- *s = append(*s, v)
- return b[n:], nil
-}
-
-func unmarshalFloat64Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56)
- *f.toFloat64() = v
- return b[8:], nil
-}
-
-func unmarshalFloat64Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56)
- *f.toFloat64Ptr() = &v
- return b[8:], nil
-}
-
-func unmarshalFloat64Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56)
- s := f.toFloat64Slice()
- *s = append(*s, v)
- b = b[8:]
- }
- return res, nil
- }
- if w != WireFixed64 {
- return b, errInternalBadWireType
- }
- if len(b) < 8 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float64frombits(uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56)
- s := f.toFloat64Slice()
- *s = append(*s, v)
- return b[8:], nil
-}
-
-func unmarshalFloat32Value(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24)
- *f.toFloat32() = v
- return b[4:], nil
-}
-
-func unmarshalFloat32Ptr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24)
- *f.toFloat32Ptr() = &v
- return b[4:], nil
-}
-
-func unmarshalFloat32Slice(b []byte, f pointer, w int) ([]byte, error) {
- if w == WireBytes { // packed
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- res := b[x:]
- b = b[:x]
- for len(b) > 0 {
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24)
- s := f.toFloat32Slice()
- *s = append(*s, v)
- b = b[4:]
- }
- return res, nil
- }
- if w != WireFixed32 {
- return b, errInternalBadWireType
- }
- if len(b) < 4 {
- return nil, io.ErrUnexpectedEOF
- }
- v := math.Float32frombits(uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24)
- s := f.toFloat32Slice()
- *s = append(*s, v)
- return b[4:], nil
-}
-
-func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := string(b[:x])
- *f.toString() = v
- return b[x:], nil
-}
-
-func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := string(b[:x])
- *f.toStringPtr() = &v
- return b[x:], nil
-}
-
-func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := string(b[:x])
- s := f.toStringSlice()
- *s = append(*s, v)
- return b[x:], nil
-}
-
-func unmarshalUTF8StringValue(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := string(b[:x])
- *f.toString() = v
- if !utf8.ValidString(v) {
- return b[x:], errInvalidUTF8
- }
- return b[x:], nil
-}
-
-func unmarshalUTF8StringPtr(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := string(b[:x])
- *f.toStringPtr() = &v
- if !utf8.ValidString(v) {
- return b[x:], errInvalidUTF8
- }
- return b[x:], nil
-}
-
-func unmarshalUTF8StringSlice(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := string(b[:x])
- s := f.toStringSlice()
- *s = append(*s, v)
- if !utf8.ValidString(v) {
- return b[x:], errInvalidUTF8
- }
- return b[x:], nil
-}
-
-var emptyBuf [0]byte
-
-func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- // The use of append here is a trick which avoids the zeroing
- // that would be required if we used a make/copy pair.
- // We append to emptyBuf instead of nil because we want
- // a non-nil result even when the length is 0.
- v := append(emptyBuf[:], b[:x]...)
- *f.toBytes() = v
- return b[x:], nil
-}
-
-func unmarshalBytesSlice(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := append(emptyBuf[:], b[:x]...)
- s := f.toBytesSlice()
- *s = append(*s, v)
- return b[x:], nil
-}
-
-func makeUnmarshalMessagePtr(sub *unmarshalInfo, name string) unmarshaler {
- return func(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- // First read the message field to see if something is there.
- // The semantics of multiple submessages are weird. Instead of
- // the last one winning (as it is for all other fields), multiple
- // submessages are merged.
- v := f.getPointer()
- if v.isNil() {
- v = valToPointer(reflect.New(sub.typ))
- f.setPointer(v)
- }
- err := sub.unmarshal(v, b[:x])
- if err != nil {
- if r, ok := err.(*RequiredNotSetError); ok {
- r.field = name + "." + r.field
- } else {
- return nil, err
- }
- }
- return b[x:], err
- }
-}
-
-func makeUnmarshalMessageSlicePtr(sub *unmarshalInfo, name string) unmarshaler {
- return func(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireBytes {
- return b, errInternalBadWireType
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- v := valToPointer(reflect.New(sub.typ))
- err := sub.unmarshal(v, b[:x])
- if err != nil {
- if r, ok := err.(*RequiredNotSetError); ok {
- r.field = name + "." + r.field
- } else {
- return nil, err
- }
- }
- f.appendPointer(v)
- return b[x:], err
- }
-}
-
-func makeUnmarshalGroupPtr(sub *unmarshalInfo, name string) unmarshaler {
- return func(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireStartGroup {
- return b, errInternalBadWireType
- }
- x, y := findEndGroup(b)
- if x < 0 {
- return nil, io.ErrUnexpectedEOF
- }
- v := f.getPointer()
- if v.isNil() {
- v = valToPointer(reflect.New(sub.typ))
- f.setPointer(v)
- }
- err := sub.unmarshal(v, b[:x])
- if err != nil {
- if r, ok := err.(*RequiredNotSetError); ok {
- r.field = name + "." + r.field
- } else {
- return nil, err
- }
- }
- return b[y:], err
- }
-}
-
-func makeUnmarshalGroupSlicePtr(sub *unmarshalInfo, name string) unmarshaler {
- return func(b []byte, f pointer, w int) ([]byte, error) {
- if w != WireStartGroup {
- return b, errInternalBadWireType
- }
- x, y := findEndGroup(b)
- if x < 0 {
- return nil, io.ErrUnexpectedEOF
- }
- v := valToPointer(reflect.New(sub.typ))
- err := sub.unmarshal(v, b[:x])
- if err != nil {
- if r, ok := err.(*RequiredNotSetError); ok {
- r.field = name + "." + r.field
- } else {
- return nil, err
- }
- }
- f.appendPointer(v)
- return b[y:], err
- }
-}
-
-func makeUnmarshalMap(f *reflect.StructField) unmarshaler {
- t := f.Type
- kt := t.Key()
- vt := t.Elem()
- unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key"))
- unmarshalVal := typeUnmarshaler(vt, f.Tag.Get("protobuf_val"))
- return func(b []byte, f pointer, w int) ([]byte, error) {
- // The map entry is a submessage. Figure out how big it is.
- if w != WireBytes {
- return nil, fmt.Errorf("proto: bad wiretype for map field: got %d want %d", w, WireBytes)
- }
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- b = b[n:]
- if x > uint64(len(b)) {
- return nil, io.ErrUnexpectedEOF
- }
- r := b[x:] // unused data to return
- b = b[:x] // data for map entry
-
- // Note: we could use #keys * #values ~= 200 functions
- // to do map decoding without reflection. Probably not worth it.
- // Maps will be somewhat slow. Oh well.
-
- // Read key and value from data.
- var nerr nonFatal
- k := reflect.New(kt)
- v := reflect.New(vt)
- for len(b) > 0 {
- x, n := decodeVarint(b)
- if n == 0 {
- return nil, io.ErrUnexpectedEOF
- }
- wire := int(x) & 7
- b = b[n:]
-
- var err error
- switch x >> 3 {
- case 1:
- b, err = unmarshalKey(b, valToPointer(k), wire)
- case 2:
- b, err = unmarshalVal(b, valToPointer(v), wire)
- default:
- err = errInternalBadWireType // skip unknown tag
- }
-
- if nerr.Merge(err) {
- continue
- }
- if err != errInternalBadWireType {
- return nil, err
- }
-
- // Skip past unknown fields.
- b, err = skipField(b, wire)
- if err != nil {
- return nil, err
- }
- }
-
- // Get map, allocate if needed.
- m := f.asPointerTo(t).Elem() // an addressable map[K]T
- if m.IsNil() {
- m.Set(reflect.MakeMap(t))
- }
-
- // Insert into map.
- m.SetMapIndex(k.Elem(), v.Elem())
-
- return r, nerr.E
- }
-}
-
-// makeUnmarshalOneof makes an unmarshaler for oneof fields.
-// for:
-// message Msg {
-// oneof F {
-// int64 X = 1;
-// float64 Y = 2;
-// }
-// }
-// typ is the type of the concrete entry for a oneof case (e.g. Msg_X).
-// ityp is the interface type of the oneof field (e.g. isMsg_F).
-// unmarshal is the unmarshaler for the base type of the oneof case (e.g. int64).
-// Note that this function will be called once for each case in the oneof.
-func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshaler {
- sf := typ.Field(0)
- field0 := toField(&sf)
- return func(b []byte, f pointer, w int) ([]byte, error) {
- // Allocate holder for value.
- v := reflect.New(typ)
-
- // Unmarshal data into holder.
- // We unmarshal into the first field of the holder object.
- var err error
- var nerr nonFatal
- b, err = unmarshal(b, valToPointer(v).offset(field0), w)
- if !nerr.Merge(err) {
- return nil, err
- }
-
- // Write pointer to holder into target field.
- f.asPointerTo(ityp).Elem().Set(v)
-
- return b, nerr.E
- }
-}
-
-// Error used by decode internally.
-var errInternalBadWireType = errors.New("proto: internal error: bad wiretype")
-
-// skipField skips past a field of type wire and returns the remaining bytes.
-func skipField(b []byte, wire int) ([]byte, error) {
- switch wire {
- case WireVarint:
- _, k := decodeVarint(b)
- if k == 0 {
- return b, io.ErrUnexpectedEOF
- }
- b = b[k:]
- case WireFixed32:
- if len(b) < 4 {
- return b, io.ErrUnexpectedEOF
- }
- b = b[4:]
- case WireFixed64:
- if len(b) < 8 {
- return b, io.ErrUnexpectedEOF
- }
- b = b[8:]
- case WireBytes:
- m, k := decodeVarint(b)
- if k == 0 || uint64(len(b)-k) < m {
- return b, io.ErrUnexpectedEOF
- }
- b = b[uint64(k)+m:]
- case WireStartGroup:
- _, i := findEndGroup(b)
- if i == -1 {
- return b, io.ErrUnexpectedEOF
- }
- b = b[i:]
- default:
- return b, fmt.Errorf("proto: can't skip unknown wire type %d", wire)
- }
- return b, nil
-}
-
-// findEndGroup finds the index of the next EndGroup tag.
-// Groups may be nested, so the "next" EndGroup tag is the first
-// unpaired EndGroup.
-// findEndGroup returns the indexes of the start and end of the EndGroup tag.
-// Returns (-1,-1) if it can't find one.
-func findEndGroup(b []byte) (int, int) {
- depth := 1
- i := 0
- for {
- x, n := decodeVarint(b[i:])
- if n == 0 {
- return -1, -1
- }
- j := i
- i += n
- switch x & 7 {
- case WireVarint:
- _, k := decodeVarint(b[i:])
- if k == 0 {
- return -1, -1
- }
- i += k
- case WireFixed32:
- if len(b)-4 < i {
- return -1, -1
- }
- i += 4
- case WireFixed64:
- if len(b)-8 < i {
- return -1, -1
- }
- i += 8
- case WireBytes:
- m, k := decodeVarint(b[i:])
- if k == 0 {
- return -1, -1
- }
- i += k
- if uint64(len(b)-i) < m {
- return -1, -1
- }
- i += int(m)
- case WireStartGroup:
- depth++
- case WireEndGroup:
- depth--
- if depth == 0 {
- return j, i
- }
- default:
- return -1, -1
- }
- }
-}
-
-// encodeVarint appends a varint-encoded integer to b and returns the result.
-func encodeVarint(b []byte, x uint64) []byte {
- for x >= 1<<7 {
- b = append(b, byte(x&0x7f|0x80))
- x >>= 7
- }
- return append(b, byte(x))
-}
-
-// decodeVarint reads a varint-encoded integer from b.
-// Returns the decoded integer and the number of bytes read.
-// If there is an error, it returns 0,0.
-func decodeVarint(b []byte) (uint64, int) {
- var x, y uint64
- if len(b) <= 0 {
- goto bad
- }
- x = uint64(b[0])
- if x < 0x80 {
- return x, 1
- }
- x -= 0x80
-
- if len(b) <= 1 {
- goto bad
- }
- y = uint64(b[1])
- x += y << 7
- if y < 0x80 {
- return x, 2
- }
- x -= 0x80 << 7
-
- if len(b) <= 2 {
- goto bad
- }
- y = uint64(b[2])
- x += y << 14
- if y < 0x80 {
- return x, 3
- }
- x -= 0x80 << 14
-
- if len(b) <= 3 {
- goto bad
- }
- y = uint64(b[3])
- x += y << 21
- if y < 0x80 {
- return x, 4
- }
- x -= 0x80 << 21
-
- if len(b) <= 4 {
- goto bad
- }
- y = uint64(b[4])
- x += y << 28
- if y < 0x80 {
- return x, 5
- }
- x -= 0x80 << 28
-
- if len(b) <= 5 {
- goto bad
- }
- y = uint64(b[5])
- x += y << 35
- if y < 0x80 {
- return x, 6
- }
- x -= 0x80 << 35
-
- if len(b) <= 6 {
- goto bad
- }
- y = uint64(b[6])
- x += y << 42
- if y < 0x80 {
- return x, 7
- }
- x -= 0x80 << 42
-
- if len(b) <= 7 {
- goto bad
- }
- y = uint64(b[7])
- x += y << 49
- if y < 0x80 {
- return x, 8
- }
- x -= 0x80 << 49
-
- if len(b) <= 8 {
- goto bad
- }
- y = uint64(b[8])
- x += y << 56
- if y < 0x80 {
- return x, 9
- }
- x -= 0x80 << 56
-
- if len(b) <= 9 {
- goto bad
- }
- y = uint64(b[9])
- x += y << 63
- if y < 2 {
- return x, 10
- }
-
-bad:
- return 0, 0
-}
diff --git a/vendor/github.com/golang/protobuf/proto/text.go b/vendor/github.com/golang/protobuf/proto/text.go
deleted file mode 100644
index 1aaee725b45b3e141a710273ec098ec601a71ecd..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/text.go
+++ /dev/null
@@ -1,843 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-// Functions for writing the text protocol buffer format.
-
-import (
- "bufio"
- "bytes"
- "encoding"
- "errors"
- "fmt"
- "io"
- "log"
- "math"
- "reflect"
- "sort"
- "strings"
-)
-
-var (
- newline = []byte("\n")
- spaces = []byte(" ")
- endBraceNewline = []byte("}\n")
- backslashN = []byte{'\\', 'n'}
- backslashR = []byte{'\\', 'r'}
- backslashT = []byte{'\\', 't'}
- backslashDQ = []byte{'\\', '"'}
- backslashBS = []byte{'\\', '\\'}
- posInf = []byte("inf")
- negInf = []byte("-inf")
- nan = []byte("nan")
-)
-
-type writer interface {
- io.Writer
- WriteByte(byte) error
-}
-
-// textWriter is an io.Writer that tracks its indentation level.
-type textWriter struct {
- ind int
- complete bool // if the current position is a complete line
- compact bool // whether to write out as a one-liner
- w writer
-}
-
-func (w *textWriter) WriteString(s string) (n int, err error) {
- if !strings.Contains(s, "\n") {
- if !w.compact && w.complete {
- w.writeIndent()
- }
- w.complete = false
- return io.WriteString(w.w, s)
- }
- // WriteString is typically called without newlines, so this
- // codepath and its copy are rare. We copy to avoid
- // duplicating all of Write's logic here.
- return w.Write([]byte(s))
-}
-
-func (w *textWriter) Write(p []byte) (n int, err error) {
- newlines := bytes.Count(p, newline)
- if newlines == 0 {
- if !w.compact && w.complete {
- w.writeIndent()
- }
- n, err = w.w.Write(p)
- w.complete = false
- return n, err
- }
-
- frags := bytes.SplitN(p, newline, newlines+1)
- if w.compact {
- for i, frag := range frags {
- if i > 0 {
- if err := w.w.WriteByte(' '); err != nil {
- return n, err
- }
- n++
- }
- nn, err := w.w.Write(frag)
- n += nn
- if err != nil {
- return n, err
- }
- }
- return n, nil
- }
-
- for i, frag := range frags {
- if w.complete {
- w.writeIndent()
- }
- nn, err := w.w.Write(frag)
- n += nn
- if err != nil {
- return n, err
- }
- if i+1 < len(frags) {
- if err := w.w.WriteByte('\n'); err != nil {
- return n, err
- }
- n++
- }
- }
- w.complete = len(frags[len(frags)-1]) == 0
- return n, nil
-}
-
-func (w *textWriter) WriteByte(c byte) error {
- if w.compact && c == '\n' {
- c = ' '
- }
- if !w.compact && w.complete {
- w.writeIndent()
- }
- err := w.w.WriteByte(c)
- w.complete = c == '\n'
- return err
-}
-
-func (w *textWriter) indent() { w.ind++ }
-
-func (w *textWriter) unindent() {
- if w.ind == 0 {
- log.Print("proto: textWriter unindented too far")
- return
- }
- w.ind--
-}
-
-func writeName(w *textWriter, props *Properties) error {
- if _, err := w.WriteString(props.OrigName); err != nil {
- return err
- }
- if props.Wire != "group" {
- return w.WriteByte(':')
- }
- return nil
-}
-
-func requiresQuotes(u string) bool {
- // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted.
- for _, ch := range u {
- switch {
- case ch == '.' || ch == '/' || ch == '_':
- continue
- case '0' <= ch && ch <= '9':
- continue
- case 'A' <= ch && ch <= 'Z':
- continue
- case 'a' <= ch && ch <= 'z':
- continue
- default:
- return true
- }
- }
- return false
-}
-
-// isAny reports whether sv is a google.protobuf.Any message
-func isAny(sv reflect.Value) bool {
- type wkt interface {
- XXX_WellKnownType() string
- }
- t, ok := sv.Addr().Interface().(wkt)
- return ok && t.XXX_WellKnownType() == "Any"
-}
-
-// writeProto3Any writes an expanded google.protobuf.Any message.
-//
-// It returns (false, nil) if sv value can't be unmarshaled (e.g. because
-// required messages are not linked in).
-//
-// It returns (true, error) when sv was written in expanded format or an error
-// was encountered.
-func (tm *TextMarshaler) writeProto3Any(w *textWriter, sv reflect.Value) (bool, error) {
- turl := sv.FieldByName("TypeUrl")
- val := sv.FieldByName("Value")
- if !turl.IsValid() || !val.IsValid() {
- return true, errors.New("proto: invalid google.protobuf.Any message")
- }
-
- b, ok := val.Interface().([]byte)
- if !ok {
- return true, errors.New("proto: invalid google.protobuf.Any message")
- }
-
- parts := strings.Split(turl.String(), "/")
- mt := MessageType(parts[len(parts)-1])
- if mt == nil {
- return false, nil
- }
- m := reflect.New(mt.Elem())
- if err := Unmarshal(b, m.Interface().(Message)); err != nil {
- return false, nil
- }
- w.Write([]byte("["))
- u := turl.String()
- if requiresQuotes(u) {
- writeString(w, u)
- } else {
- w.Write([]byte(u))
- }
- if w.compact {
- w.Write([]byte("]:<"))
- } else {
- w.Write([]byte("]: <\n"))
- w.ind++
- }
- if err := tm.writeStruct(w, m.Elem()); err != nil {
- return true, err
- }
- if w.compact {
- w.Write([]byte("> "))
- } else {
- w.ind--
- w.Write([]byte(">\n"))
- }
- return true, nil
-}
-
-func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error {
- if tm.ExpandAny && isAny(sv) {
- if canExpand, err := tm.writeProto3Any(w, sv); canExpand {
- return err
- }
- }
- st := sv.Type()
- sprops := GetProperties(st)
- for i := 0; i < sv.NumField(); i++ {
- fv := sv.Field(i)
- props := sprops.Prop[i]
- name := st.Field(i).Name
-
- if name == "XXX_NoUnkeyedLiteral" {
- continue
- }
-
- if strings.HasPrefix(name, "XXX_") {
- // There are two XXX_ fields:
- // XXX_unrecognized []byte
- // XXX_extensions map[int32]proto.Extension
- // The first is handled here;
- // the second is handled at the bottom of this function.
- if name == "XXX_unrecognized" && !fv.IsNil() {
- if err := writeUnknownStruct(w, fv.Interface().([]byte)); err != nil {
- return err
- }
- }
- continue
- }
- if fv.Kind() == reflect.Ptr && fv.IsNil() {
- // Field not filled in. This could be an optional field or
- // a required field that wasn't filled in. Either way, there
- // isn't anything we can show for it.
- continue
- }
- if fv.Kind() == reflect.Slice && fv.IsNil() {
- // Repeated field that is empty, or a bytes field that is unused.
- continue
- }
-
- if props.Repeated && fv.Kind() == reflect.Slice {
- // Repeated field.
- for j := 0; j < fv.Len(); j++ {
- if err := writeName(w, props); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- v := fv.Index(j)
- if v.Kind() == reflect.Ptr && v.IsNil() {
- // A nil message in a repeated field is not valid,
- // but we can handle that more gracefully than panicking.
- if _, err := w.Write([]byte("\n")); err != nil {
- return err
- }
- continue
- }
- if err := tm.writeAny(w, v, props); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- continue
- }
- if fv.Kind() == reflect.Map {
- // Map fields are rendered as a repeated struct with key/value fields.
- keys := fv.MapKeys()
- sort.Sort(mapKeys(keys))
- for _, key := range keys {
- val := fv.MapIndex(key)
- if err := writeName(w, props); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- // open struct
- if err := w.WriteByte('<'); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- w.indent()
- // key
- if _, err := w.WriteString("key:"); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if err := tm.writeAny(w, key, props.MapKeyProp); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- // nil values aren't legal, but we can avoid panicking because of them.
- if val.Kind() != reflect.Ptr || !val.IsNil() {
- // value
- if _, err := w.WriteString("value:"); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if err := tm.writeAny(w, val, props.MapValProp); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- // close struct
- w.unindent()
- if err := w.WriteByte('>'); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- continue
- }
- if props.proto3 && fv.Kind() == reflect.Slice && fv.Len() == 0 {
- // empty bytes field
- continue
- }
- if fv.Kind() != reflect.Ptr && fv.Kind() != reflect.Slice {
- // proto3 non-repeated scalar field; skip if zero value
- if isProto3Zero(fv) {
- continue
- }
- }
-
- if fv.Kind() == reflect.Interface {
- // Check if it is a oneof.
- if st.Field(i).Tag.Get("protobuf_oneof") != "" {
- // fv is nil, or holds a pointer to generated struct.
- // That generated struct has exactly one field,
- // which has a protobuf struct tag.
- if fv.IsNil() {
- continue
- }
- inner := fv.Elem().Elem() // interface -> *T -> T
- tag := inner.Type().Field(0).Tag.Get("protobuf")
- props = new(Properties) // Overwrite the outer props var, but not its pointee.
- props.Parse(tag)
- // Write the value in the oneof, not the oneof itself.
- fv = inner.Field(0)
-
- // Special case to cope with malformed messages gracefully:
- // If the value in the oneof is a nil pointer, don't panic
- // in writeAny.
- if fv.Kind() == reflect.Ptr && fv.IsNil() {
- // Use errors.New so writeAny won't render quotes.
- msg := errors.New("/* nil */")
- fv = reflect.ValueOf(&msg).Elem()
- }
- }
- }
-
- if err := writeName(w, props); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
-
- // Enums have a String method, so writeAny will work fine.
- if err := tm.writeAny(w, fv, props); err != nil {
- return err
- }
-
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
-
- // Extensions (the XXX_extensions field).
- pv := sv.Addr()
- if _, err := extendable(pv.Interface()); err == nil {
- if err := tm.writeExtensions(w, pv); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// writeAny writes an arbitrary field.
-func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error {
- v = reflect.Indirect(v)
-
- // Floats have special cases.
- if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 {
- x := v.Float()
- var b []byte
- switch {
- case math.IsInf(x, 1):
- b = posInf
- case math.IsInf(x, -1):
- b = negInf
- case math.IsNaN(x):
- b = nan
- }
- if b != nil {
- _, err := w.Write(b)
- return err
- }
- // Other values are handled below.
- }
-
- // We don't attempt to serialise every possible value type; only those
- // that can occur in protocol buffers.
- switch v.Kind() {
- case reflect.Slice:
- // Should only be a []byte; repeated fields are handled in writeStruct.
- if err := writeString(w, string(v.Bytes())); err != nil {
- return err
- }
- case reflect.String:
- if err := writeString(w, v.String()); err != nil {
- return err
- }
- case reflect.Struct:
- // Required/optional group/message.
- var bra, ket byte = '<', '>'
- if props != nil && props.Wire == "group" {
- bra, ket = '{', '}'
- }
- if err := w.WriteByte(bra); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- }
- w.indent()
- if v.CanAddr() {
- // Calling v.Interface on a struct causes the reflect package to
- // copy the entire struct. This is racy with the new Marshaler
- // since we atomically update the XXX_sizecache.
- //
- // Thus, we retrieve a pointer to the struct if possible to avoid
- // a race since v.Interface on the pointer doesn't copy the struct.
- //
- // If v is not addressable, then we are not worried about a race
- // since it implies that the binary Marshaler cannot possibly be
- // mutating this value.
- v = v.Addr()
- }
- if etm, ok := v.Interface().(encoding.TextMarshaler); ok {
- text, err := etm.MarshalText()
- if err != nil {
- return err
- }
- if _, err = w.Write(text); err != nil {
- return err
- }
- } else {
- if v.Kind() == reflect.Ptr {
- v = v.Elem()
- }
- if err := tm.writeStruct(w, v); err != nil {
- return err
- }
- }
- w.unindent()
- if err := w.WriteByte(ket); err != nil {
- return err
- }
- default:
- _, err := fmt.Fprint(w, v.Interface())
- return err
- }
- return nil
-}
-
-// equivalent to C's isprint.
-func isprint(c byte) bool {
- return c >= 0x20 && c < 0x7f
-}
-
-// writeString writes a string in the protocol buffer text format.
-// It is similar to strconv.Quote except we don't use Go escape sequences,
-// we treat the string as a byte sequence, and we use octal escapes.
-// These differences are to maintain interoperability with the other
-// languages' implementations of the text format.
-func writeString(w *textWriter, s string) error {
- // use WriteByte here to get any needed indent
- if err := w.WriteByte('"'); err != nil {
- return err
- }
- // Loop over the bytes, not the runes.
- for i := 0; i < len(s); i++ {
- var err error
- // Divergence from C++: we don't escape apostrophes.
- // There's no need to escape them, and the C++ parser
- // copes with a naked apostrophe.
- switch c := s[i]; c {
- case '\n':
- _, err = w.w.Write(backslashN)
- case '\r':
- _, err = w.w.Write(backslashR)
- case '\t':
- _, err = w.w.Write(backslashT)
- case '"':
- _, err = w.w.Write(backslashDQ)
- case '\\':
- _, err = w.w.Write(backslashBS)
- default:
- if isprint(c) {
- err = w.w.WriteByte(c)
- } else {
- _, err = fmt.Fprintf(w.w, "\\%03o", c)
- }
- }
- if err != nil {
- return err
- }
- }
- return w.WriteByte('"')
-}
-
-func writeUnknownStruct(w *textWriter, data []byte) (err error) {
- if !w.compact {
- if _, err := fmt.Fprintf(w, "/* %d unknown bytes */\n", len(data)); err != nil {
- return err
- }
- }
- b := NewBuffer(data)
- for b.index < len(b.buf) {
- x, err := b.DecodeVarint()
- if err != nil {
- _, err := fmt.Fprintf(w, "/* %v */\n", err)
- return err
- }
- wire, tag := x&7, x>>3
- if wire == WireEndGroup {
- w.unindent()
- if _, err := w.Write(endBraceNewline); err != nil {
- return err
- }
- continue
- }
- if _, err := fmt.Fprint(w, tag); err != nil {
- return err
- }
- if wire != WireStartGroup {
- if err := w.WriteByte(':'); err != nil {
- return err
- }
- }
- if !w.compact || wire == WireStartGroup {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- switch wire {
- case WireBytes:
- buf, e := b.DecodeRawBytes(false)
- if e == nil {
- _, err = fmt.Fprintf(w, "%q", buf)
- } else {
- _, err = fmt.Fprintf(w, "/* %v */", e)
- }
- case WireFixed32:
- x, err = b.DecodeFixed32()
- err = writeUnknownInt(w, x, err)
- case WireFixed64:
- x, err = b.DecodeFixed64()
- err = writeUnknownInt(w, x, err)
- case WireStartGroup:
- err = w.WriteByte('{')
- w.indent()
- case WireVarint:
- x, err = b.DecodeVarint()
- err = writeUnknownInt(w, x, err)
- default:
- _, err = fmt.Fprintf(w, "/* unknown wire type %d */", wire)
- }
- if err != nil {
- return err
- }
- if err = w.WriteByte('\n'); err != nil {
- return err
- }
- }
- return nil
-}
-
-func writeUnknownInt(w *textWriter, x uint64, err error) error {
- if err == nil {
- _, err = fmt.Fprint(w, x)
- } else {
- _, err = fmt.Fprintf(w, "/* %v */", err)
- }
- return err
-}
-
-type int32Slice []int32
-
-func (s int32Slice) Len() int { return len(s) }
-func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] }
-func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
-// writeExtensions writes all the extensions in pv.
-// pv is assumed to be a pointer to a protocol message struct that is extendable.
-func (tm *TextMarshaler) writeExtensions(w *textWriter, pv reflect.Value) error {
- emap := extensionMaps[pv.Type().Elem()]
- ep, _ := extendable(pv.Interface())
-
- // Order the extensions by ID.
- // This isn't strictly necessary, but it will give us
- // canonical output, which will also make testing easier.
- m, mu := ep.extensionsRead()
- if m == nil {
- return nil
- }
- mu.Lock()
- ids := make([]int32, 0, len(m))
- for id := range m {
- ids = append(ids, id)
- }
- sort.Sort(int32Slice(ids))
- mu.Unlock()
-
- for _, extNum := range ids {
- ext := m[extNum]
- var desc *ExtensionDesc
- if emap != nil {
- desc = emap[extNum]
- }
- if desc == nil {
- // Unknown extension.
- if err := writeUnknownStruct(w, ext.enc); err != nil {
- return err
- }
- continue
- }
-
- pb, err := GetExtension(ep, desc)
- if err != nil {
- return fmt.Errorf("failed getting extension: %v", err)
- }
-
- // Repeated extensions will appear as a slice.
- if !desc.repeated() {
- if err := tm.writeExtension(w, desc.Name, pb); err != nil {
- return err
- }
- } else {
- v := reflect.ValueOf(pb)
- for i := 0; i < v.Len(); i++ {
- if err := tm.writeExtension(w, desc.Name, v.Index(i).Interface()); err != nil {
- return err
- }
- }
- }
- }
- return nil
-}
-
-func (tm *TextMarshaler) writeExtension(w *textWriter, name string, pb interface{}) error {
- if _, err := fmt.Fprintf(w, "[%s]:", name); err != nil {
- return err
- }
- if !w.compact {
- if err := w.WriteByte(' '); err != nil {
- return err
- }
- }
- if err := tm.writeAny(w, reflect.ValueOf(pb), nil); err != nil {
- return err
- }
- if err := w.WriteByte('\n'); err != nil {
- return err
- }
- return nil
-}
-
-func (w *textWriter) writeIndent() {
- if !w.complete {
- return
- }
- remain := w.ind * 2
- for remain > 0 {
- n := remain
- if n > len(spaces) {
- n = len(spaces)
- }
- w.w.Write(spaces[:n])
- remain -= n
- }
- w.complete = false
-}
-
-// TextMarshaler is a configurable text format marshaler.
-type TextMarshaler struct {
- Compact bool // use compact text format (one line).
- ExpandAny bool // expand google.protobuf.Any messages of known types
-}
-
-// Marshal writes a given protocol buffer in text format.
-// The only errors returned are from w.
-func (tm *TextMarshaler) Marshal(w io.Writer, pb Message) error {
- val := reflect.ValueOf(pb)
- if pb == nil || val.IsNil() {
- w.Write([]byte(""))
- return nil
- }
- var bw *bufio.Writer
- ww, ok := w.(writer)
- if !ok {
- bw = bufio.NewWriter(w)
- ww = bw
- }
- aw := &textWriter{
- w: ww,
- complete: true,
- compact: tm.Compact,
- }
-
- if etm, ok := pb.(encoding.TextMarshaler); ok {
- text, err := etm.MarshalText()
- if err != nil {
- return err
- }
- if _, err = aw.Write(text); err != nil {
- return err
- }
- if bw != nil {
- return bw.Flush()
- }
- return nil
- }
- // Dereference the received pointer so we don't have outer < and >.
- v := reflect.Indirect(val)
- if err := tm.writeStruct(aw, v); err != nil {
- return err
- }
- if bw != nil {
- return bw.Flush()
- }
- return nil
-}
-
-// Text is the same as Marshal, but returns the string directly.
-func (tm *TextMarshaler) Text(pb Message) string {
- var buf bytes.Buffer
- tm.Marshal(&buf, pb)
- return buf.String()
-}
-
-var (
- defaultTextMarshaler = TextMarshaler{}
- compactTextMarshaler = TextMarshaler{Compact: true}
-)
-
-// TODO: consider removing some of the Marshal functions below.
-
-// MarshalText writes a given protocol buffer in text format.
-// The only errors returned are from w.
-func MarshalText(w io.Writer, pb Message) error { return defaultTextMarshaler.Marshal(w, pb) }
-
-// MarshalTextString is the same as MarshalText, but returns the string directly.
-func MarshalTextString(pb Message) string { return defaultTextMarshaler.Text(pb) }
-
-// CompactText writes a given protocol buffer in compact text format (one line).
-func CompactText(w io.Writer, pb Message) error { return compactTextMarshaler.Marshal(w, pb) }
-
-// CompactTextString is the same as CompactText, but returns the string directly.
-func CompactTextString(pb Message) string { return compactTextMarshaler.Text(pb) }
diff --git a/vendor/github.com/golang/protobuf/proto/text_parser.go b/vendor/github.com/golang/protobuf/proto/text_parser.go
deleted file mode 100644
index bb55a3af276941639621b1e591ce1b8304afcd41..0000000000000000000000000000000000000000
--- a/vendor/github.com/golang/protobuf/proto/text_parser.go
+++ /dev/null
@@ -1,880 +0,0 @@
-// Go support for Protocol Buffers - Google's data interchange format
-//
-// Copyright 2010 The Go Authors. All rights reserved.
-// https://github.com/golang/protobuf
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// 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
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-package proto
-
-// Functions for parsing the Text protocol buffer format.
-// TODO: message sets.
-
-import (
- "encoding"
- "errors"
- "fmt"
- "reflect"
- "strconv"
- "strings"
- "unicode/utf8"
-)
-
-// Error string emitted when deserializing Any and fields are already set
-const anyRepeatedlyUnpacked = "Any message unpacked multiple times, or %q already set"
-
-type ParseError struct {
- Message string
- Line int // 1-based line number
- Offset int // 0-based byte offset from start of input
-}
-
-func (p *ParseError) Error() string {
- if p.Line == 1 {
- // show offset only for first line
- return fmt.Sprintf("line 1.%d: %v", p.Offset, p.Message)
- }
- return fmt.Sprintf("line %d: %v", p.Line, p.Message)
-}
-
-type token struct {
- value string
- err *ParseError
- line int // line number
- offset int // byte number from start of input, not start of line
- unquoted string // the unquoted version of value, if it was a quoted string
-}
-
-func (t *token) String() string {
- if t.err == nil {
- return fmt.Sprintf("%q (line=%d, offset=%d)", t.value, t.line, t.offset)
- }
- return fmt.Sprintf("parse error: %v", t.err)
-}
-
-type textParser struct {
- s string // remaining input
- done bool // whether the parsing is finished (success or error)
- backed bool // whether back() was called
- offset, line int
- cur token
-}
-
-func newTextParser(s string) *textParser {
- p := new(textParser)
- p.s = s
- p.line = 1
- p.cur.line = 1
- return p
-}
-
-func (p *textParser) errorf(format string, a ...interface{}) *ParseError {
- pe := &ParseError{fmt.Sprintf(format, a...), p.cur.line, p.cur.offset}
- p.cur.err = pe
- p.done = true
- return pe
-}
-
-// Numbers and identifiers are matched by [-+._A-Za-z0-9]
-func isIdentOrNumberChar(c byte) bool {
- switch {
- case 'A' <= c && c <= 'Z', 'a' <= c && c <= 'z':
- return true
- case '0' <= c && c <= '9':
- return true
- }
- switch c {
- case '-', '+', '.', '_':
- return true
- }
- return false
-}
-
-func isWhitespace(c byte) bool {
- switch c {
- case ' ', '\t', '\n', '\r':
- return true
- }
- return false
-}
-
-func isQuote(c byte) bool {
- switch c {
- case '"', '\'':
- return true
- }
- return false
-}
-
-func (p *textParser) skipWhitespace() {
- i := 0
- for i < len(p.s) && (isWhitespace(p.s[i]) || p.s[i] == '#') {
- if p.s[i] == '#' {
- // comment; skip to end of line or input
- for i < len(p.s) && p.s[i] != '\n' {
- i++
- }
- if i == len(p.s) {
- break
- }
- }
- if p.s[i] == '\n' {
- p.line++
- }
- i++
- }
- p.offset += i
- p.s = p.s[i:len(p.s)]
- if len(p.s) == 0 {
- p.done = true
- }
-}
-
-func (p *textParser) advance() {
- // Skip whitespace
- p.skipWhitespace()
- if p.done {
- return
- }
-
- // Start of non-whitespace
- p.cur.err = nil
- p.cur.offset, p.cur.line = p.offset, p.line
- p.cur.unquoted = ""
- switch p.s[0] {
- case '<', '>', '{', '}', ':', '[', ']', ';', ',', '/':
- // Single symbol
- p.cur.value, p.s = p.s[0:1], p.s[1:len(p.s)]
- case '"', '\'':
- // Quoted string
- i := 1
- for i < len(p.s) && p.s[i] != p.s[0] && p.s[i] != '\n' {
- if p.s[i] == '\\' && i+1 < len(p.s) {
- // skip escaped char
- i++
- }
- i++
- }
- if i >= len(p.s) || p.s[i] != p.s[0] {
- p.errorf("unmatched quote")
- return
- }
- unq, err := unquoteC(p.s[1:i], rune(p.s[0]))
- if err != nil {
- p.errorf("invalid quoted string %s: %v", p.s[0:i+1], err)
- return
- }
- p.cur.value, p.s = p.s[0:i+1], p.s[i+1:len(p.s)]
- p.cur.unquoted = unq
- default:
- i := 0
- for i < len(p.s) && isIdentOrNumberChar(p.s[i]) {
- i++
- }
- if i == 0 {
- p.errorf("unexpected byte %#x", p.s[0])
- return
- }
- p.cur.value, p.s = p.s[0:i], p.s[i:len(p.s)]
- }
- p.offset += len(p.cur.value)
-}
-
-var (
- errBadUTF8 = errors.New("proto: bad UTF-8")
-)
-
-func unquoteC(s string, quote rune) (string, error) {
- // This is based on C++'s tokenizer.cc.
- // Despite its name, this is *not* parsing C syntax.
- // For instance, "\0" is an invalid quoted string.
-
- // Avoid allocation in trivial cases.
- simple := true
- for _, r := range s {
- if r == '\\' || r == quote {
- simple = false
- break
- }
- }
- if simple {
- return s, nil
- }
-
- buf := make([]byte, 0, 3*len(s)/2)
- for len(s) > 0 {
- r, n := utf8.DecodeRuneInString(s)
- if r == utf8.RuneError && n == 1 {
- return "", errBadUTF8
- }
- s = s[n:]
- if r != '\\' {
- if r < utf8.RuneSelf {
- buf = append(buf, byte(r))
- } else {
- buf = append(buf, string(r)...)
- }
- continue
- }
-
- ch, tail, err := unescape(s)
- if err != nil {
- return "", err
- }
- buf = append(buf, ch...)
- s = tail
- }
- return string(buf), nil
-}
-
-func unescape(s string) (ch string, tail string, err error) {
- r, n := utf8.DecodeRuneInString(s)
- if r == utf8.RuneError && n == 1 {
- return "", "", errBadUTF8
- }
- s = s[n:]
- switch r {
- case 'a':
- return "\a", s, nil
- case 'b':
- return "\b", s, nil
- case 'f':
- return "\f", s, nil
- case 'n':
- return "\n", s, nil
- case 'r':
- return "\r", s, nil
- case 't':
- return "\t", s, nil
- case 'v':
- return "\v", s, nil
- case '?':
- return "?", s, nil // trigraph workaround
- case '\'', '"', '\\':
- return string(r), s, nil
- case '0', '1', '2', '3', '4', '5', '6', '7':
- if len(s) < 2 {
- return "", "", fmt.Errorf(`\%c requires 2 following digits`, r)
- }
- ss := string(r) + s[:2]
- s = s[2:]
- i, err := strconv.ParseUint(ss, 8, 8)
- if err != nil {
- return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss)
- }
- return string([]byte{byte(i)}), s, nil
- case 'x', 'X', 'u', 'U':
- var n int
- switch r {
- case 'x', 'X':
- n = 2
- case 'u':
- n = 4
- case 'U':
- n = 8
- }
- if len(s) < n {
- return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n)
- }
- ss := s[:n]
- s = s[n:]
- i, err := strconv.ParseUint(ss, 16, 64)
- if err != nil {
- return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss)
- }
- if r == 'x' || r == 'X' {
- return string([]byte{byte(i)}), s, nil
- }
- if i > utf8.MaxRune {
- return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss)
- }
- return string(i), s, nil
- }
- return "", "", fmt.Errorf(`unknown escape \%c`, r)
-}
-
-// Back off the parser by one token. Can only be done between calls to next().
-// It makes the next advance() a no-op.
-func (p *textParser) back() { p.backed = true }
-
-// Advances the parser and returns the new current token.
-func (p *textParser) next() *token {
- if p.backed || p.done {
- p.backed = false
- return &p.cur
- }
- p.advance()
- if p.done {
- p.cur.value = ""
- } else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) {
- // Look for multiple quoted strings separated by whitespace,
- // and concatenate them.
- cat := p.cur
- for {
- p.skipWhitespace()
- if p.done || !isQuote(p.s[0]) {
- break
- }
- p.advance()
- if p.cur.err != nil {
- return &p.cur
- }
- cat.value += " " + p.cur.value
- cat.unquoted += p.cur.unquoted
- }
- p.done = false // parser may have seen EOF, but we want to return cat
- p.cur = cat
- }
- return &p.cur
-}
-
-func (p *textParser) consumeToken(s string) error {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != s {
- p.back()
- return p.errorf("expected %q, found %q", s, tok.value)
- }
- return nil
-}
-
-// Return a RequiredNotSetError indicating which required field was not set.
-func (p *textParser) missingRequiredFieldError(sv reflect.Value) *RequiredNotSetError {
- st := sv.Type()
- sprops := GetProperties(st)
- for i := 0; i < st.NumField(); i++ {
- if !isNil(sv.Field(i)) {
- continue
- }
-
- props := sprops.Prop[i]
- if props.Required {
- return &RequiredNotSetError{fmt.Sprintf("%v.%v", st, props.OrigName)}
- }
- }
- return &RequiredNotSetError{fmt.Sprintf("%v.", st)} // should not happen
-}
-
-// Returns the index in the struct for the named field, as well as the parsed tag properties.
-func structFieldByName(sprops *StructProperties, name string) (int, *Properties, bool) {
- i, ok := sprops.decoderOrigNames[name]
- if ok {
- return i, sprops.Prop[i], true
- }
- return -1, nil, false
-}
-
-// Consume a ':' from the input stream (if the next token is a colon),
-// returning an error if a colon is needed but not present.
-func (p *textParser) checkForColon(props *Properties, typ reflect.Type) *ParseError {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != ":" {
- // Colon is optional when the field is a group or message.
- needColon := true
- switch props.Wire {
- case "group":
- needColon = false
- case "bytes":
- // A "bytes" field is either a message, a string, or a repeated field;
- // those three become *T, *string and []T respectively, so we can check for
- // this field being a pointer to a non-string.
- if typ.Kind() == reflect.Ptr {
- // *T or *string
- if typ.Elem().Kind() == reflect.String {
- break
- }
- } else if typ.Kind() == reflect.Slice {
- // []T or []*T
- if typ.Elem().Kind() != reflect.Ptr {
- break
- }
- } else if typ.Kind() == reflect.String {
- // The proto3 exception is for a string field,
- // which requires a colon.
- break
- }
- needColon = false
- }
- if needColon {
- return p.errorf("expected ':', found %q", tok.value)
- }
- p.back()
- }
- return nil
-}
-
-func (p *textParser) readStruct(sv reflect.Value, terminator string) error {
- st := sv.Type()
- sprops := GetProperties(st)
- reqCount := sprops.reqCount
- var reqFieldErr error
- fieldSet := make(map[string]bool)
- // A struct is a sequence of "name: value", terminated by one of
- // '>' or '}', or the end of the input. A name may also be
- // "[extension]" or "[type/url]".
- //
- // The whole struct can also be an expanded Any message, like:
- // [type/url] < ... struct contents ... >
- for {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == terminator {
- break
- }
- if tok.value == "[" {
- // Looks like an extension or an Any.
- //
- // TODO: Check whether we need to handle
- // namespace rooted names (e.g. ".something.Foo").
- extName, err := p.consumeExtName()
- if err != nil {
- return err
- }
-
- if s := strings.LastIndex(extName, "/"); s >= 0 {
- // If it contains a slash, it's an Any type URL.
- messageName := extName[s+1:]
- mt := MessageType(messageName)
- if mt == nil {
- return p.errorf("unrecognized message %q in google.protobuf.Any", messageName)
- }
- tok = p.next()
- if tok.err != nil {
- return tok.err
- }
- // consume an optional colon
- if tok.value == ":" {
- tok = p.next()
- if tok.err != nil {
- return tok.err
- }
- }
- var terminator string
- switch tok.value {
- case "<":
- terminator = ">"
- case "{":
- terminator = "}"
- default:
- return p.errorf("expected '{' or '<', found %q", tok.value)
- }
- v := reflect.New(mt.Elem())
- if pe := p.readStruct(v.Elem(), terminator); pe != nil {
- return pe
- }
- b, err := Marshal(v.Interface().(Message))
- if err != nil {
- return p.errorf("failed to marshal message of type %q: %v", messageName, err)
- }
- if fieldSet["type_url"] {
- return p.errorf(anyRepeatedlyUnpacked, "type_url")
- }
- if fieldSet["value"] {
- return p.errorf(anyRepeatedlyUnpacked, "value")
- }
- sv.FieldByName("TypeUrl").SetString(extName)
- sv.FieldByName("Value").SetBytes(b)
- fieldSet["type_url"] = true
- fieldSet["value"] = true
- continue
- }
-
- var desc *ExtensionDesc
- // This could be faster, but it's functional.
- // TODO: Do something smarter than a linear scan.
- for _, d := range RegisteredExtensions(reflect.New(st).Interface().(Message)) {
- if d.Name == extName {
- desc = d
- break
- }
- }
- if desc == nil {
- return p.errorf("unrecognized extension %q", extName)
- }
-
- props := &Properties{}
- props.Parse(desc.Tag)
-
- typ := reflect.TypeOf(desc.ExtensionType)
- if err := p.checkForColon(props, typ); err != nil {
- return err
- }
-
- rep := desc.repeated()
-
- // Read the extension structure, and set it in
- // the value we're constructing.
- var ext reflect.Value
- if !rep {
- ext = reflect.New(typ).Elem()
- } else {
- ext = reflect.New(typ.Elem()).Elem()
- }
- if err := p.readAny(ext, props); err != nil {
- if _, ok := err.(*RequiredNotSetError); !ok {
- return err
- }
- reqFieldErr = err
- }
- ep := sv.Addr().Interface().(Message)
- if !rep {
- SetExtension(ep, desc, ext.Interface())
- } else {
- old, err := GetExtension(ep, desc)
- var sl reflect.Value
- if err == nil {
- sl = reflect.ValueOf(old) // existing slice
- } else {
- sl = reflect.MakeSlice(typ, 0, 1)
- }
- sl = reflect.Append(sl, ext)
- SetExtension(ep, desc, sl.Interface())
- }
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
- continue
- }
-
- // This is a normal, non-extension field.
- name := tok.value
- var dst reflect.Value
- fi, props, ok := structFieldByName(sprops, name)
- if ok {
- dst = sv.Field(fi)
- } else if oop, ok := sprops.OneofTypes[name]; ok {
- // It is a oneof.
- props = oop.Prop
- nv := reflect.New(oop.Type.Elem())
- dst = nv.Elem().Field(0)
- field := sv.Field(oop.Field)
- if !field.IsNil() {
- return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name)
- }
- field.Set(nv)
- }
- if !dst.IsValid() {
- return p.errorf("unknown field name %q in %v", name, st)
- }
-
- if dst.Kind() == reflect.Map {
- // Consume any colon.
- if err := p.checkForColon(props, dst.Type()); err != nil {
- return err
- }
-
- // Construct the map if it doesn't already exist.
- if dst.IsNil() {
- dst.Set(reflect.MakeMap(dst.Type()))
- }
- key := reflect.New(dst.Type().Key()).Elem()
- val := reflect.New(dst.Type().Elem()).Elem()
-
- // The map entry should be this sequence of tokens:
- // < key : KEY value : VALUE >
- // However, implementations may omit key or value, and technically
- // we should support them in any order. See b/28924776 for a time
- // this went wrong.
-
- tok := p.next()
- var terminator string
- switch tok.value {
- case "<":
- terminator = ">"
- case "{":
- terminator = "}"
- default:
- return p.errorf("expected '{' or '<', found %q", tok.value)
- }
- for {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == terminator {
- break
- }
- switch tok.value {
- case "key":
- if err := p.consumeToken(":"); err != nil {
- return err
- }
- if err := p.readAny(key, props.MapKeyProp); err != nil {
- return err
- }
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
- case "value":
- if err := p.checkForColon(props.MapValProp, dst.Type().Elem()); err != nil {
- return err
- }
- if err := p.readAny(val, props.MapValProp); err != nil {
- return err
- }
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
- default:
- p.back()
- return p.errorf(`expected "key", "value", or %q, found %q`, terminator, tok.value)
- }
- }
-
- dst.SetMapIndex(key, val)
- continue
- }
-
- // Check that it's not already set if it's not a repeated field.
- if !props.Repeated && fieldSet[name] {
- return p.errorf("non-repeated field %q was repeated", name)
- }
-
- if err := p.checkForColon(props, dst.Type()); err != nil {
- return err
- }
-
- // Parse into the field.
- fieldSet[name] = true
- if err := p.readAny(dst, props); err != nil {
- if _, ok := err.(*RequiredNotSetError); !ok {
- return err
- }
- reqFieldErr = err
- }
- if props.Required {
- reqCount--
- }
-
- if err := p.consumeOptionalSeparator(); err != nil {
- return err
- }
-
- }
-
- if reqCount > 0 {
- return p.missingRequiredFieldError(sv)
- }
- return reqFieldErr
-}
-
-// consumeExtName consumes extension name or expanded Any type URL and the
-// following ']'. It returns the name or URL consumed.
-func (p *textParser) consumeExtName() (string, error) {
- tok := p.next()
- if tok.err != nil {
- return "", tok.err
- }
-
- // If extension name or type url is quoted, it's a single token.
- if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] {
- name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0]))
- if err != nil {
- return "", err
- }
- return name, p.consumeToken("]")
- }
-
- // Consume everything up to "]"
- var parts []string
- for tok.value != "]" {
- parts = append(parts, tok.value)
- tok = p.next()
- if tok.err != nil {
- return "", p.errorf("unrecognized type_url or extension name: %s", tok.err)
- }
- if p.done && tok.value != "]" {
- return "", p.errorf("unclosed type_url or extension name")
- }
- }
- return strings.Join(parts, ""), nil
-}
-
-// consumeOptionalSeparator consumes an optional semicolon or comma.
-// It is used in readStruct to provide backward compatibility.
-func (p *textParser) consumeOptionalSeparator() error {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value != ";" && tok.value != "," {
- p.back()
- }
- return nil
-}
-
-func (p *textParser) readAny(v reflect.Value, props *Properties) error {
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == "" {
- return p.errorf("unexpected EOF")
- }
-
- switch fv := v; fv.Kind() {
- case reflect.Slice:
- at := v.Type()
- if at.Elem().Kind() == reflect.Uint8 {
- // Special case for []byte
- if tok.value[0] != '"' && tok.value[0] != '\'' {
- // Deliberately written out here, as the error after
- // this switch statement would write "invalid []byte: ...",
- // which is not as user-friendly.
- return p.errorf("invalid string: %v", tok.value)
- }
- bytes := []byte(tok.unquoted)
- fv.Set(reflect.ValueOf(bytes))
- return nil
- }
- // Repeated field.
- if tok.value == "[" {
- // Repeated field with list notation, like [1,2,3].
- for {
- fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))
- err := p.readAny(fv.Index(fv.Len()-1), props)
- if err != nil {
- return err
- }
- tok := p.next()
- if tok.err != nil {
- return tok.err
- }
- if tok.value == "]" {
- break
- }
- if tok.value != "," {
- return p.errorf("Expected ']' or ',' found %q", tok.value)
- }
- }
- return nil
- }
- // One value of the repeated field.
- p.back()
- fv.Set(reflect.Append(fv, reflect.New(at.Elem()).Elem()))
- return p.readAny(fv.Index(fv.Len()-1), props)
- case reflect.Bool:
- // true/1/t/True or false/f/0/False.
- switch tok.value {
- case "true", "1", "t", "True":
- fv.SetBool(true)
- return nil
- case "false", "0", "f", "False":
- fv.SetBool(false)
- return nil
- }
- case reflect.Float32, reflect.Float64:
- v := tok.value
- // Ignore 'f' for compatibility with output generated by C++, but don't
- // remove 'f' when the value is "-inf" or "inf".
- if strings.HasSuffix(v, "f") && tok.value != "-inf" && tok.value != "inf" {
- v = v[:len(v)-1]
- }
- if f, err := strconv.ParseFloat(v, fv.Type().Bits()); err == nil {
- fv.SetFloat(f)
- return nil
- }
- case reflect.Int32:
- if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil {
- fv.SetInt(x)
- return nil
- }
-
- if len(props.Enum) == 0 {
- break
- }
- m, ok := enumValueMaps[props.Enum]
- if !ok {
- break
- }
- x, ok := m[tok.value]
- if !ok {
- break
- }
- fv.SetInt(int64(x))
- return nil
- case reflect.Int64:
- if x, err := strconv.ParseInt(tok.value, 0, 64); err == nil {
- fv.SetInt(x)
- return nil
- }
-
- case reflect.Ptr:
- // A basic field (indirected through pointer), or a repeated message/group
- p.back()
- fv.Set(reflect.New(fv.Type().Elem()))
- return p.readAny(fv.Elem(), props)
- case reflect.String:
- if tok.value[0] == '"' || tok.value[0] == '\'' {
- fv.SetString(tok.unquoted)
- return nil
- }
- case reflect.Struct:
- var terminator string
- switch tok.value {
- case "{":
- terminator = "}"
- case "<":
- terminator = ">"
- default:
- return p.errorf("expected '{' or '<', found %q", tok.value)
- }
- // TODO: Handle nested messages which implement encoding.TextUnmarshaler.
- return p.readStruct(fv, terminator)
- case reflect.Uint32:
- if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil {
- fv.SetUint(uint64(x))
- return nil
- }
- case reflect.Uint64:
- if x, err := strconv.ParseUint(tok.value, 0, 64); err == nil {
- fv.SetUint(x)
- return nil
- }
- }
- return p.errorf("invalid %v: %v", v.Type(), tok.value)
-}
-
-// UnmarshalText reads a protocol buffer in Text format. UnmarshalText resets pb
-// before starting to unmarshal, so any existing data in pb is always removed.
-// If a required field is not set and no other error occurs,
-// UnmarshalText returns *RequiredNotSetError.
-func UnmarshalText(s string, pb Message) error {
- if um, ok := pb.(encoding.TextUnmarshaler); ok {
- return um.UnmarshalText([]byte(s))
- }
- pb.Reset()
- v := reflect.ValueOf(pb)
- return newTextParser(s).readStruct(v.Elem(), "")
-}
diff --git a/vendor/github.com/google/go-querystring/LICENSE b/vendor/github.com/google/go-querystring/LICENSE
deleted file mode 100644
index ae121a1e46df937b5fa1cf1e620837bfbee51667..0000000000000000000000000000000000000000
--- a/vendor/github.com/google/go-querystring/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2013 Google. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-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
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/google/go-querystring/query/encode.go b/vendor/github.com/google/go-querystring/query/encode.go
deleted file mode 100644
index 37080b19b5d966bf04a03e6bf2b4ef7effa82e5b..0000000000000000000000000000000000000000
--- a/vendor/github.com/google/go-querystring/query/encode.go
+++ /dev/null
@@ -1,320 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package query implements encoding of structs into URL query parameters.
-//
-// As a simple example:
-//
-// type Options struct {
-// Query string `url:"q"`
-// ShowAll bool `url:"all"`
-// Page int `url:"page"`
-// }
-//
-// opt := Options{ "foo", true, 2 }
-// v, _ := query.Values(opt)
-// fmt.Print(v.Encode()) // will output: "q=foo&all=true&page=2"
-//
-// The exact mapping between Go values and url.Values is described in the
-// documentation for the Values() function.
-package query
-
-import (
- "bytes"
- "fmt"
- "net/url"
- "reflect"
- "strconv"
- "strings"
- "time"
-)
-
-var timeType = reflect.TypeOf(time.Time{})
-
-var encoderType = reflect.TypeOf(new(Encoder)).Elem()
-
-// Encoder is an interface implemented by any type that wishes to encode
-// itself into URL values in a non-standard way.
-type Encoder interface {
- EncodeValues(key string, v *url.Values) error
-}
-
-// Values returns the url.Values encoding of v.
-//
-// Values expects to be passed a struct, and traverses it recursively using the
-// following encoding rules.
-//
-// Each exported struct field is encoded as a URL parameter unless
-//
-// - the field's tag is "-", or
-// - the field is empty and its tag specifies the "omitempty" option
-//
-// The empty values are false, 0, any nil pointer or interface value, any array
-// slice, map, or string of length zero, and any time.Time that returns true
-// for IsZero().
-//
-// The URL parameter name defaults to the struct field name but can be
-// specified in the struct field's tag value. The "url" key in the struct
-// field's tag value is the key name, followed by an optional comma and
-// options. For example:
-//
-// // Field is ignored by this package.
-// Field int `url:"-"`
-//
-// // Field appears as URL parameter "myName".
-// Field int `url:"myName"`
-//
-// // Field appears as URL parameter "myName" and the field is omitted if
-// // its value is empty
-// Field int `url:"myName,omitempty"`
-//
-// // Field appears as URL parameter "Field" (the default), but the field
-// // is skipped if empty. Note the leading comma.
-// Field int `url:",omitempty"`
-//
-// For encoding individual field values, the following type-dependent rules
-// apply:
-//
-// Boolean values default to encoding as the strings "true" or "false".
-// Including the "int" option signals that the field should be encoded as the
-// strings "1" or "0".
-//
-// time.Time values default to encoding as RFC3339 timestamps. Including the
-// "unix" option signals that the field should be encoded as a Unix time (see
-// time.Unix())
-//
-// Slice and Array values default to encoding as multiple URL values of the
-// same name. Including the "comma" option signals that the field should be
-// encoded as a single comma-delimited value. Including the "space" option
-// similarly encodes the value as a single space-delimited string. Including
-// the "semicolon" option will encode the value as a semicolon-delimited string.
-// Including the "brackets" option signals that the multiple URL values should
-// have "[]" appended to the value name. "numbered" will append a number to
-// the end of each incidence of the value name, example:
-// name0=value0&name1=value1, etc.
-//
-// Anonymous struct fields are usually encoded as if their inner exported
-// fields were fields in the outer struct, subject to the standard Go
-// visibility rules. An anonymous struct field with a name given in its URL
-// tag is treated as having that name, rather than being anonymous.
-//
-// Non-nil pointer values are encoded as the value pointed to.
-//
-// Nested structs are encoded including parent fields in value names for
-// scoping. e.g:
-//
-// "user[name]=acme&user[addr][postcode]=1234&user[addr][city]=SFO"
-//
-// All other values are encoded using their default string representation.
-//
-// Multiple fields that encode to the same URL parameter name will be included
-// as multiple URL values of the same name.
-func Values(v interface{}) (url.Values, error) {
- values := make(url.Values)
- val := reflect.ValueOf(v)
- for val.Kind() == reflect.Ptr {
- if val.IsNil() {
- return values, nil
- }
- val = val.Elem()
- }
-
- if v == nil {
- return values, nil
- }
-
- if val.Kind() != reflect.Struct {
- return nil, fmt.Errorf("query: Values() expects struct input. Got %v", val.Kind())
- }
-
- err := reflectValue(values, val, "")
- return values, err
-}
-
-// reflectValue populates the values parameter from the struct fields in val.
-// Embedded structs are followed recursively (using the rules defined in the
-// Values function documentation) breadth-first.
-func reflectValue(values url.Values, val reflect.Value, scope string) error {
- var embedded []reflect.Value
-
- typ := val.Type()
- for i := 0; i < typ.NumField(); i++ {
- sf := typ.Field(i)
- if sf.PkgPath != "" && !sf.Anonymous { // unexported
- continue
- }
-
- sv := val.Field(i)
- tag := sf.Tag.Get("url")
- if tag == "-" {
- continue
- }
- name, opts := parseTag(tag)
- if name == "" {
- if sf.Anonymous && sv.Kind() == reflect.Struct {
- // save embedded struct for later processing
- embedded = append(embedded, sv)
- continue
- }
-
- name = sf.Name
- }
-
- if scope != "" {
- name = scope + "[" + name + "]"
- }
-
- if opts.Contains("omitempty") && isEmptyValue(sv) {
- continue
- }
-
- if sv.Type().Implements(encoderType) {
- if !reflect.Indirect(sv).IsValid() {
- sv = reflect.New(sv.Type().Elem())
- }
-
- m := sv.Interface().(Encoder)
- if err := m.EncodeValues(name, &values); err != nil {
- return err
- }
- continue
- }
-
- if sv.Kind() == reflect.Slice || sv.Kind() == reflect.Array {
- var del byte
- if opts.Contains("comma") {
- del = ','
- } else if opts.Contains("space") {
- del = ' '
- } else if opts.Contains("semicolon") {
- del = ';'
- } else if opts.Contains("brackets") {
- name = name + "[]"
- }
-
- if del != 0 {
- s := new(bytes.Buffer)
- first := true
- for i := 0; i < sv.Len(); i++ {
- if first {
- first = false
- } else {
- s.WriteByte(del)
- }
- s.WriteString(valueString(sv.Index(i), opts))
- }
- values.Add(name, s.String())
- } else {
- for i := 0; i < sv.Len(); i++ {
- k := name
- if opts.Contains("numbered") {
- k = fmt.Sprintf("%s%d", name, i)
- }
- values.Add(k, valueString(sv.Index(i), opts))
- }
- }
- continue
- }
-
- for sv.Kind() == reflect.Ptr {
- if sv.IsNil() {
- break
- }
- sv = sv.Elem()
- }
-
- if sv.Type() == timeType {
- values.Add(name, valueString(sv, opts))
- continue
- }
-
- if sv.Kind() == reflect.Struct {
- reflectValue(values, sv, name)
- continue
- }
-
- values.Add(name, valueString(sv, opts))
- }
-
- for _, f := range embedded {
- if err := reflectValue(values, f, scope); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// valueString returns the string representation of a value.
-func valueString(v reflect.Value, opts tagOptions) string {
- for v.Kind() == reflect.Ptr {
- if v.IsNil() {
- return ""
- }
- v = v.Elem()
- }
-
- if v.Kind() == reflect.Bool && opts.Contains("int") {
- if v.Bool() {
- return "1"
- }
- return "0"
- }
-
- if v.Type() == timeType {
- t := v.Interface().(time.Time)
- if opts.Contains("unix") {
- return strconv.FormatInt(t.Unix(), 10)
- }
- return t.Format(time.RFC3339)
- }
-
- return fmt.Sprint(v.Interface())
-}
-
-// isEmptyValue checks if a value should be considered empty for the purposes
-// of omitting fields with the "omitempty" option.
-func isEmptyValue(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
- return v.Len() == 0
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.Interface, reflect.Ptr:
- return v.IsNil()
- }
-
- if v.Type() == timeType {
- return v.Interface().(time.Time).IsZero()
- }
-
- return false
-}
-
-// tagOptions is the string following a comma in a struct field's "url" tag, or
-// the empty string. It does not include the leading comma.
-type tagOptions []string
-
-// parseTag splits a struct field's url tag into its name and comma-separated
-// options.
-func parseTag(tag string) (string, tagOptions) {
- s := strings.Split(tag, ",")
- return s[0], s[1:]
-}
-
-// Contains checks whether the tagOptions contains the specified option.
-func (o tagOptions) Contains(option string) bool {
- for _, s := range o {
- if s == option {
- return true
- }
- }
- return false
-}
diff --git a/vendor/github.com/gorilla/mux/AUTHORS b/vendor/github.com/gorilla/mux/AUTHORS
deleted file mode 100644
index b722392ee59266773c107a8e871d6b2a3085cb7c..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/mux/AUTHORS
+++ /dev/null
@@ -1,8 +0,0 @@
-# This is the official list of gorilla/mux authors for copyright purposes.
-#
-# Please keep the list sorted.
-
-Google LLC (https://opensource.google.com/)
-Kamil Kisielk
-Matt Silverlock
-Rodrigo Moraes (https://github.com/moraes)
diff --git a/vendor/github.com/gorilla/mux/LICENSE b/vendor/github.com/gorilla/mux/LICENSE
deleted file mode 100644
index 6903df6386e98928a3236b87c84b71260c2541a6..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/mux/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2012-2018 The Gorilla Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-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
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/gorilla/mux/README.md b/vendor/github.com/gorilla/mux/README.md
deleted file mode 100644
index 92e422eed7af33c5ba7d455e60dc7ebf7c856b01..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/mux/README.md
+++ /dev/null
@@ -1,718 +0,0 @@
-# gorilla/mux
-
-[](https://godoc.org/github.com/gorilla/mux)
-[](https://travis-ci.org/gorilla/mux)
-[](https://circleci.com/gh/gorilla/mux)
-[](https://sourcegraph.com/github.com/gorilla/mux?badge)
-
-
-
-https://www.gorillatoolkit.org/pkg/mux
-
-Package `gorilla/mux` implements a request router and dispatcher for matching incoming requests to
-their respective handler.
-
-The name mux stands for "HTTP request multiplexer". Like the standard `http.ServeMux`, `mux.Router` matches incoming requests against a list of registered routes and calls a handler for the route that matches the URL or other conditions. The main features are:
-
-* It implements the `http.Handler` interface so it is compatible with the standard `http.ServeMux`.
-* Requests can be matched based on URL host, path, path prefix, schemes, header and query values, HTTP methods or using custom matchers.
-* URL hosts, paths and query values can have variables with an optional regular expression.
-* Registered URLs can be built, or "reversed", which helps maintaining references to resources.
-* Routes can be used as subrouters: nested routes are only tested if the parent route matches. This is useful to define groups of routes that share common conditions like a host, a path prefix or other repeated attributes. As a bonus, this optimizes request matching.
-
----
-
-* [Install](#install)
-* [Examples](#examples)
-* [Matching Routes](#matching-routes)
-* [Static Files](#static-files)
-* [Registered URLs](#registered-urls)
-* [Walking Routes](#walking-routes)
-* [Graceful Shutdown](#graceful-shutdown)
-* [Middleware](#middleware)
-* [Handling CORS Requests](#handling-cors-requests)
-* [Testing Handlers](#testing-handlers)
-* [Full Example](#full-example)
-
----
-
-## Install
-
-With a [correctly configured](https://golang.org/doc/install#testing) Go toolchain:
-
-```sh
-go get -u github.com/gorilla/mux
-```
-
-## Examples
-
-Let's start registering a couple of URL paths and handlers:
-
-```go
-func main() {
- r := mux.NewRouter()
- r.HandleFunc("/", HomeHandler)
- r.HandleFunc("/products", ProductsHandler)
- r.HandleFunc("/articles", ArticlesHandler)
- http.Handle("/", r)
-}
-```
-
-Here we register three routes mapping URL paths to handlers. This is equivalent to how `http.HandleFunc()` works: if an incoming request URL matches one of the paths, the corresponding handler is called passing (`http.ResponseWriter`, `*http.Request`) as parameters.
-
-Paths can have variables. They are defined using the format `{name}` or `{name:pattern}`. If a regular expression pattern is not defined, the matched variable will be anything until the next slash. For example:
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/products/{key}", ProductHandler)
-r.HandleFunc("/articles/{category}/", ArticlesCategoryHandler)
-r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler)
-```
-
-The names are used to create a map of route variables which can be retrieved calling `mux.Vars()`:
-
-```go
-func ArticlesCategoryHandler(w http.ResponseWriter, r *http.Request) {
- vars := mux.Vars(r)
- w.WriteHeader(http.StatusOK)
- fmt.Fprintf(w, "Category: %v\n", vars["category"])
-}
-```
-
-And this is all you need to know about the basic usage. More advanced options are explained below.
-
-### Matching Routes
-
-Routes can also be restricted to a domain or subdomain. Just define a host pattern to be matched. They can also have variables:
-
-```go
-r := mux.NewRouter()
-// Only matches if domain is "www.example.com".
-r.Host("www.example.com")
-// Matches a dynamic subdomain.
-r.Host("{subdomain:[a-z]+}.example.com")
-```
-
-There are several other matchers that can be added. To match path prefixes:
-
-```go
-r.PathPrefix("/products/")
-```
-
-...or HTTP methods:
-
-```go
-r.Methods("GET", "POST")
-```
-
-...or URL schemes:
-
-```go
-r.Schemes("https")
-```
-
-...or header values:
-
-```go
-r.Headers("X-Requested-With", "XMLHttpRequest")
-```
-
-...or query values:
-
-```go
-r.Queries("key", "value")
-```
-
-...or to use a custom matcher function:
-
-```go
-r.MatcherFunc(func(r *http.Request, rm *RouteMatch) bool {
- return r.ProtoMajor == 0
-})
-```
-
-...and finally, it is possible to combine several matchers in a single route:
-
-```go
-r.HandleFunc("/products", ProductsHandler).
- Host("www.example.com").
- Methods("GET").
- Schemes("http")
-```
-
-Routes are tested in the order they were added to the router. If two routes match, the first one wins:
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/specific", specificHandler)
-r.PathPrefix("/").Handler(catchAllHandler)
-```
-
-Setting the same matching conditions again and again can be boring, so we have a way to group several routes that share the same requirements. We call it "subrouting".
-
-For example, let's say we have several URLs that should only match when the host is `www.example.com`. Create a route for that host and get a "subrouter" from it:
-
-```go
-r := mux.NewRouter()
-s := r.Host("www.example.com").Subrouter()
-```
-
-Then register routes in the subrouter:
-
-```go
-s.HandleFunc("/products/", ProductsHandler)
-s.HandleFunc("/products/{key}", ProductHandler)
-s.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler)
-```
-
-The three URL paths we registered above will only be tested if the domain is `www.example.com`, because the subrouter is tested first. This is not only convenient, but also optimizes request matching. You can create subrouters combining any attribute matchers accepted by a route.
-
-Subrouters can be used to create domain or path "namespaces": you define subrouters in a central place and then parts of the app can register its paths relatively to a given subrouter.
-
-There's one more thing about subroutes. When a subrouter has a path prefix, the inner routes use it as base for their paths:
-
-```go
-r := mux.NewRouter()
-s := r.PathPrefix("/products").Subrouter()
-// "/products/"
-s.HandleFunc("/", ProductsHandler)
-// "/products/{key}/"
-s.HandleFunc("/{key}/", ProductHandler)
-// "/products/{key}/details"
-s.HandleFunc("/{key}/details", ProductDetailsHandler)
-```
-
-
-### Static Files
-
-Note that the path provided to `PathPrefix()` represents a "wildcard": calling
-`PathPrefix("/static/").Handler(...)` means that the handler will be passed any
-request that matches "/static/\*". This makes it easy to serve static files with mux:
-
-```go
-func main() {
- var dir string
-
- flag.StringVar(&dir, "dir", ".", "the directory to serve files from. Defaults to the current dir")
- flag.Parse()
- r := mux.NewRouter()
-
- // This will serve files under http://localhost:8000/static/
- r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(dir))))
-
- srv := &http.Server{
- Handler: r,
- Addr: "127.0.0.1:8000",
- // Good practice: enforce timeouts for servers you create!
- WriteTimeout: 15 * time.Second,
- ReadTimeout: 15 * time.Second,
- }
-
- log.Fatal(srv.ListenAndServe())
-}
-```
-
-### Registered URLs
-
-Now let's see how to build registered URLs.
-
-Routes can be named. All routes that define a name can have their URLs built, or "reversed". We define a name calling `Name()` on a route. For example:
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
- Name("article")
-```
-
-To build a URL, get the route and call the `URL()` method, passing a sequence of key/value pairs for the route variables. For the previous route, we would do:
-
-```go
-url, err := r.Get("article").URL("category", "technology", "id", "42")
-```
-
-...and the result will be a `url.URL` with the following path:
-
-```
-"/articles/technology/42"
-```
-
-This also works for host and query value variables:
-
-```go
-r := mux.NewRouter()
-r.Host("{subdomain}.example.com").
- Path("/articles/{category}/{id:[0-9]+}").
- Queries("filter", "{filter}").
- HandlerFunc(ArticleHandler).
- Name("article")
-
-// url.String() will be "http://news.example.com/articles/technology/42?filter=gorilla"
-url, err := r.Get("article").URL("subdomain", "news",
- "category", "technology",
- "id", "42",
- "filter", "gorilla")
-```
-
-All variables defined in the route are required, and their values must conform to the corresponding patterns. These requirements guarantee that a generated URL will always match a registered route -- the only exception is for explicitly defined "build-only" routes which never match.
-
-Regex support also exists for matching Headers within a route. For example, we could do:
-
-```go
-r.HeadersRegexp("Content-Type", "application/(text|json)")
-```
-
-...and the route will match both requests with a Content-Type of `application/json` as well as `application/text`
-
-There's also a way to build only the URL host or path for a route: use the methods `URLHost()` or `URLPath()` instead. For the previous route, we would do:
-
-```go
-// "http://news.example.com/"
-host, err := r.Get("article").URLHost("subdomain", "news")
-
-// "/articles/technology/42"
-path, err := r.Get("article").URLPath("category", "technology", "id", "42")
-```
-
-And if you use subrouters, host and path defined separately can be built as well:
-
-```go
-r := mux.NewRouter()
-s := r.Host("{subdomain}.example.com").Subrouter()
-s.Path("/articles/{category}/{id:[0-9]+}").
- HandlerFunc(ArticleHandler).
- Name("article")
-
-// "http://news.example.com/articles/technology/42"
-url, err := r.Get("article").URL("subdomain", "news",
- "category", "technology",
- "id", "42")
-```
-
-### Walking Routes
-
-The `Walk` function on `mux.Router` can be used to visit all of the routes that are registered on a router. For example,
-the following prints all of the registered routes:
-
-```go
-package main
-
-import (
- "fmt"
- "net/http"
- "strings"
-
- "github.com/gorilla/mux"
-)
-
-func handler(w http.ResponseWriter, r *http.Request) {
- return
-}
-
-func main() {
- r := mux.NewRouter()
- r.HandleFunc("/", handler)
- r.HandleFunc("/products", handler).Methods("POST")
- r.HandleFunc("/articles", handler).Methods("GET")
- r.HandleFunc("/articles/{id}", handler).Methods("GET", "PUT")
- r.HandleFunc("/authors", handler).Queries("surname", "{surname}")
- err := r.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error {
- pathTemplate, err := route.GetPathTemplate()
- if err == nil {
- fmt.Println("ROUTE:", pathTemplate)
- }
- pathRegexp, err := route.GetPathRegexp()
- if err == nil {
- fmt.Println("Path regexp:", pathRegexp)
- }
- queriesTemplates, err := route.GetQueriesTemplates()
- if err == nil {
- fmt.Println("Queries templates:", strings.Join(queriesTemplates, ","))
- }
- queriesRegexps, err := route.GetQueriesRegexp()
- if err == nil {
- fmt.Println("Queries regexps:", strings.Join(queriesRegexps, ","))
- }
- methods, err := route.GetMethods()
- if err == nil {
- fmt.Println("Methods:", strings.Join(methods, ","))
- }
- fmt.Println()
- return nil
- })
-
- if err != nil {
- fmt.Println(err)
- }
-
- http.Handle("/", r)
-}
-```
-
-### Graceful Shutdown
-
-Go 1.8 introduced the ability to [gracefully shutdown](https://golang.org/doc/go1.8#http_shutdown) a `*http.Server`. Here's how to do that alongside `mux`:
-
-```go
-package main
-
-import (
- "context"
- "flag"
- "log"
- "net/http"
- "os"
- "os/signal"
- "time"
-
- "github.com/gorilla/mux"
-)
-
-func main() {
- var wait time.Duration
- flag.DurationVar(&wait, "graceful-timeout", time.Second * 15, "the duration for which the server gracefully wait for existing connections to finish - e.g. 15s or 1m")
- flag.Parse()
-
- r := mux.NewRouter()
- // Add your routes as needed
-
- srv := &http.Server{
- Addr: "0.0.0.0:8080",
- // Good practice to set timeouts to avoid Slowloris attacks.
- WriteTimeout: time.Second * 15,
- ReadTimeout: time.Second * 15,
- IdleTimeout: time.Second * 60,
- Handler: r, // Pass our instance of gorilla/mux in.
- }
-
- // Run our server in a goroutine so that it doesn't block.
- go func() {
- if err := srv.ListenAndServe(); err != nil {
- log.Println(err)
- }
- }()
-
- c := make(chan os.Signal, 1)
- // We'll accept graceful shutdowns when quit via SIGINT (Ctrl+C)
- // SIGKILL, SIGQUIT or SIGTERM (Ctrl+/) will not be caught.
- signal.Notify(c, os.Interrupt)
-
- // Block until we receive our signal.
- <-c
-
- // Create a deadline to wait for.
- ctx, cancel := context.WithTimeout(context.Background(), wait)
- defer cancel()
- // Doesn't block if no connections, but will otherwise wait
- // until the timeout deadline.
- srv.Shutdown(ctx)
- // Optionally, you could run srv.Shutdown in a goroutine and block on
- // <-ctx.Done() if your application should wait for other services
- // to finalize based on context cancellation.
- log.Println("shutting down")
- os.Exit(0)
-}
-```
-
-### Middleware
-
-Mux supports the addition of middlewares to a [Router](https://godoc.org/github.com/gorilla/mux#Router), which are executed in the order they are added if a match is found, including its subrouters.
-Middlewares are (typically) small pieces of code which take one request, do something with it, and pass it down to another middleware or the final handler. Some common use cases for middleware are request logging, header manipulation, or `ResponseWriter` hijacking.
-
-Mux middlewares are defined using the de facto standard type:
-
-```go
-type MiddlewareFunc func(http.Handler) http.Handler
-```
-
-Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed to it, and then calls the handler passed as parameter to the MiddlewareFunc. This takes advantage of closures being able access variables from the context where they are created, while retaining the signature enforced by the receivers.
-
-A very basic middleware which logs the URI of the request being handled could be written as:
-
-```go
-func loggingMiddleware(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- // Do stuff here
- log.Println(r.RequestURI)
- // Call the next handler, which can be another middleware in the chain, or the final handler.
- next.ServeHTTP(w, r)
- })
-}
-```
-
-Middlewares can be added to a router using `Router.Use()`:
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/", handler)
-r.Use(loggingMiddleware)
-```
-
-A more complex authentication middleware, which maps session token to users, could be written as:
-
-```go
-// Define our struct
-type authenticationMiddleware struct {
- tokenUsers map[string]string
-}
-
-// Initialize it somewhere
-func (amw *authenticationMiddleware) Populate() {
- amw.tokenUsers["00000000"] = "user0"
- amw.tokenUsers["aaaaaaaa"] = "userA"
- amw.tokenUsers["05f717e5"] = "randomUser"
- amw.tokenUsers["deadbeef"] = "user0"
-}
-
-// Middleware function, which will be called for each request
-func (amw *authenticationMiddleware) Middleware(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- token := r.Header.Get("X-Session-Token")
-
- if user, found := amw.tokenUsers[token]; found {
- // We found the token in our map
- log.Printf("Authenticated user %s\n", user)
- // Pass down the request to the next middleware (or final handler)
- next.ServeHTTP(w, r)
- } else {
- // Write an error and stop the handler chain
- http.Error(w, "Forbidden", http.StatusForbidden)
- }
- })
-}
-```
-
-```go
-r := mux.NewRouter()
-r.HandleFunc("/", handler)
-
-amw := authenticationMiddleware{}
-amw.Populate()
-
-r.Use(amw.Middleware)
-```
-
-Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to. Middlewares _should_ write to `ResponseWriter` if they _are_ going to terminate the request, and they _should not_ write to `ResponseWriter` if they _are not_ going to terminate it.
-
-### Handling CORS Requests
-
-[CORSMethodMiddleware](https://godoc.org/github.com/gorilla/mux#CORSMethodMiddleware) intends to make it easier to strictly set the `Access-Control-Allow-Methods` response header.
-
-* You will still need to use your own CORS handler to set the other CORS headers such as `Access-Control-Allow-Origin`
-* The middleware will set the `Access-Control-Allow-Methods` header to all the method matchers (e.g. `r.Methods(http.MethodGet, http.MethodPut, http.MethodOptions)` -> `Access-Control-Allow-Methods: GET,PUT,OPTIONS`) on a route
-* If you do not specify any methods, then:
-> _Important_: there must be an `OPTIONS` method matcher for the middleware to set the headers.
-
-Here is an example of using `CORSMethodMiddleware` along with a custom `OPTIONS` handler to set all the required CORS headers:
-
-```go
-package main
-
-import (
- "net/http"
- "github.com/gorilla/mux"
-)
-
-func main() {
- r := mux.NewRouter()
-
- // IMPORTANT: you must specify an OPTIONS method matcher for the middleware to set CORS headers
- r.HandleFunc("/foo", fooHandler).Methods(http.MethodGet, http.MethodPut, http.MethodPatch, http.MethodOptions)
- r.Use(mux.CORSMethodMiddleware(r))
-
- http.ListenAndServe(":8080", r)
-}
-
-func fooHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Access-Control-Allow-Origin", "*")
- if r.Method == http.MethodOptions {
- return
- }
-
- w.Write([]byte("foo"))
-}
-```
-
-And an request to `/foo` using something like:
-
-```bash
-curl localhost:8080/foo -v
-```
-
-Would look like:
-
-```bash
-* Trying ::1...
-* TCP_NODELAY set
-* Connected to localhost (::1) port 8080 (#0)
-> GET /foo HTTP/1.1
-> Host: localhost:8080
-> User-Agent: curl/7.59.0
-> Accept: */*
->
-< HTTP/1.1 200 OK
-< Access-Control-Allow-Methods: GET,PUT,PATCH,OPTIONS
-< Access-Control-Allow-Origin: *
-< Date: Fri, 28 Jun 2019 20:13:30 GMT
-< Content-Length: 3
-< Content-Type: text/plain; charset=utf-8
-<
-* Connection #0 to host localhost left intact
-foo
-```
-
-### Testing Handlers
-
-Testing handlers in a Go web application is straightforward, and _mux_ doesn't complicate this any further. Given two files: `endpoints.go` and `endpoints_test.go`, here's how we'd test an application using _mux_.
-
-First, our simple HTTP handler:
-
-```go
-// endpoints.go
-package main
-
-func HealthCheckHandler(w http.ResponseWriter, r *http.Request) {
- // A very simple health check.
- w.Header().Set("Content-Type", "application/json")
- w.WriteHeader(http.StatusOK)
-
- // In the future we could report back on the status of our DB, or our cache
- // (e.g. Redis) by performing a simple PING, and include them in the response.
- io.WriteString(w, `{"alive": true}`)
-}
-
-func main() {
- r := mux.NewRouter()
- r.HandleFunc("/health", HealthCheckHandler)
-
- log.Fatal(http.ListenAndServe("localhost:8080", r))
-}
-```
-
-Our test code:
-
-```go
-// endpoints_test.go
-package main
-
-import (
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-func TestHealthCheckHandler(t *testing.T) {
- // Create a request to pass to our handler. We don't have any query parameters for now, so we'll
- // pass 'nil' as the third parameter.
- req, err := http.NewRequest("GET", "/health", nil)
- if err != nil {
- t.Fatal(err)
- }
-
- // We create a ResponseRecorder (which satisfies http.ResponseWriter) to record the response.
- rr := httptest.NewRecorder()
- handler := http.HandlerFunc(HealthCheckHandler)
-
- // Our handlers satisfy http.Handler, so we can call their ServeHTTP method
- // directly and pass in our Request and ResponseRecorder.
- handler.ServeHTTP(rr, req)
-
- // Check the status code is what we expect.
- if status := rr.Code; status != http.StatusOK {
- t.Errorf("handler returned wrong status code: got %v want %v",
- status, http.StatusOK)
- }
-
- // Check the response body is what we expect.
- expected := `{"alive": true}`
- if rr.Body.String() != expected {
- t.Errorf("handler returned unexpected body: got %v want %v",
- rr.Body.String(), expected)
- }
-}
-```
-
-In the case that our routes have [variables](#examples), we can pass those in the request. We could write
-[table-driven tests](https://dave.cheney.net/2013/06/09/writing-table-driven-tests-in-go) to test multiple
-possible route variables as needed.
-
-```go
-// endpoints.go
-func main() {
- r := mux.NewRouter()
- // A route with a route variable:
- r.HandleFunc("/metrics/{type}", MetricsHandler)
-
- log.Fatal(http.ListenAndServe("localhost:8080", r))
-}
-```
-
-Our test file, with a table-driven test of `routeVariables`:
-
-```go
-// endpoints_test.go
-func TestMetricsHandler(t *testing.T) {
- tt := []struct{
- routeVariable string
- shouldPass bool
- }{
- {"goroutines", true},
- {"heap", true},
- {"counters", true},
- {"queries", true},
- {"adhadaeqm3k", false},
- }
-
- for _, tc := range tt {
- path := fmt.Sprintf("/metrics/%s", tc.routeVariable)
- req, err := http.NewRequest("GET", path, nil)
- if err != nil {
- t.Fatal(err)
- }
-
- rr := httptest.NewRecorder()
-
- // Need to create a router that we can pass the request through so that the vars will be added to the context
- router := mux.NewRouter()
- router.HandleFunc("/metrics/{type}", MetricsHandler)
- router.ServeHTTP(rr, req)
-
- // In this case, our MetricsHandler returns a non-200 response
- // for a route variable it doesn't know about.
- if rr.Code == http.StatusOK && !tc.shouldPass {
- t.Errorf("handler should have failed on routeVariable %s: got %v want %v",
- tc.routeVariable, rr.Code, http.StatusOK)
- }
- }
-}
-```
-
-## Full Example
-
-Here's a complete, runnable example of a small `mux` based server:
-
-```go
-package main
-
-import (
- "net/http"
- "log"
- "github.com/gorilla/mux"
-)
-
-func YourHandler(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte("Gorilla!\n"))
-}
-
-func main() {
- r := mux.NewRouter()
- // Routes consist of a path and a handler function.
- r.HandleFunc("/", YourHandler)
-
- // Bind to a port and pass our router in
- log.Fatal(http.ListenAndServe(":8000", r))
-}
-```
-
-## License
-
-BSD licensed. See the LICENSE file for details.
diff --git a/vendor/github.com/gorilla/mux/context.go b/vendor/github.com/gorilla/mux/context.go
deleted file mode 100644
index 665940a2682ec86e06822ab1fba0db9a7eb77a61..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/mux/context.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package mux
-
-import (
- "context"
- "net/http"
-)
-
-func contextGet(r *http.Request, key interface{}) interface{} {
- return r.Context().Value(key)
-}
-
-func contextSet(r *http.Request, key, val interface{}) *http.Request {
- if val == nil {
- return r
- }
-
- return r.WithContext(context.WithValue(r.Context(), key, val))
-}
diff --git a/vendor/github.com/gorilla/mux/doc.go b/vendor/github.com/gorilla/mux/doc.go
deleted file mode 100644
index bd5a38b55d82f96fff772c14fa769c142103bdbe..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/mux/doc.go
+++ /dev/null
@@ -1,306 +0,0 @@
-// Copyright 2012 The Gorilla Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package mux implements a request router and dispatcher.
-
-The name mux stands for "HTTP request multiplexer". Like the standard
-http.ServeMux, mux.Router matches incoming requests against a list of
-registered routes and calls a handler for the route that matches the URL
-or other conditions. The main features are:
-
- * Requests can be matched based on URL host, path, path prefix, schemes,
- header and query values, HTTP methods or using custom matchers.
- * URL hosts, paths and query values can have variables with an optional
- regular expression.
- * Registered URLs can be built, or "reversed", which helps maintaining
- references to resources.
- * Routes can be used as subrouters: nested routes are only tested if the
- parent route matches. This is useful to define groups of routes that
- share common conditions like a host, a path prefix or other repeated
- attributes. As a bonus, this optimizes request matching.
- * It implements the http.Handler interface so it is compatible with the
- standard http.ServeMux.
-
-Let's start registering a couple of URL paths and handlers:
-
- func main() {
- r := mux.NewRouter()
- r.HandleFunc("/", HomeHandler)
- r.HandleFunc("/products", ProductsHandler)
- r.HandleFunc("/articles", ArticlesHandler)
- http.Handle("/", r)
- }
-
-Here we register three routes mapping URL paths to handlers. This is
-equivalent to how http.HandleFunc() works: if an incoming request URL matches
-one of the paths, the corresponding handler is called passing
-(http.ResponseWriter, *http.Request) as parameters.
-
-Paths can have variables. They are defined using the format {name} or
-{name:pattern}. If a regular expression pattern is not defined, the matched
-variable will be anything until the next slash. For example:
-
- r := mux.NewRouter()
- r.HandleFunc("/products/{key}", ProductHandler)
- r.HandleFunc("/articles/{category}/", ArticlesCategoryHandler)
- r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler)
-
-Groups can be used inside patterns, as long as they are non-capturing (?:re). For example:
-
- r.HandleFunc("/articles/{category}/{sort:(?:asc|desc|new)}", ArticlesCategoryHandler)
-
-The names are used to create a map of route variables which can be retrieved
-calling mux.Vars():
-
- vars := mux.Vars(request)
- category := vars["category"]
-
-Note that if any capturing groups are present, mux will panic() during parsing. To prevent
-this, convert any capturing groups to non-capturing, e.g. change "/{sort:(asc|desc)}" to
-"/{sort:(?:asc|desc)}". This is a change from prior versions which behaved unpredictably
-when capturing groups were present.
-
-And this is all you need to know about the basic usage. More advanced options
-are explained below.
-
-Routes can also be restricted to a domain or subdomain. Just define a host
-pattern to be matched. They can also have variables:
-
- r := mux.NewRouter()
- // Only matches if domain is "www.example.com".
- r.Host("www.example.com")
- // Matches a dynamic subdomain.
- r.Host("{subdomain:[a-z]+}.domain.com")
-
-There are several other matchers that can be added. To match path prefixes:
-
- r.PathPrefix("/products/")
-
-...or HTTP methods:
-
- r.Methods("GET", "POST")
-
-...or URL schemes:
-
- r.Schemes("https")
-
-...or header values:
-
- r.Headers("X-Requested-With", "XMLHttpRequest")
-
-...or query values:
-
- r.Queries("key", "value")
-
-...or to use a custom matcher function:
-
- r.MatcherFunc(func(r *http.Request, rm *RouteMatch) bool {
- return r.ProtoMajor == 0
- })
-
-...and finally, it is possible to combine several matchers in a single route:
-
- r.HandleFunc("/products", ProductsHandler).
- Host("www.example.com").
- Methods("GET").
- Schemes("http")
-
-Setting the same matching conditions again and again can be boring, so we have
-a way to group several routes that share the same requirements.
-We call it "subrouting".
-
-For example, let's say we have several URLs that should only match when the
-host is "www.example.com". Create a route for that host and get a "subrouter"
-from it:
-
- r := mux.NewRouter()
- s := r.Host("www.example.com").Subrouter()
-
-Then register routes in the subrouter:
-
- s.HandleFunc("/products/", ProductsHandler)
- s.HandleFunc("/products/{key}", ProductHandler)
- s.HandleFunc("/articles/{category}/{id:[0-9]+}"), ArticleHandler)
-
-The three URL paths we registered above will only be tested if the domain is
-"www.example.com", because the subrouter is tested first. This is not
-only convenient, but also optimizes request matching. You can create
-subrouters combining any attribute matchers accepted by a route.
-
-Subrouters can be used to create domain or path "namespaces": you define
-subrouters in a central place and then parts of the app can register its
-paths relatively to a given subrouter.
-
-There's one more thing about subroutes. When a subrouter has a path prefix,
-the inner routes use it as base for their paths:
-
- r := mux.NewRouter()
- s := r.PathPrefix("/products").Subrouter()
- // "/products/"
- s.HandleFunc("/", ProductsHandler)
- // "/products/{key}/"
- s.HandleFunc("/{key}/", ProductHandler)
- // "/products/{key}/details"
- s.HandleFunc("/{key}/details", ProductDetailsHandler)
-
-Note that the path provided to PathPrefix() represents a "wildcard": calling
-PathPrefix("/static/").Handler(...) means that the handler will be passed any
-request that matches "/static/*". This makes it easy to serve static files with mux:
-
- func main() {
- var dir string
-
- flag.StringVar(&dir, "dir", ".", "the directory to serve files from. Defaults to the current dir")
- flag.Parse()
- r := mux.NewRouter()
-
- // This will serve files under http://localhost:8000/static/
- r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(dir))))
-
- srv := &http.Server{
- Handler: r,
- Addr: "127.0.0.1:8000",
- // Good practice: enforce timeouts for servers you create!
- WriteTimeout: 15 * time.Second,
- ReadTimeout: 15 * time.Second,
- }
-
- log.Fatal(srv.ListenAndServe())
- }
-
-Now let's see how to build registered URLs.
-
-Routes can be named. All routes that define a name can have their URLs built,
-or "reversed". We define a name calling Name() on a route. For example:
-
- r := mux.NewRouter()
- r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
- Name("article")
-
-To build a URL, get the route and call the URL() method, passing a sequence of
-key/value pairs for the route variables. For the previous route, we would do:
-
- url, err := r.Get("article").URL("category", "technology", "id", "42")
-
-...and the result will be a url.URL with the following path:
-
- "/articles/technology/42"
-
-This also works for host and query value variables:
-
- r := mux.NewRouter()
- r.Host("{subdomain}.domain.com").
- Path("/articles/{category}/{id:[0-9]+}").
- Queries("filter", "{filter}").
- HandlerFunc(ArticleHandler).
- Name("article")
-
- // url.String() will be "http://news.domain.com/articles/technology/42?filter=gorilla"
- url, err := r.Get("article").URL("subdomain", "news",
- "category", "technology",
- "id", "42",
- "filter", "gorilla")
-
-All variables defined in the route are required, and their values must
-conform to the corresponding patterns. These requirements guarantee that a
-generated URL will always match a registered route -- the only exception is
-for explicitly defined "build-only" routes which never match.
-
-Regex support also exists for matching Headers within a route. For example, we could do:
-
- r.HeadersRegexp("Content-Type", "application/(text|json)")
-
-...and the route will match both requests with a Content-Type of `application/json` as well as
-`application/text`
-
-There's also a way to build only the URL host or path for a route:
-use the methods URLHost() or URLPath() instead. For the previous route,
-we would do:
-
- // "http://news.domain.com/"
- host, err := r.Get("article").URLHost("subdomain", "news")
-
- // "/articles/technology/42"
- path, err := r.Get("article").URLPath("category", "technology", "id", "42")
-
-And if you use subrouters, host and path defined separately can be built
-as well:
-
- r := mux.NewRouter()
- s := r.Host("{subdomain}.domain.com").Subrouter()
- s.Path("/articles/{category}/{id:[0-9]+}").
- HandlerFunc(ArticleHandler).
- Name("article")
-
- // "http://news.domain.com/articles/technology/42"
- url, err := r.Get("article").URL("subdomain", "news",
- "category", "technology",
- "id", "42")
-
-Mux supports the addition of middlewares to a Router, which are executed in the order they are added if a match is found, including its subrouters. Middlewares are (typically) small pieces of code which take one request, do something with it, and pass it down to another middleware or the final handler. Some common use cases for middleware are request logging, header manipulation, or ResponseWriter hijacking.
-
- type MiddlewareFunc func(http.Handler) http.Handler
-
-Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed to it, and then calls the handler passed as parameter to the MiddlewareFunc (closures can access variables from the context where they are created).
-
-A very basic middleware which logs the URI of the request being handled could be written as:
-
- func simpleMw(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- // Do stuff here
- log.Println(r.RequestURI)
- // Call the next handler, which can be another middleware in the chain, or the final handler.
- next.ServeHTTP(w, r)
- })
- }
-
-Middlewares can be added to a router using `Router.Use()`:
-
- r := mux.NewRouter()
- r.HandleFunc("/", handler)
- r.Use(simpleMw)
-
-A more complex authentication middleware, which maps session token to users, could be written as:
-
- // Define our struct
- type authenticationMiddleware struct {
- tokenUsers map[string]string
- }
-
- // Initialize it somewhere
- func (amw *authenticationMiddleware) Populate() {
- amw.tokenUsers["00000000"] = "user0"
- amw.tokenUsers["aaaaaaaa"] = "userA"
- amw.tokenUsers["05f717e5"] = "randomUser"
- amw.tokenUsers["deadbeef"] = "user0"
- }
-
- // Middleware function, which will be called for each request
- func (amw *authenticationMiddleware) Middleware(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- token := r.Header.Get("X-Session-Token")
-
- if user, found := amw.tokenUsers[token]; found {
- // We found the token in our map
- log.Printf("Authenticated user %s\n", user)
- next.ServeHTTP(w, r)
- } else {
- http.Error(w, "Forbidden", http.StatusForbidden)
- }
- })
- }
-
- r := mux.NewRouter()
- r.HandleFunc("/", handler)
-
- amw := authenticationMiddleware{tokenUsers: make(map[string]string)}
- amw.Populate()
-
- r.Use(amw.Middleware)
-
-Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to.
-
-*/
-package mux
diff --git a/vendor/github.com/gorilla/mux/go.mod b/vendor/github.com/gorilla/mux/go.mod
deleted file mode 100644
index cfc8ede5818b9b09b510b5a34729054060b28656..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/mux/go.mod
+++ /dev/null
@@ -1 +0,0 @@
-module github.com/gorilla/mux
diff --git a/vendor/github.com/gorilla/mux/middleware.go b/vendor/github.com/gorilla/mux/middleware.go
deleted file mode 100644
index cf2b26dc037a47aee4da5100e2ef81f975bf6621..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/mux/middleware.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package mux
-
-import (
- "net/http"
- "strings"
-)
-
-// MiddlewareFunc is a function which receives an http.Handler and returns another http.Handler.
-// Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed
-// to it, and then calls the handler passed as parameter to the MiddlewareFunc.
-type MiddlewareFunc func(http.Handler) http.Handler
-
-// middleware interface is anything which implements a MiddlewareFunc named Middleware.
-type middleware interface {
- Middleware(handler http.Handler) http.Handler
-}
-
-// Middleware allows MiddlewareFunc to implement the middleware interface.
-func (mw MiddlewareFunc) Middleware(handler http.Handler) http.Handler {
- return mw(handler)
-}
-
-// Use appends a MiddlewareFunc to the chain. Middleware can be used to intercept or otherwise modify requests and/or responses, and are executed in the order that they are applied to the Router.
-func (r *Router) Use(mwf ...MiddlewareFunc) {
- for _, fn := range mwf {
- r.middlewares = append(r.middlewares, fn)
- }
-}
-
-// useInterface appends a middleware to the chain. Middleware can be used to intercept or otherwise modify requests and/or responses, and are executed in the order that they are applied to the Router.
-func (r *Router) useInterface(mw middleware) {
- r.middlewares = append(r.middlewares, mw)
-}
-
-// CORSMethodMiddleware automatically sets the Access-Control-Allow-Methods response header
-// on requests for routes that have an OPTIONS method matcher to all the method matchers on
-// the route. Routes that do not explicitly handle OPTIONS requests will not be processed
-// by the middleware. See examples for usage.
-func CORSMethodMiddleware(r *Router) MiddlewareFunc {
- return func(next http.Handler) http.Handler {
- return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
- allMethods, err := getAllMethodsForRoute(r, req)
- if err == nil {
- for _, v := range allMethods {
- if v == http.MethodOptions {
- w.Header().Set("Access-Control-Allow-Methods", strings.Join(allMethods, ","))
- }
- }
- }
-
- next.ServeHTTP(w, req)
- })
- }
-}
-
-// getAllMethodsForRoute returns all the methods from method matchers matching a given
-// request.
-func getAllMethodsForRoute(r *Router, req *http.Request) ([]string, error) {
- var allMethods []string
-
- err := r.Walk(func(route *Route, _ *Router, _ []*Route) error {
- for _, m := range route.matchers {
- if _, ok := m.(*routeRegexp); ok {
- if m.Match(req, &RouteMatch{}) {
- methods, err := route.GetMethods()
- if err != nil {
- return err
- }
-
- allMethods = append(allMethods, methods...)
- }
- break
- }
- }
- return nil
- })
-
- return allMethods, err
-}
diff --git a/vendor/github.com/gorilla/mux/mux.go b/vendor/github.com/gorilla/mux/mux.go
deleted file mode 100644
index a2cd193e4870256ae36709056aeb70aa410b7990..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/mux/mux.go
+++ /dev/null
@@ -1,607 +0,0 @@
-// Copyright 2012 The Gorilla Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package mux
-
-import (
- "errors"
- "fmt"
- "net/http"
- "path"
- "regexp"
-)
-
-var (
- // ErrMethodMismatch is returned when the method in the request does not match
- // the method defined against the route.
- ErrMethodMismatch = errors.New("method is not allowed")
- // ErrNotFound is returned when no route match is found.
- ErrNotFound = errors.New("no matching route was found")
-)
-
-// NewRouter returns a new router instance.
-func NewRouter() *Router {
- return &Router{namedRoutes: make(map[string]*Route)}
-}
-
-// Router registers routes to be matched and dispatches a handler.
-//
-// It implements the http.Handler interface, so it can be registered to serve
-// requests:
-//
-// var router = mux.NewRouter()
-//
-// func main() {
-// http.Handle("/", router)
-// }
-//
-// Or, for Google App Engine, register it in a init() function:
-//
-// func init() {
-// http.Handle("/", router)
-// }
-//
-// This will send all incoming requests to the router.
-type Router struct {
- // Configurable Handler to be used when no route matches.
- NotFoundHandler http.Handler
-
- // Configurable Handler to be used when the request method does not match the route.
- MethodNotAllowedHandler http.Handler
-
- // Routes to be matched, in order.
- routes []*Route
-
- // Routes by name for URL building.
- namedRoutes map[string]*Route
-
- // If true, do not clear the request context after handling the request.
- //
- // Deprecated: No effect when go1.7+ is used, since the context is stored
- // on the request itself.
- KeepContext bool
-
- // Slice of middlewares to be called after a match is found
- middlewares []middleware
-
- // configuration shared with `Route`
- routeConf
-}
-
-// common route configuration shared between `Router` and `Route`
-type routeConf struct {
- // If true, "/path/foo%2Fbar/to" will match the path "/path/{var}/to"
- useEncodedPath bool
-
- // If true, when the path pattern is "/path/", accessing "/path" will
- // redirect to the former and vice versa.
- strictSlash bool
-
- // If true, when the path pattern is "/path//to", accessing "/path//to"
- // will not redirect
- skipClean bool
-
- // Manager for the variables from host and path.
- regexp routeRegexpGroup
-
- // List of matchers.
- matchers []matcher
-
- // The scheme used when building URLs.
- buildScheme string
-
- buildVarsFunc BuildVarsFunc
-}
-
-// returns an effective deep copy of `routeConf`
-func copyRouteConf(r routeConf) routeConf {
- c := r
-
- if r.regexp.path != nil {
- c.regexp.path = copyRouteRegexp(r.regexp.path)
- }
-
- if r.regexp.host != nil {
- c.regexp.host = copyRouteRegexp(r.regexp.host)
- }
-
- c.regexp.queries = make([]*routeRegexp, 0, len(r.regexp.queries))
- for _, q := range r.regexp.queries {
- c.regexp.queries = append(c.regexp.queries, copyRouteRegexp(q))
- }
-
- c.matchers = make([]matcher, 0, len(r.matchers))
- for _, m := range r.matchers {
- c.matchers = append(c.matchers, m)
- }
-
- return c
-}
-
-func copyRouteRegexp(r *routeRegexp) *routeRegexp {
- c := *r
- return &c
-}
-
-// Match attempts to match the given request against the router's registered routes.
-//
-// If the request matches a route of this router or one of its subrouters the Route,
-// Handler, and Vars fields of the the match argument are filled and this function
-// returns true.
-//
-// If the request does not match any of this router's or its subrouters' routes
-// then this function returns false. If available, a reason for the match failure
-// will be filled in the match argument's MatchErr field. If the match failure type
-// (eg: not found) has a registered handler, the handler is assigned to the Handler
-// field of the match argument.
-func (r *Router) Match(req *http.Request, match *RouteMatch) bool {
- for _, route := range r.routes {
- if route.Match(req, match) {
- // Build middleware chain if no error was found
- if match.MatchErr == nil {
- for i := len(r.middlewares) - 1; i >= 0; i-- {
- match.Handler = r.middlewares[i].Middleware(match.Handler)
- }
- }
- return true
- }
- }
-
- if match.MatchErr == ErrMethodMismatch {
- if r.MethodNotAllowedHandler != nil {
- match.Handler = r.MethodNotAllowedHandler
- return true
- }
-
- return false
- }
-
- // Closest match for a router (includes sub-routers)
- if r.NotFoundHandler != nil {
- match.Handler = r.NotFoundHandler
- match.MatchErr = ErrNotFound
- return true
- }
-
- match.MatchErr = ErrNotFound
- return false
-}
-
-// ServeHTTP dispatches the handler registered in the matched route.
-//
-// When there is a match, the route variables can be retrieved calling
-// mux.Vars(request).
-func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) {
- if !r.skipClean {
- path := req.URL.Path
- if r.useEncodedPath {
- path = req.URL.EscapedPath()
- }
- // Clean path to canonical form and redirect.
- if p := cleanPath(path); p != path {
-
- // Added 3 lines (Philip Schlump) - It was dropping the query string and #whatever from query.
- // This matches with fix in go 1.2 r.c. 4 for same problem. Go Issue:
- // http://code.google.com/p/go/issues/detail?id=5252
- url := *req.URL
- url.Path = p
- p = url.String()
-
- w.Header().Set("Location", p)
- w.WriteHeader(http.StatusMovedPermanently)
- return
- }
- }
- var match RouteMatch
- var handler http.Handler
- if r.Match(req, &match) {
- handler = match.Handler
- req = setVars(req, match.Vars)
- req = setCurrentRoute(req, match.Route)
- }
-
- if handler == nil && match.MatchErr == ErrMethodMismatch {
- handler = methodNotAllowedHandler()
- }
-
- if handler == nil {
- handler = http.NotFoundHandler()
- }
-
- handler.ServeHTTP(w, req)
-}
-
-// Get returns a route registered with the given name.
-func (r *Router) Get(name string) *Route {
- return r.namedRoutes[name]
-}
-
-// GetRoute returns a route registered with the given name. This method
-// was renamed to Get() and remains here for backwards compatibility.
-func (r *Router) GetRoute(name string) *Route {
- return r.namedRoutes[name]
-}
-
-// StrictSlash defines the trailing slash behavior for new routes. The initial
-// value is false.
-//
-// When true, if the route path is "/path/", accessing "/path" will perform a redirect
-// to the former and vice versa. In other words, your application will always
-// see the path as specified in the route.
-//
-// When false, if the route path is "/path", accessing "/path/" will not match
-// this route and vice versa.
-//
-// The re-direct is a HTTP 301 (Moved Permanently). Note that when this is set for
-// routes with a non-idempotent method (e.g. POST, PUT), the subsequent re-directed
-// request will be made as a GET by most clients. Use middleware or client settings
-// to modify this behaviour as needed.
-//
-// Special case: when a route sets a path prefix using the PathPrefix() method,
-// strict slash is ignored for that route because the redirect behavior can't
-// be determined from a prefix alone. However, any subrouters created from that
-// route inherit the original StrictSlash setting.
-func (r *Router) StrictSlash(value bool) *Router {
- r.strictSlash = value
- return r
-}
-
-// SkipClean defines the path cleaning behaviour for new routes. The initial
-// value is false. Users should be careful about which routes are not cleaned
-//
-// When true, if the route path is "/path//to", it will remain with the double
-// slash. This is helpful if you have a route like: /fetch/http://xkcd.com/534/
-//
-// When false, the path will be cleaned, so /fetch/http://xkcd.com/534/ will
-// become /fetch/http/xkcd.com/534
-func (r *Router) SkipClean(value bool) *Router {
- r.skipClean = value
- return r
-}
-
-// UseEncodedPath tells the router to match the encoded original path
-// to the routes.
-// For eg. "/path/foo%2Fbar/to" will match the path "/path/{var}/to".
-//
-// If not called, the router will match the unencoded path to the routes.
-// For eg. "/path/foo%2Fbar/to" will match the path "/path/foo/bar/to"
-func (r *Router) UseEncodedPath() *Router {
- r.useEncodedPath = true
- return r
-}
-
-// ----------------------------------------------------------------------------
-// Route factories
-// ----------------------------------------------------------------------------
-
-// NewRoute registers an empty route.
-func (r *Router) NewRoute() *Route {
- // initialize a route with a copy of the parent router's configuration
- route := &Route{routeConf: copyRouteConf(r.routeConf), namedRoutes: r.namedRoutes}
- r.routes = append(r.routes, route)
- return route
-}
-
-// Name registers a new route with a name.
-// See Route.Name().
-func (r *Router) Name(name string) *Route {
- return r.NewRoute().Name(name)
-}
-
-// Handle registers a new route with a matcher for the URL path.
-// See Route.Path() and Route.Handler().
-func (r *Router) Handle(path string, handler http.Handler) *Route {
- return r.NewRoute().Path(path).Handler(handler)
-}
-
-// HandleFunc registers a new route with a matcher for the URL path.
-// See Route.Path() and Route.HandlerFunc().
-func (r *Router) HandleFunc(path string, f func(http.ResponseWriter,
- *http.Request)) *Route {
- return r.NewRoute().Path(path).HandlerFunc(f)
-}
-
-// Headers registers a new route with a matcher for request header values.
-// See Route.Headers().
-func (r *Router) Headers(pairs ...string) *Route {
- return r.NewRoute().Headers(pairs...)
-}
-
-// Host registers a new route with a matcher for the URL host.
-// See Route.Host().
-func (r *Router) Host(tpl string) *Route {
- return r.NewRoute().Host(tpl)
-}
-
-// MatcherFunc registers a new route with a custom matcher function.
-// See Route.MatcherFunc().
-func (r *Router) MatcherFunc(f MatcherFunc) *Route {
- return r.NewRoute().MatcherFunc(f)
-}
-
-// Methods registers a new route with a matcher for HTTP methods.
-// See Route.Methods().
-func (r *Router) Methods(methods ...string) *Route {
- return r.NewRoute().Methods(methods...)
-}
-
-// Path registers a new route with a matcher for the URL path.
-// See Route.Path().
-func (r *Router) Path(tpl string) *Route {
- return r.NewRoute().Path(tpl)
-}
-
-// PathPrefix registers a new route with a matcher for the URL path prefix.
-// See Route.PathPrefix().
-func (r *Router) PathPrefix(tpl string) *Route {
- return r.NewRoute().PathPrefix(tpl)
-}
-
-// Queries registers a new route with a matcher for URL query values.
-// See Route.Queries().
-func (r *Router) Queries(pairs ...string) *Route {
- return r.NewRoute().Queries(pairs...)
-}
-
-// Schemes registers a new route with a matcher for URL schemes.
-// See Route.Schemes().
-func (r *Router) Schemes(schemes ...string) *Route {
- return r.NewRoute().Schemes(schemes...)
-}
-
-// BuildVarsFunc registers a new route with a custom function for modifying
-// route variables before building a URL.
-func (r *Router) BuildVarsFunc(f BuildVarsFunc) *Route {
- return r.NewRoute().BuildVarsFunc(f)
-}
-
-// Walk walks the router and all its sub-routers, calling walkFn for each route
-// in the tree. The routes are walked in the order they were added. Sub-routers
-// are explored depth-first.
-func (r *Router) Walk(walkFn WalkFunc) error {
- return r.walk(walkFn, []*Route{})
-}
-
-// SkipRouter is used as a return value from WalkFuncs to indicate that the
-// router that walk is about to descend down to should be skipped.
-var SkipRouter = errors.New("skip this router")
-
-// WalkFunc is the type of the function called for each route visited by Walk.
-// At every invocation, it is given the current route, and the current router,
-// and a list of ancestor routes that lead to the current route.
-type WalkFunc func(route *Route, router *Router, ancestors []*Route) error
-
-func (r *Router) walk(walkFn WalkFunc, ancestors []*Route) error {
- for _, t := range r.routes {
- err := walkFn(t, r, ancestors)
- if err == SkipRouter {
- continue
- }
- if err != nil {
- return err
- }
- for _, sr := range t.matchers {
- if h, ok := sr.(*Router); ok {
- ancestors = append(ancestors, t)
- err := h.walk(walkFn, ancestors)
- if err != nil {
- return err
- }
- ancestors = ancestors[:len(ancestors)-1]
- }
- }
- if h, ok := t.handler.(*Router); ok {
- ancestors = append(ancestors, t)
- err := h.walk(walkFn, ancestors)
- if err != nil {
- return err
- }
- ancestors = ancestors[:len(ancestors)-1]
- }
- }
- return nil
-}
-
-// ----------------------------------------------------------------------------
-// Context
-// ----------------------------------------------------------------------------
-
-// RouteMatch stores information about a matched route.
-type RouteMatch struct {
- Route *Route
- Handler http.Handler
- Vars map[string]string
-
- // MatchErr is set to appropriate matching error
- // It is set to ErrMethodMismatch if there is a mismatch in
- // the request method and route method
- MatchErr error
-}
-
-type contextKey int
-
-const (
- varsKey contextKey = iota
- routeKey
-)
-
-// Vars returns the route variables for the current request, if any.
-func Vars(r *http.Request) map[string]string {
- if rv := contextGet(r, varsKey); rv != nil {
- return rv.(map[string]string)
- }
- return nil
-}
-
-// CurrentRoute returns the matched route for the current request, if any.
-// This only works when called inside the handler of the matched route
-// because the matched route is stored in the request context which is cleared
-// after the handler returns, unless the KeepContext option is set on the
-// Router.
-func CurrentRoute(r *http.Request) *Route {
- if rv := contextGet(r, routeKey); rv != nil {
- return rv.(*Route)
- }
- return nil
-}
-
-func setVars(r *http.Request, val interface{}) *http.Request {
- return contextSet(r, varsKey, val)
-}
-
-func setCurrentRoute(r *http.Request, val interface{}) *http.Request {
- return contextSet(r, routeKey, val)
-}
-
-// ----------------------------------------------------------------------------
-// Helpers
-// ----------------------------------------------------------------------------
-
-// cleanPath returns the canonical path for p, eliminating . and .. elements.
-// Borrowed from the net/http package.
-func cleanPath(p string) string {
- if p == "" {
- return "/"
- }
- if p[0] != '/' {
- p = "/" + p
- }
- np := path.Clean(p)
- // path.Clean removes trailing slash except for root;
- // put the trailing slash back if necessary.
- if p[len(p)-1] == '/' && np != "/" {
- np += "/"
- }
-
- return np
-}
-
-// uniqueVars returns an error if two slices contain duplicated strings.
-func uniqueVars(s1, s2 []string) error {
- for _, v1 := range s1 {
- for _, v2 := range s2 {
- if v1 == v2 {
- return fmt.Errorf("mux: duplicated route variable %q", v2)
- }
- }
- }
- return nil
-}
-
-// checkPairs returns the count of strings passed in, and an error if
-// the count is not an even number.
-func checkPairs(pairs ...string) (int, error) {
- length := len(pairs)
- if length%2 != 0 {
- return length, fmt.Errorf(
- "mux: number of parameters must be multiple of 2, got %v", pairs)
- }
- return length, nil
-}
-
-// mapFromPairsToString converts variadic string parameters to a
-// string to string map.
-func mapFromPairsToString(pairs ...string) (map[string]string, error) {
- length, err := checkPairs(pairs...)
- if err != nil {
- return nil, err
- }
- m := make(map[string]string, length/2)
- for i := 0; i < length; i += 2 {
- m[pairs[i]] = pairs[i+1]
- }
- return m, nil
-}
-
-// mapFromPairsToRegex converts variadic string parameters to a
-// string to regex map.
-func mapFromPairsToRegex(pairs ...string) (map[string]*regexp.Regexp, error) {
- length, err := checkPairs(pairs...)
- if err != nil {
- return nil, err
- }
- m := make(map[string]*regexp.Regexp, length/2)
- for i := 0; i < length; i += 2 {
- regex, err := regexp.Compile(pairs[i+1])
- if err != nil {
- return nil, err
- }
- m[pairs[i]] = regex
- }
- return m, nil
-}
-
-// matchInArray returns true if the given string value is in the array.
-func matchInArray(arr []string, value string) bool {
- for _, v := range arr {
- if v == value {
- return true
- }
- }
- return false
-}
-
-// matchMapWithString returns true if the given key/value pairs exist in a given map.
-func matchMapWithString(toCheck map[string]string, toMatch map[string][]string, canonicalKey bool) bool {
- for k, v := range toCheck {
- // Check if key exists.
- if canonicalKey {
- k = http.CanonicalHeaderKey(k)
- }
- if values := toMatch[k]; values == nil {
- return false
- } else if v != "" {
- // If value was defined as an empty string we only check that the
- // key exists. Otherwise we also check for equality.
- valueExists := false
- for _, value := range values {
- if v == value {
- valueExists = true
- break
- }
- }
- if !valueExists {
- return false
- }
- }
- }
- return true
-}
-
-// matchMapWithRegex returns true if the given key/value pairs exist in a given map compiled against
-// the given regex
-func matchMapWithRegex(toCheck map[string]*regexp.Regexp, toMatch map[string][]string, canonicalKey bool) bool {
- for k, v := range toCheck {
- // Check if key exists.
- if canonicalKey {
- k = http.CanonicalHeaderKey(k)
- }
- if values := toMatch[k]; values == nil {
- return false
- } else if v != nil {
- // If value was defined as an empty string we only check that the
- // key exists. Otherwise we also check for equality.
- valueExists := false
- for _, value := range values {
- if v.MatchString(value) {
- valueExists = true
- break
- }
- }
- if !valueExists {
- return false
- }
- }
- }
- return true
-}
-
-// methodNotAllowed replies to the request with an HTTP status code 405.
-func methodNotAllowed(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusMethodNotAllowed)
-}
-
-// methodNotAllowedHandler returns a simple request handler
-// that replies to each request with a status code 405.
-func methodNotAllowedHandler() http.Handler { return http.HandlerFunc(methodNotAllowed) }
diff --git a/vendor/github.com/gorilla/mux/regexp.go b/vendor/github.com/gorilla/mux/regexp.go
deleted file mode 100644
index ac1abcd473e3224bf5117b692ec09792e7ceedb4..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/mux/regexp.go
+++ /dev/null
@@ -1,345 +0,0 @@
-// Copyright 2012 The Gorilla Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package mux
-
-import (
- "bytes"
- "fmt"
- "net/http"
- "net/url"
- "regexp"
- "strconv"
- "strings"
-)
-
-type routeRegexpOptions struct {
- strictSlash bool
- useEncodedPath bool
-}
-
-type regexpType int
-
-const (
- regexpTypePath regexpType = 0
- regexpTypeHost regexpType = 1
- regexpTypePrefix regexpType = 2
- regexpTypeQuery regexpType = 3
-)
-
-// newRouteRegexp parses a route template and returns a routeRegexp,
-// used to match a host, a path or a query string.
-//
-// It will extract named variables, assemble a regexp to be matched, create
-// a "reverse" template to build URLs and compile regexps to validate variable
-// values used in URL building.
-//
-// Previously we accepted only Python-like identifiers for variable
-// names ([a-zA-Z_][a-zA-Z0-9_]*), but currently the only restriction is that
-// name and pattern can't be empty, and names can't contain a colon.
-func newRouteRegexp(tpl string, typ regexpType, options routeRegexpOptions) (*routeRegexp, error) {
- // Check if it is well-formed.
- idxs, errBraces := braceIndices(tpl)
- if errBraces != nil {
- return nil, errBraces
- }
- // Backup the original.
- template := tpl
- // Now let's parse it.
- defaultPattern := "[^/]+"
- if typ == regexpTypeQuery {
- defaultPattern = ".*"
- } else if typ == regexpTypeHost {
- defaultPattern = "[^.]+"
- }
- // Only match strict slash if not matching
- if typ != regexpTypePath {
- options.strictSlash = false
- }
- // Set a flag for strictSlash.
- endSlash := false
- if options.strictSlash && strings.HasSuffix(tpl, "/") {
- tpl = tpl[:len(tpl)-1]
- endSlash = true
- }
- varsN := make([]string, len(idxs)/2)
- varsR := make([]*regexp.Regexp, len(idxs)/2)
- pattern := bytes.NewBufferString("")
- pattern.WriteByte('^')
- reverse := bytes.NewBufferString("")
- var end int
- var err error
- for i := 0; i < len(idxs); i += 2 {
- // Set all values we are interested in.
- raw := tpl[end:idxs[i]]
- end = idxs[i+1]
- parts := strings.SplitN(tpl[idxs[i]+1:end-1], ":", 2)
- name := parts[0]
- patt := defaultPattern
- if len(parts) == 2 {
- patt = parts[1]
- }
- // Name or pattern can't be empty.
- if name == "" || patt == "" {
- return nil, fmt.Errorf("mux: missing name or pattern in %q",
- tpl[idxs[i]:end])
- }
- // Build the regexp pattern.
- fmt.Fprintf(pattern, "%s(?P<%s>%s)", regexp.QuoteMeta(raw), varGroupName(i/2), patt)
-
- // Build the reverse template.
- fmt.Fprintf(reverse, "%s%%s", raw)
-
- // Append variable name and compiled pattern.
- varsN[i/2] = name
- varsR[i/2], err = regexp.Compile(fmt.Sprintf("^%s$", patt))
- if err != nil {
- return nil, err
- }
- }
- // Add the remaining.
- raw := tpl[end:]
- pattern.WriteString(regexp.QuoteMeta(raw))
- if options.strictSlash {
- pattern.WriteString("[/]?")
- }
- if typ == regexpTypeQuery {
- // Add the default pattern if the query value is empty
- if queryVal := strings.SplitN(template, "=", 2)[1]; queryVal == "" {
- pattern.WriteString(defaultPattern)
- }
- }
- if typ != regexpTypePrefix {
- pattern.WriteByte('$')
- }
-
- var wildcardHostPort bool
- if typ == regexpTypeHost {
- if !strings.Contains(pattern.String(), ":") {
- wildcardHostPort = true
- }
- }
- reverse.WriteString(raw)
- if endSlash {
- reverse.WriteByte('/')
- }
- // Compile full regexp.
- reg, errCompile := regexp.Compile(pattern.String())
- if errCompile != nil {
- return nil, errCompile
- }
-
- // Check for capturing groups which used to work in older versions
- if reg.NumSubexp() != len(idxs)/2 {
- panic(fmt.Sprintf("route %s contains capture groups in its regexp. ", template) +
- "Only non-capturing groups are accepted: e.g. (?:pattern) instead of (pattern)")
- }
-
- // Done!
- return &routeRegexp{
- template: template,
- regexpType: typ,
- options: options,
- regexp: reg,
- reverse: reverse.String(),
- varsN: varsN,
- varsR: varsR,
- wildcardHostPort: wildcardHostPort,
- }, nil
-}
-
-// routeRegexp stores a regexp to match a host or path and information to
-// collect and validate route variables.
-type routeRegexp struct {
- // The unmodified template.
- template string
- // The type of match
- regexpType regexpType
- // Options for matching
- options routeRegexpOptions
- // Expanded regexp.
- regexp *regexp.Regexp
- // Reverse template.
- reverse string
- // Variable names.
- varsN []string
- // Variable regexps (validators).
- varsR []*regexp.Regexp
- // Wildcard host-port (no strict port match in hostname)
- wildcardHostPort bool
-}
-
-// Match matches the regexp against the URL host or path.
-func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool {
- if r.regexpType == regexpTypeHost {
- host := getHost(req)
- if r.wildcardHostPort {
- // Don't be strict on the port match
- if i := strings.Index(host, ":"); i != -1 {
- host = host[:i]
- }
- }
- return r.regexp.MatchString(host)
- } else {
- if r.regexpType == regexpTypeQuery {
- return r.matchQueryString(req)
- }
- path := req.URL.Path
- if r.options.useEncodedPath {
- path = req.URL.EscapedPath()
- }
- return r.regexp.MatchString(path)
- }
-}
-
-// url builds a URL part using the given values.
-func (r *routeRegexp) url(values map[string]string) (string, error) {
- urlValues := make([]interface{}, len(r.varsN))
- for k, v := range r.varsN {
- value, ok := values[v]
- if !ok {
- return "", fmt.Errorf("mux: missing route variable %q", v)
- }
- if r.regexpType == regexpTypeQuery {
- value = url.QueryEscape(value)
- }
- urlValues[k] = value
- }
- rv := fmt.Sprintf(r.reverse, urlValues...)
- if !r.regexp.MatchString(rv) {
- // The URL is checked against the full regexp, instead of checking
- // individual variables. This is faster but to provide a good error
- // message, we check individual regexps if the URL doesn't match.
- for k, v := range r.varsN {
- if !r.varsR[k].MatchString(values[v]) {
- return "", fmt.Errorf(
- "mux: variable %q doesn't match, expected %q", values[v],
- r.varsR[k].String())
- }
- }
- }
- return rv, nil
-}
-
-// getURLQuery returns a single query parameter from a request URL.
-// For a URL with foo=bar&baz=ding, we return only the relevant key
-// value pair for the routeRegexp.
-func (r *routeRegexp) getURLQuery(req *http.Request) string {
- if r.regexpType != regexpTypeQuery {
- return ""
- }
- templateKey := strings.SplitN(r.template, "=", 2)[0]
- for key, vals := range req.URL.Query() {
- if key == templateKey && len(vals) > 0 {
- return key + "=" + vals[0]
- }
- }
- return ""
-}
-
-func (r *routeRegexp) matchQueryString(req *http.Request) bool {
- return r.regexp.MatchString(r.getURLQuery(req))
-}
-
-// braceIndices returns the first level curly brace indices from a string.
-// It returns an error in case of unbalanced braces.
-func braceIndices(s string) ([]int, error) {
- var level, idx int
- var idxs []int
- for i := 0; i < len(s); i++ {
- switch s[i] {
- case '{':
- if level++; level == 1 {
- idx = i
- }
- case '}':
- if level--; level == 0 {
- idxs = append(idxs, idx, i+1)
- } else if level < 0 {
- return nil, fmt.Errorf("mux: unbalanced braces in %q", s)
- }
- }
- }
- if level != 0 {
- return nil, fmt.Errorf("mux: unbalanced braces in %q", s)
- }
- return idxs, nil
-}
-
-// varGroupName builds a capturing group name for the indexed variable.
-func varGroupName(idx int) string {
- return "v" + strconv.Itoa(idx)
-}
-
-// ----------------------------------------------------------------------------
-// routeRegexpGroup
-// ----------------------------------------------------------------------------
-
-// routeRegexpGroup groups the route matchers that carry variables.
-type routeRegexpGroup struct {
- host *routeRegexp
- path *routeRegexp
- queries []*routeRegexp
-}
-
-// setMatch extracts the variables from the URL once a route matches.
-func (v routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route) {
- // Store host variables.
- if v.host != nil {
- host := getHost(req)
- matches := v.host.regexp.FindStringSubmatchIndex(host)
- if len(matches) > 0 {
- extractVars(host, matches, v.host.varsN, m.Vars)
- }
- }
- path := req.URL.Path
- if r.useEncodedPath {
- path = req.URL.EscapedPath()
- }
- // Store path variables.
- if v.path != nil {
- matches := v.path.regexp.FindStringSubmatchIndex(path)
- if len(matches) > 0 {
- extractVars(path, matches, v.path.varsN, m.Vars)
- // Check if we should redirect.
- if v.path.options.strictSlash {
- p1 := strings.HasSuffix(path, "/")
- p2 := strings.HasSuffix(v.path.template, "/")
- if p1 != p2 {
- u, _ := url.Parse(req.URL.String())
- if p1 {
- u.Path = u.Path[:len(u.Path)-1]
- } else {
- u.Path += "/"
- }
- m.Handler = http.RedirectHandler(u.String(), http.StatusMovedPermanently)
- }
- }
- }
- }
- // Store query string variables.
- for _, q := range v.queries {
- queryURL := q.getURLQuery(req)
- matches := q.regexp.FindStringSubmatchIndex(queryURL)
- if len(matches) > 0 {
- extractVars(queryURL, matches, q.varsN, m.Vars)
- }
- }
-}
-
-// getHost tries its best to return the request host.
-// According to section 14.23 of RFC 2616 the Host header
-// can include the port number if the default value of 80 is not used.
-func getHost(r *http.Request) string {
- if r.URL.IsAbs() {
- return r.URL.Host
- }
- return r.Host
-}
-
-func extractVars(input string, matches []int, names []string, output map[string]string) {
- for i, name := range names {
- output[name] = input[matches[2*i+2]:matches[2*i+3]]
- }
-}
diff --git a/vendor/github.com/gorilla/mux/route.go b/vendor/github.com/gorilla/mux/route.go
deleted file mode 100644
index 8479c68c1df7e866c42981389c610b488a179041..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/mux/route.go
+++ /dev/null
@@ -1,710 +0,0 @@
-// Copyright 2012 The Gorilla Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package mux
-
-import (
- "errors"
- "fmt"
- "net/http"
- "net/url"
- "regexp"
- "strings"
-)
-
-// Route stores information to match a request and build URLs.
-type Route struct {
- // Request handler for the route.
- handler http.Handler
- // If true, this route never matches: it is only used to build URLs.
- buildOnly bool
- // The name used to build URLs.
- name string
- // Error resulted from building a route.
- err error
-
- // "global" reference to all named routes
- namedRoutes map[string]*Route
-
- // config possibly passed in from `Router`
- routeConf
-}
-
-// SkipClean reports whether path cleaning is enabled for this route via
-// Router.SkipClean.
-func (r *Route) SkipClean() bool {
- return r.skipClean
-}
-
-// Match matches the route against the request.
-func (r *Route) Match(req *http.Request, match *RouteMatch) bool {
- if r.buildOnly || r.err != nil {
- return false
- }
-
- var matchErr error
-
- // Match everything.
- for _, m := range r.matchers {
- if matched := m.Match(req, match); !matched {
- if _, ok := m.(methodMatcher); ok {
- matchErr = ErrMethodMismatch
- continue
- }
-
- // Ignore ErrNotFound errors. These errors arise from match call
- // to Subrouters.
- //
- // This prevents subsequent matching subrouters from failing to
- // run middleware. If not ignored, the middleware would see a
- // non-nil MatchErr and be skipped, even when there was a
- // matching route.
- if match.MatchErr == ErrNotFound {
- match.MatchErr = nil
- }
-
- matchErr = nil
- return false
- }
- }
-
- if matchErr != nil {
- match.MatchErr = matchErr
- return false
- }
-
- if match.MatchErr == ErrMethodMismatch {
- // We found a route which matches request method, clear MatchErr
- match.MatchErr = nil
- // Then override the mis-matched handler
- match.Handler = r.handler
- }
-
- // Yay, we have a match. Let's collect some info about it.
- if match.Route == nil {
- match.Route = r
- }
- if match.Handler == nil {
- match.Handler = r.handler
- }
- if match.Vars == nil {
- match.Vars = make(map[string]string)
- }
-
- // Set variables.
- r.regexp.setMatch(req, match, r)
- return true
-}
-
-// ----------------------------------------------------------------------------
-// Route attributes
-// ----------------------------------------------------------------------------
-
-// GetError returns an error resulted from building the route, if any.
-func (r *Route) GetError() error {
- return r.err
-}
-
-// BuildOnly sets the route to never match: it is only used to build URLs.
-func (r *Route) BuildOnly() *Route {
- r.buildOnly = true
- return r
-}
-
-// Handler --------------------------------------------------------------------
-
-// Handler sets a handler for the route.
-func (r *Route) Handler(handler http.Handler) *Route {
- if r.err == nil {
- r.handler = handler
- }
- return r
-}
-
-// HandlerFunc sets a handler function for the route.
-func (r *Route) HandlerFunc(f func(http.ResponseWriter, *http.Request)) *Route {
- return r.Handler(http.HandlerFunc(f))
-}
-
-// GetHandler returns the handler for the route, if any.
-func (r *Route) GetHandler() http.Handler {
- return r.handler
-}
-
-// Name -----------------------------------------------------------------------
-
-// Name sets the name for the route, used to build URLs.
-// It is an error to call Name more than once on a route.
-func (r *Route) Name(name string) *Route {
- if r.name != "" {
- r.err = fmt.Errorf("mux: route already has name %q, can't set %q",
- r.name, name)
- }
- if r.err == nil {
- r.name = name
- r.namedRoutes[name] = r
- }
- return r
-}
-
-// GetName returns the name for the route, if any.
-func (r *Route) GetName() string {
- return r.name
-}
-
-// ----------------------------------------------------------------------------
-// Matchers
-// ----------------------------------------------------------------------------
-
-// matcher types try to match a request.
-type matcher interface {
- Match(*http.Request, *RouteMatch) bool
-}
-
-// addMatcher adds a matcher to the route.
-func (r *Route) addMatcher(m matcher) *Route {
- if r.err == nil {
- r.matchers = append(r.matchers, m)
- }
- return r
-}
-
-// addRegexpMatcher adds a host or path matcher and builder to a route.
-func (r *Route) addRegexpMatcher(tpl string, typ regexpType) error {
- if r.err != nil {
- return r.err
- }
- if typ == regexpTypePath || typ == regexpTypePrefix {
- if len(tpl) > 0 && tpl[0] != '/' {
- return fmt.Errorf("mux: path must start with a slash, got %q", tpl)
- }
- if r.regexp.path != nil {
- tpl = strings.TrimRight(r.regexp.path.template, "/") + tpl
- }
- }
- rr, err := newRouteRegexp(tpl, typ, routeRegexpOptions{
- strictSlash: r.strictSlash,
- useEncodedPath: r.useEncodedPath,
- })
- if err != nil {
- return err
- }
- for _, q := range r.regexp.queries {
- if err = uniqueVars(rr.varsN, q.varsN); err != nil {
- return err
- }
- }
- if typ == regexpTypeHost {
- if r.regexp.path != nil {
- if err = uniqueVars(rr.varsN, r.regexp.path.varsN); err != nil {
- return err
- }
- }
- r.regexp.host = rr
- } else {
- if r.regexp.host != nil {
- if err = uniqueVars(rr.varsN, r.regexp.host.varsN); err != nil {
- return err
- }
- }
- if typ == regexpTypeQuery {
- r.regexp.queries = append(r.regexp.queries, rr)
- } else {
- r.regexp.path = rr
- }
- }
- r.addMatcher(rr)
- return nil
-}
-
-// Headers --------------------------------------------------------------------
-
-// headerMatcher matches the request against header values.
-type headerMatcher map[string]string
-
-func (m headerMatcher) Match(r *http.Request, match *RouteMatch) bool {
- return matchMapWithString(m, r.Header, true)
-}
-
-// Headers adds a matcher for request header values.
-// It accepts a sequence of key/value pairs to be matched. For example:
-//
-// r := mux.NewRouter()
-// r.Headers("Content-Type", "application/json",
-// "X-Requested-With", "XMLHttpRequest")
-//
-// The above route will only match if both request header values match.
-// If the value is an empty string, it will match any value if the key is set.
-func (r *Route) Headers(pairs ...string) *Route {
- if r.err == nil {
- var headers map[string]string
- headers, r.err = mapFromPairsToString(pairs...)
- return r.addMatcher(headerMatcher(headers))
- }
- return r
-}
-
-// headerRegexMatcher matches the request against the route given a regex for the header
-type headerRegexMatcher map[string]*regexp.Regexp
-
-func (m headerRegexMatcher) Match(r *http.Request, match *RouteMatch) bool {
- return matchMapWithRegex(m, r.Header, true)
-}
-
-// HeadersRegexp accepts a sequence of key/value pairs, where the value has regex
-// support. For example:
-//
-// r := mux.NewRouter()
-// r.HeadersRegexp("Content-Type", "application/(text|json)",
-// "X-Requested-With", "XMLHttpRequest")
-//
-// The above route will only match if both the request header matches both regular expressions.
-// If the value is an empty string, it will match any value if the key is set.
-// Use the start and end of string anchors (^ and $) to match an exact value.
-func (r *Route) HeadersRegexp(pairs ...string) *Route {
- if r.err == nil {
- var headers map[string]*regexp.Regexp
- headers, r.err = mapFromPairsToRegex(pairs...)
- return r.addMatcher(headerRegexMatcher(headers))
- }
- return r
-}
-
-// Host -----------------------------------------------------------------------
-
-// Host adds a matcher for the URL host.
-// It accepts a template with zero or more URL variables enclosed by {}.
-// Variables can define an optional regexp pattern to be matched:
-//
-// - {name} matches anything until the next dot.
-//
-// - {name:pattern} matches the given regexp pattern.
-//
-// For example:
-//
-// r := mux.NewRouter()
-// r.Host("www.example.com")
-// r.Host("{subdomain}.domain.com")
-// r.Host("{subdomain:[a-z]+}.domain.com")
-//
-// Variable names must be unique in a given route. They can be retrieved
-// calling mux.Vars(request).
-func (r *Route) Host(tpl string) *Route {
- r.err = r.addRegexpMatcher(tpl, regexpTypeHost)
- return r
-}
-
-// MatcherFunc ----------------------------------------------------------------
-
-// MatcherFunc is the function signature used by custom matchers.
-type MatcherFunc func(*http.Request, *RouteMatch) bool
-
-// Match returns the match for a given request.
-func (m MatcherFunc) Match(r *http.Request, match *RouteMatch) bool {
- return m(r, match)
-}
-
-// MatcherFunc adds a custom function to be used as request matcher.
-func (r *Route) MatcherFunc(f MatcherFunc) *Route {
- return r.addMatcher(f)
-}
-
-// Methods --------------------------------------------------------------------
-
-// methodMatcher matches the request against HTTP methods.
-type methodMatcher []string
-
-func (m methodMatcher) Match(r *http.Request, match *RouteMatch) bool {
- return matchInArray(m, r.Method)
-}
-
-// Methods adds a matcher for HTTP methods.
-// It accepts a sequence of one or more methods to be matched, e.g.:
-// "GET", "POST", "PUT".
-func (r *Route) Methods(methods ...string) *Route {
- for k, v := range methods {
- methods[k] = strings.ToUpper(v)
- }
- return r.addMatcher(methodMatcher(methods))
-}
-
-// Path -----------------------------------------------------------------------
-
-// Path adds a matcher for the URL path.
-// It accepts a template with zero or more URL variables enclosed by {}. The
-// template must start with a "/".
-// Variables can define an optional regexp pattern to be matched:
-//
-// - {name} matches anything until the next slash.
-//
-// - {name:pattern} matches the given regexp pattern.
-//
-// For example:
-//
-// r := mux.NewRouter()
-// r.Path("/products/").Handler(ProductsHandler)
-// r.Path("/products/{key}").Handler(ProductsHandler)
-// r.Path("/articles/{category}/{id:[0-9]+}").
-// Handler(ArticleHandler)
-//
-// Variable names must be unique in a given route. They can be retrieved
-// calling mux.Vars(request).
-func (r *Route) Path(tpl string) *Route {
- r.err = r.addRegexpMatcher(tpl, regexpTypePath)
- return r
-}
-
-// PathPrefix -----------------------------------------------------------------
-
-// PathPrefix adds a matcher for the URL path prefix. This matches if the given
-// template is a prefix of the full URL path. See Route.Path() for details on
-// the tpl argument.
-//
-// Note that it does not treat slashes specially ("/foobar/" will be matched by
-// the prefix "/foo") so you may want to use a trailing slash here.
-//
-// Also note that the setting of Router.StrictSlash() has no effect on routes
-// with a PathPrefix matcher.
-func (r *Route) PathPrefix(tpl string) *Route {
- r.err = r.addRegexpMatcher(tpl, regexpTypePrefix)
- return r
-}
-
-// Query ----------------------------------------------------------------------
-
-// Queries adds a matcher for URL query values.
-// It accepts a sequence of key/value pairs. Values may define variables.
-// For example:
-//
-// r := mux.NewRouter()
-// r.Queries("foo", "bar", "id", "{id:[0-9]+}")
-//
-// The above route will only match if the URL contains the defined queries
-// values, e.g.: ?foo=bar&id=42.
-//
-// If the value is an empty string, it will match any value if the key is set.
-//
-// Variables can define an optional regexp pattern to be matched:
-//
-// - {name} matches anything until the next slash.
-//
-// - {name:pattern} matches the given regexp pattern.
-func (r *Route) Queries(pairs ...string) *Route {
- length := len(pairs)
- if length%2 != 0 {
- r.err = fmt.Errorf(
- "mux: number of parameters must be multiple of 2, got %v", pairs)
- return nil
- }
- for i := 0; i < length; i += 2 {
- if r.err = r.addRegexpMatcher(pairs[i]+"="+pairs[i+1], regexpTypeQuery); r.err != nil {
- return r
- }
- }
-
- return r
-}
-
-// Schemes --------------------------------------------------------------------
-
-// schemeMatcher matches the request against URL schemes.
-type schemeMatcher []string
-
-func (m schemeMatcher) Match(r *http.Request, match *RouteMatch) bool {
- return matchInArray(m, r.URL.Scheme)
-}
-
-// Schemes adds a matcher for URL schemes.
-// It accepts a sequence of schemes to be matched, e.g.: "http", "https".
-func (r *Route) Schemes(schemes ...string) *Route {
- for k, v := range schemes {
- schemes[k] = strings.ToLower(v)
- }
- if len(schemes) > 0 {
- r.buildScheme = schemes[0]
- }
- return r.addMatcher(schemeMatcher(schemes))
-}
-
-// BuildVarsFunc --------------------------------------------------------------
-
-// BuildVarsFunc is the function signature used by custom build variable
-// functions (which can modify route variables before a route's URL is built).
-type BuildVarsFunc func(map[string]string) map[string]string
-
-// BuildVarsFunc adds a custom function to be used to modify build variables
-// before a route's URL is built.
-func (r *Route) BuildVarsFunc(f BuildVarsFunc) *Route {
- if r.buildVarsFunc != nil {
- // compose the old and new functions
- old := r.buildVarsFunc
- r.buildVarsFunc = func(m map[string]string) map[string]string {
- return f(old(m))
- }
- } else {
- r.buildVarsFunc = f
- }
- return r
-}
-
-// Subrouter ------------------------------------------------------------------
-
-// Subrouter creates a subrouter for the route.
-//
-// It will test the inner routes only if the parent route matched. For example:
-//
-// r := mux.NewRouter()
-// s := r.Host("www.example.com").Subrouter()
-// s.HandleFunc("/products/", ProductsHandler)
-// s.HandleFunc("/products/{key}", ProductHandler)
-// s.HandleFunc("/articles/{category}/{id:[0-9]+}"), ArticleHandler)
-//
-// Here, the routes registered in the subrouter won't be tested if the host
-// doesn't match.
-func (r *Route) Subrouter() *Router {
- // initialize a subrouter with a copy of the parent route's configuration
- router := &Router{routeConf: copyRouteConf(r.routeConf), namedRoutes: r.namedRoutes}
- r.addMatcher(router)
- return router
-}
-
-// ----------------------------------------------------------------------------
-// URL building
-// ----------------------------------------------------------------------------
-
-// URL builds a URL for the route.
-//
-// It accepts a sequence of key/value pairs for the route variables. For
-// example, given this route:
-//
-// r := mux.NewRouter()
-// r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
-// Name("article")
-//
-// ...a URL for it can be built using:
-//
-// url, err := r.Get("article").URL("category", "technology", "id", "42")
-//
-// ...which will return an url.URL with the following path:
-//
-// "/articles/technology/42"
-//
-// This also works for host variables:
-//
-// r := mux.NewRouter()
-// r.Host("{subdomain}.domain.com").
-// HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler).
-// Name("article")
-//
-// // url.String() will be "http://news.domain.com/articles/technology/42"
-// url, err := r.Get("article").URL("subdomain", "news",
-// "category", "technology",
-// "id", "42")
-//
-// All variables defined in the route are required, and their values must
-// conform to the corresponding patterns.
-func (r *Route) URL(pairs ...string) (*url.URL, error) {
- if r.err != nil {
- return nil, r.err
- }
- values, err := r.prepareVars(pairs...)
- if err != nil {
- return nil, err
- }
- var scheme, host, path string
- queries := make([]string, 0, len(r.regexp.queries))
- if r.regexp.host != nil {
- if host, err = r.regexp.host.url(values); err != nil {
- return nil, err
- }
- scheme = "http"
- if r.buildScheme != "" {
- scheme = r.buildScheme
- }
- }
- if r.regexp.path != nil {
- if path, err = r.regexp.path.url(values); err != nil {
- return nil, err
- }
- }
- for _, q := range r.regexp.queries {
- var query string
- if query, err = q.url(values); err != nil {
- return nil, err
- }
- queries = append(queries, query)
- }
- return &url.URL{
- Scheme: scheme,
- Host: host,
- Path: path,
- RawQuery: strings.Join(queries, "&"),
- }, nil
-}
-
-// URLHost builds the host part of the URL for a route. See Route.URL().
-//
-// The route must have a host defined.
-func (r *Route) URLHost(pairs ...string) (*url.URL, error) {
- if r.err != nil {
- return nil, r.err
- }
- if r.regexp.host == nil {
- return nil, errors.New("mux: route doesn't have a host")
- }
- values, err := r.prepareVars(pairs...)
- if err != nil {
- return nil, err
- }
- host, err := r.regexp.host.url(values)
- if err != nil {
- return nil, err
- }
- u := &url.URL{
- Scheme: "http",
- Host: host,
- }
- if r.buildScheme != "" {
- u.Scheme = r.buildScheme
- }
- return u, nil
-}
-
-// URLPath builds the path part of the URL for a route. See Route.URL().
-//
-// The route must have a path defined.
-func (r *Route) URLPath(pairs ...string) (*url.URL, error) {
- if r.err != nil {
- return nil, r.err
- }
- if r.regexp.path == nil {
- return nil, errors.New("mux: route doesn't have a path")
- }
- values, err := r.prepareVars(pairs...)
- if err != nil {
- return nil, err
- }
- path, err := r.regexp.path.url(values)
- if err != nil {
- return nil, err
- }
- return &url.URL{
- Path: path,
- }, nil
-}
-
-// GetPathTemplate returns the template used to build the
-// route match.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not define a path.
-func (r *Route) GetPathTemplate() (string, error) {
- if r.err != nil {
- return "", r.err
- }
- if r.regexp.path == nil {
- return "", errors.New("mux: route doesn't have a path")
- }
- return r.regexp.path.template, nil
-}
-
-// GetPathRegexp returns the expanded regular expression used to match route path.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not define a path.
-func (r *Route) GetPathRegexp() (string, error) {
- if r.err != nil {
- return "", r.err
- }
- if r.regexp.path == nil {
- return "", errors.New("mux: route does not have a path")
- }
- return r.regexp.path.regexp.String(), nil
-}
-
-// GetQueriesRegexp returns the expanded regular expressions used to match the
-// route queries.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not have queries.
-func (r *Route) GetQueriesRegexp() ([]string, error) {
- if r.err != nil {
- return nil, r.err
- }
- if r.regexp.queries == nil {
- return nil, errors.New("mux: route doesn't have queries")
- }
- var queries []string
- for _, query := range r.regexp.queries {
- queries = append(queries, query.regexp.String())
- }
- return queries, nil
-}
-
-// GetQueriesTemplates returns the templates used to build the
-// query matching.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not define queries.
-func (r *Route) GetQueriesTemplates() ([]string, error) {
- if r.err != nil {
- return nil, r.err
- }
- if r.regexp.queries == nil {
- return nil, errors.New("mux: route doesn't have queries")
- }
- var queries []string
- for _, query := range r.regexp.queries {
- queries = append(queries, query.template)
- }
- return queries, nil
-}
-
-// GetMethods returns the methods the route matches against
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if route does not have methods.
-func (r *Route) GetMethods() ([]string, error) {
- if r.err != nil {
- return nil, r.err
- }
- for _, m := range r.matchers {
- if methods, ok := m.(methodMatcher); ok {
- return []string(methods), nil
- }
- }
- return nil, errors.New("mux: route doesn't have methods")
-}
-
-// GetHostTemplate returns the template used to build the
-// route match.
-// This is useful for building simple REST API documentation and for instrumentation
-// against third-party services.
-// An error will be returned if the route does not define a host.
-func (r *Route) GetHostTemplate() (string, error) {
- if r.err != nil {
- return "", r.err
- }
- if r.regexp.host == nil {
- return "", errors.New("mux: route doesn't have a host")
- }
- return r.regexp.host.template, nil
-}
-
-// prepareVars converts the route variable pairs into a map. If the route has a
-// BuildVarsFunc, it is invoked.
-func (r *Route) prepareVars(pairs ...string) (map[string]string, error) {
- m, err := mapFromPairsToString(pairs...)
- if err != nil {
- return nil, err
- }
- return r.buildVars(m), nil
-}
-
-func (r *Route) buildVars(m map[string]string) map[string]string {
- if r.buildVarsFunc != nil {
- m = r.buildVarsFunc(m)
- }
- return m
-}
diff --git a/vendor/github.com/gorilla/mux/test_helpers.go b/vendor/github.com/gorilla/mux/test_helpers.go
deleted file mode 100644
index 32ecffde489f43aa0a73ff86e151cca3373daae6..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/mux/test_helpers.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2012 The Gorilla Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package mux
-
-import "net/http"
-
-// SetURLVars sets the URL variables for the given request, to be accessed via
-// mux.Vars for testing route behaviour. Arguments are not modified, a shallow
-// copy is returned.
-//
-// This API should only be used for testing purposes; it provides a way to
-// inject variables into the request context. Alternatively, URL variables
-// can be set by making a route that captures the required variables,
-// starting a server and sending the request to that server.
-func SetURLVars(r *http.Request, val map[string]string) *http.Request {
- return setVars(r, val)
-}
diff --git a/vendor/github.com/gorilla/websocket/.gitignore b/vendor/github.com/gorilla/websocket/.gitignore
deleted file mode 100644
index ac710204fa195a2a4f17fde1fa75f15ba8c2b714..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/.gitignore
+++ /dev/null
@@ -1,25 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-
-.idea/
-*.iml
\ No newline at end of file
diff --git a/vendor/github.com/gorilla/websocket/.travis.yml b/vendor/github.com/gorilla/websocket/.travis.yml
deleted file mode 100644
index 3d8d29cf34bef61e9fabb7031589d56fc90fe52d..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/.travis.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-language: go
-sudo: false
-
-matrix:
- include:
- - go: 1.4
- - go: 1.5
- - go: 1.6
- - go: 1.7
- - go: 1.8
- - go: tip
- allow_failures:
- - go: tip
-
-script:
- - go get -t -v ./...
- - diff -u <(echo -n) <(gofmt -d .)
- - go vet $(go list ./... | grep -v /vendor/)
- - go test -v -race ./...
diff --git a/vendor/github.com/gorilla/websocket/AUTHORS b/vendor/github.com/gorilla/websocket/AUTHORS
deleted file mode 100644
index b003eca0ca187243683ea444142d4465dd77b619..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/AUTHORS
+++ /dev/null
@@ -1,8 +0,0 @@
-# This is the official list of Gorilla WebSocket authors for copyright
-# purposes.
-#
-# Please keep the list sorted.
-
-Gary Burd
-Joachim Bauch
-
diff --git a/vendor/github.com/gorilla/websocket/LICENSE b/vendor/github.com/gorilla/websocket/LICENSE
deleted file mode 100644
index 9171c972252257cf416925ddff4be6cb73973a82..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/gorilla/websocket/README.md b/vendor/github.com/gorilla/websocket/README.md
deleted file mode 100644
index 33c3d2be3e3d000612d906de645aaa5c7f64a62c..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/README.md
+++ /dev/null
@@ -1,64 +0,0 @@
-# Gorilla WebSocket
-
-Gorilla WebSocket is a [Go](http://golang.org/) implementation of the
-[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol.
-
-[](https://travis-ci.org/gorilla/websocket)
-[](https://godoc.org/github.com/gorilla/websocket)
-
-### Documentation
-
-* [API Reference](http://godoc.org/github.com/gorilla/websocket)
-* [Chat example](https://github.com/gorilla/websocket/tree/master/examples/chat)
-* [Command example](https://github.com/gorilla/websocket/tree/master/examples/command)
-* [Client and server example](https://github.com/gorilla/websocket/tree/master/examples/echo)
-* [File watch example](https://github.com/gorilla/websocket/tree/master/examples/filewatch)
-
-### Status
-
-The Gorilla WebSocket package provides a complete and tested implementation of
-the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. The
-package API is stable.
-
-### Installation
-
- go get github.com/gorilla/websocket
-
-### Protocol Compliance
-
-The Gorilla WebSocket package passes the server tests in the [Autobahn Test
-Suite](http://autobahn.ws/testsuite) using the application in the [examples/autobahn
-subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn).
-
-### Gorilla WebSocket compared with other packages
-
-
-
-Notes:
-
-1. Large messages are fragmented in [Chrome's new WebSocket implementation](http://www.ietf.org/mail-archive/web/hybi/current/msg10503.html).
-2. The application can get the type of a received data message by implementing
- a [Codec marshal](http://godoc.org/golang.org/x/net/websocket#Codec.Marshal)
- function.
-3. The go.net io.Reader and io.Writer operate across WebSocket frame boundaries.
- Read returns when the input buffer is full or a frame boundary is
- encountered. Each call to Write sends a single frame message. The Gorilla
- io.Reader and io.WriteCloser operate on a single WebSocket message.
-
diff --git a/vendor/github.com/gorilla/websocket/client.go b/vendor/github.com/gorilla/websocket/client.go
deleted file mode 100644
index 43a87c753bfce1f378ba1bd7462890b18cf30b01..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/client.go
+++ /dev/null
@@ -1,392 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package websocket
-
-import (
- "bufio"
- "bytes"
- "crypto/tls"
- "encoding/base64"
- "errors"
- "io"
- "io/ioutil"
- "net"
- "net/http"
- "net/url"
- "strings"
- "time"
-)
-
-// ErrBadHandshake is returned when the server response to opening handshake is
-// invalid.
-var ErrBadHandshake = errors.New("websocket: bad handshake")
-
-var errInvalidCompression = errors.New("websocket: invalid compression negotiation")
-
-// NewClient creates a new client connection using the given net connection.
-// The URL u specifies the host and request URI. Use requestHeader to specify
-// the origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies
-// (Cookie). Use the response.Header to get the selected subprotocol
-// (Sec-WebSocket-Protocol) and cookies (Set-Cookie).
-//
-// If the WebSocket handshake fails, ErrBadHandshake is returned along with a
-// non-nil *http.Response so that callers can handle redirects, authentication,
-// etc.
-//
-// Deprecated: Use Dialer instead.
-func NewClient(netConn net.Conn, u *url.URL, requestHeader http.Header, readBufSize, writeBufSize int) (c *Conn, response *http.Response, err error) {
- d := Dialer{
- ReadBufferSize: readBufSize,
- WriteBufferSize: writeBufSize,
- NetDial: func(net, addr string) (net.Conn, error) {
- return netConn, nil
- },
- }
- return d.Dial(u.String(), requestHeader)
-}
-
-// A Dialer contains options for connecting to WebSocket server.
-type Dialer struct {
- // NetDial specifies the dial function for creating TCP connections. If
- // NetDial is nil, net.Dial is used.
- NetDial func(network, addr string) (net.Conn, error)
-
- // Proxy specifies a function to return a proxy for a given
- // Request. If the function returns a non-nil error, the
- // request is aborted with the provided error.
- // If Proxy is nil or returns a nil *URL, no proxy is used.
- Proxy func(*http.Request) (*url.URL, error)
-
- // TLSClientConfig specifies the TLS configuration to use with tls.Client.
- // If nil, the default configuration is used.
- TLSClientConfig *tls.Config
-
- // HandshakeTimeout specifies the duration for the handshake to complete.
- HandshakeTimeout time.Duration
-
- // ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer
- // size is zero, then a useful default size is used. The I/O buffer sizes
- // do not limit the size of the messages that can be sent or received.
- ReadBufferSize, WriteBufferSize int
-
- // Subprotocols specifies the client's requested subprotocols.
- Subprotocols []string
-
- // EnableCompression specifies if the client should attempt to negotiate
- // per message compression (RFC 7692). Setting this value to true does not
- // guarantee that compression will be supported. Currently only "no context
- // takeover" modes are supported.
- EnableCompression bool
-
- // Jar specifies the cookie jar.
- // If Jar is nil, cookies are not sent in requests and ignored
- // in responses.
- Jar http.CookieJar
-}
-
-var errMalformedURL = errors.New("malformed ws or wss URL")
-
-// parseURL parses the URL.
-//
-// This function is a replacement for the standard library url.Parse function.
-// In Go 1.4 and earlier, url.Parse loses information from the path.
-func parseURL(s string) (*url.URL, error) {
- // From the RFC:
- //
- // ws-URI = "ws:" "//" host [ ":" port ] path [ "?" query ]
- // wss-URI = "wss:" "//" host [ ":" port ] path [ "?" query ]
- var u url.URL
- switch {
- case strings.HasPrefix(s, "ws://"):
- u.Scheme = "ws"
- s = s[len("ws://"):]
- case strings.HasPrefix(s, "wss://"):
- u.Scheme = "wss"
- s = s[len("wss://"):]
- default:
- return nil, errMalformedURL
- }
-
- if i := strings.Index(s, "?"); i >= 0 {
- u.RawQuery = s[i+1:]
- s = s[:i]
- }
-
- if i := strings.Index(s, "/"); i >= 0 {
- u.Opaque = s[i:]
- s = s[:i]
- } else {
- u.Opaque = "/"
- }
-
- u.Host = s
-
- if strings.Contains(u.Host, "@") {
- // Don't bother parsing user information because user information is
- // not allowed in websocket URIs.
- return nil, errMalformedURL
- }
-
- return &u, nil
-}
-
-func hostPortNoPort(u *url.URL) (hostPort, hostNoPort string) {
- hostPort = u.Host
- hostNoPort = u.Host
- if i := strings.LastIndex(u.Host, ":"); i > strings.LastIndex(u.Host, "]") {
- hostNoPort = hostNoPort[:i]
- } else {
- switch u.Scheme {
- case "wss":
- hostPort += ":443"
- case "https":
- hostPort += ":443"
- default:
- hostPort += ":80"
- }
- }
- return hostPort, hostNoPort
-}
-
-// DefaultDialer is a dialer with all fields set to the default zero values.
-var DefaultDialer = &Dialer{
- Proxy: http.ProxyFromEnvironment,
-}
-
-// Dial creates a new client connection. Use requestHeader to specify the
-// origin (Origin), subprotocols (Sec-WebSocket-Protocol) and cookies (Cookie).
-// Use the response.Header to get the selected subprotocol
-// (Sec-WebSocket-Protocol) and cookies (Set-Cookie).
-//
-// If the WebSocket handshake fails, ErrBadHandshake is returned along with a
-// non-nil *http.Response so that callers can handle redirects, authentication,
-// etcetera. The response body may not contain the entire response and does not
-// need to be closed by the application.
-func (d *Dialer) Dial(urlStr string, requestHeader http.Header) (*Conn, *http.Response, error) {
-
- if d == nil {
- d = &Dialer{
- Proxy: http.ProxyFromEnvironment,
- }
- }
-
- challengeKey, err := generateChallengeKey()
- if err != nil {
- return nil, nil, err
- }
-
- u, err := parseURL(urlStr)
- if err != nil {
- return nil, nil, err
- }
-
- switch u.Scheme {
- case "ws":
- u.Scheme = "http"
- case "wss":
- u.Scheme = "https"
- default:
- return nil, nil, errMalformedURL
- }
-
- if u.User != nil {
- // User name and password are not allowed in websocket URIs.
- return nil, nil, errMalformedURL
- }
-
- req := &http.Request{
- Method: "GET",
- URL: u,
- Proto: "HTTP/1.1",
- ProtoMajor: 1,
- ProtoMinor: 1,
- Header: make(http.Header),
- Host: u.Host,
- }
-
- // Set the cookies present in the cookie jar of the dialer
- if d.Jar != nil {
- for _, cookie := range d.Jar.Cookies(u) {
- req.AddCookie(cookie)
- }
- }
-
- // Set the request headers using the capitalization for names and values in
- // RFC examples. Although the capitalization shouldn't matter, there are
- // servers that depend on it. The Header.Set method is not used because the
- // method canonicalizes the header names.
- req.Header["Upgrade"] = []string{"websocket"}
- req.Header["Connection"] = []string{"Upgrade"}
- req.Header["Sec-WebSocket-Key"] = []string{challengeKey}
- req.Header["Sec-WebSocket-Version"] = []string{"13"}
- if len(d.Subprotocols) > 0 {
- req.Header["Sec-WebSocket-Protocol"] = []string{strings.Join(d.Subprotocols, ", ")}
- }
- for k, vs := range requestHeader {
- switch {
- case k == "Host":
- if len(vs) > 0 {
- req.Host = vs[0]
- }
- case k == "Upgrade" ||
- k == "Connection" ||
- k == "Sec-Websocket-Key" ||
- k == "Sec-Websocket-Version" ||
- k == "Sec-Websocket-Extensions" ||
- (k == "Sec-Websocket-Protocol" && len(d.Subprotocols) > 0):
- return nil, nil, errors.New("websocket: duplicate header not allowed: " + k)
- default:
- req.Header[k] = vs
- }
- }
-
- if d.EnableCompression {
- req.Header.Set("Sec-Websocket-Extensions", "permessage-deflate; server_no_context_takeover; client_no_context_takeover")
- }
-
- hostPort, hostNoPort := hostPortNoPort(u)
-
- var proxyURL *url.URL
- // Check wether the proxy method has been configured
- if d.Proxy != nil {
- proxyURL, err = d.Proxy(req)
- }
- if err != nil {
- return nil, nil, err
- }
-
- var targetHostPort string
- if proxyURL != nil {
- targetHostPort, _ = hostPortNoPort(proxyURL)
- } else {
- targetHostPort = hostPort
- }
-
- var deadline time.Time
- if d.HandshakeTimeout != 0 {
- deadline = time.Now().Add(d.HandshakeTimeout)
- }
-
- netDial := d.NetDial
- if netDial == nil {
- netDialer := &net.Dialer{Deadline: deadline}
- netDial = netDialer.Dial
- }
-
- netConn, err := netDial("tcp", targetHostPort)
- if err != nil {
- return nil, nil, err
- }
-
- defer func() {
- if netConn != nil {
- netConn.Close()
- }
- }()
-
- if err := netConn.SetDeadline(deadline); err != nil {
- return nil, nil, err
- }
-
- if proxyURL != nil {
- connectHeader := make(http.Header)
- if user := proxyURL.User; user != nil {
- proxyUser := user.Username()
- if proxyPassword, passwordSet := user.Password(); passwordSet {
- credential := base64.StdEncoding.EncodeToString([]byte(proxyUser + ":" + proxyPassword))
- connectHeader.Set("Proxy-Authorization", "Basic "+credential)
- }
- }
- connectReq := &http.Request{
- Method: "CONNECT",
- URL: &url.URL{Opaque: hostPort},
- Host: hostPort,
- Header: connectHeader,
- }
-
- connectReq.Write(netConn)
-
- // Read response.
- // Okay to use and discard buffered reader here, because
- // TLS server will not speak until spoken to.
- br := bufio.NewReader(netConn)
- resp, err := http.ReadResponse(br, connectReq)
- if err != nil {
- return nil, nil, err
- }
- if resp.StatusCode != 200 {
- f := strings.SplitN(resp.Status, " ", 2)
- return nil, nil, errors.New(f[1])
- }
- }
-
- if u.Scheme == "https" {
- cfg := cloneTLSConfig(d.TLSClientConfig)
- if cfg.ServerName == "" {
- cfg.ServerName = hostNoPort
- }
- tlsConn := tls.Client(netConn, cfg)
- netConn = tlsConn
- if err := tlsConn.Handshake(); err != nil {
- return nil, nil, err
- }
- if !cfg.InsecureSkipVerify {
- if err := tlsConn.VerifyHostname(cfg.ServerName); err != nil {
- return nil, nil, err
- }
- }
- }
-
- conn := newConn(netConn, false, d.ReadBufferSize, d.WriteBufferSize)
-
- if err := req.Write(netConn); err != nil {
- return nil, nil, err
- }
-
- resp, err := http.ReadResponse(conn.br, req)
- if err != nil {
- return nil, nil, err
- }
-
- if d.Jar != nil {
- if rc := resp.Cookies(); len(rc) > 0 {
- d.Jar.SetCookies(u, rc)
- }
- }
-
- if resp.StatusCode != 101 ||
- !strings.EqualFold(resp.Header.Get("Upgrade"), "websocket") ||
- !strings.EqualFold(resp.Header.Get("Connection"), "upgrade") ||
- resp.Header.Get("Sec-Websocket-Accept") != computeAcceptKey(challengeKey) {
- // Before closing the network connection on return from this
- // function, slurp up some of the response to aid application
- // debugging.
- buf := make([]byte, 1024)
- n, _ := io.ReadFull(resp.Body, buf)
- resp.Body = ioutil.NopCloser(bytes.NewReader(buf[:n]))
- return nil, resp, ErrBadHandshake
- }
-
- for _, ext := range parseExtensions(resp.Header) {
- if ext[""] != "permessage-deflate" {
- continue
- }
- _, snct := ext["server_no_context_takeover"]
- _, cnct := ext["client_no_context_takeover"]
- if !snct || !cnct {
- return nil, resp, errInvalidCompression
- }
- conn.newCompressionWriter = compressNoContextTakeover
- conn.newDecompressionReader = decompressNoContextTakeover
- break
- }
-
- resp.Body = ioutil.NopCloser(bytes.NewReader([]byte{}))
- conn.subprotocol = resp.Header.Get("Sec-Websocket-Protocol")
-
- netConn.SetDeadline(time.Time{})
- netConn = nil // to avoid close in defer.
- return conn, resp, nil
-}
diff --git a/vendor/github.com/gorilla/websocket/client_clone.go b/vendor/github.com/gorilla/websocket/client_clone.go
deleted file mode 100644
index 4f0d943723a9d094c1693892812377a51f6791bb..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/client_clone.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.8
-
-package websocket
-
-import "crypto/tls"
-
-func cloneTLSConfig(cfg *tls.Config) *tls.Config {
- if cfg == nil {
- return &tls.Config{}
- }
- return cfg.Clone()
-}
diff --git a/vendor/github.com/gorilla/websocket/client_clone_legacy.go b/vendor/github.com/gorilla/websocket/client_clone_legacy.go
deleted file mode 100644
index babb007fb4144ac456faeb685e24b62186c7c517..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/client_clone_legacy.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.8
-
-package websocket
-
-import "crypto/tls"
-
-// cloneTLSConfig clones all public fields except the fields
-// SessionTicketsDisabled and SessionTicketKey. This avoids copying the
-// sync.Mutex in the sync.Once and makes it safe to call cloneTLSConfig on a
-// config in active use.
-func cloneTLSConfig(cfg *tls.Config) *tls.Config {
- if cfg == nil {
- return &tls.Config{}
- }
- return &tls.Config{
- Rand: cfg.Rand,
- Time: cfg.Time,
- Certificates: cfg.Certificates,
- NameToCertificate: cfg.NameToCertificate,
- GetCertificate: cfg.GetCertificate,
- RootCAs: cfg.RootCAs,
- NextProtos: cfg.NextProtos,
- ServerName: cfg.ServerName,
- ClientAuth: cfg.ClientAuth,
- ClientCAs: cfg.ClientCAs,
- InsecureSkipVerify: cfg.InsecureSkipVerify,
- CipherSuites: cfg.CipherSuites,
- PreferServerCipherSuites: cfg.PreferServerCipherSuites,
- ClientSessionCache: cfg.ClientSessionCache,
- MinVersion: cfg.MinVersion,
- MaxVersion: cfg.MaxVersion,
- CurvePreferences: cfg.CurvePreferences,
- }
-}
diff --git a/vendor/github.com/gorilla/websocket/compression.go b/vendor/github.com/gorilla/websocket/compression.go
deleted file mode 100644
index 813ffb1e84336da415256244366e09bcd65b6765..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/compression.go
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package websocket
-
-import (
- "compress/flate"
- "errors"
- "io"
- "strings"
- "sync"
-)
-
-const (
- minCompressionLevel = -2 // flate.HuffmanOnly not defined in Go < 1.6
- maxCompressionLevel = flate.BestCompression
- defaultCompressionLevel = 1
-)
-
-var (
- flateWriterPools [maxCompressionLevel - minCompressionLevel + 1]sync.Pool
- flateReaderPool = sync.Pool{New: func() interface{} {
- return flate.NewReader(nil)
- }}
-)
-
-func decompressNoContextTakeover(r io.Reader) io.ReadCloser {
- const tail =
- // Add four bytes as specified in RFC
- "\x00\x00\xff\xff" +
- // Add final block to squelch unexpected EOF error from flate reader.
- "\x01\x00\x00\xff\xff"
-
- fr, _ := flateReaderPool.Get().(io.ReadCloser)
- fr.(flate.Resetter).Reset(io.MultiReader(r, strings.NewReader(tail)), nil)
- return &flateReadWrapper{fr}
-}
-
-func isValidCompressionLevel(level int) bool {
- return minCompressionLevel <= level && level <= maxCompressionLevel
-}
-
-func compressNoContextTakeover(w io.WriteCloser, level int) io.WriteCloser {
- p := &flateWriterPools[level-minCompressionLevel]
- tw := &truncWriter{w: w}
- fw, _ := p.Get().(*flate.Writer)
- if fw == nil {
- fw, _ = flate.NewWriter(tw, level)
- } else {
- fw.Reset(tw)
- }
- return &flateWriteWrapper{fw: fw, tw: tw, p: p}
-}
-
-// truncWriter is an io.Writer that writes all but the last four bytes of the
-// stream to another io.Writer.
-type truncWriter struct {
- w io.WriteCloser
- n int
- p [4]byte
-}
-
-func (w *truncWriter) Write(p []byte) (int, error) {
- n := 0
-
- // fill buffer first for simplicity.
- if w.n < len(w.p) {
- n = copy(w.p[w.n:], p)
- p = p[n:]
- w.n += n
- if len(p) == 0 {
- return n, nil
- }
- }
-
- m := len(p)
- if m > len(w.p) {
- m = len(w.p)
- }
-
- if nn, err := w.w.Write(w.p[:m]); err != nil {
- return n + nn, err
- }
-
- copy(w.p[:], w.p[m:])
- copy(w.p[len(w.p)-m:], p[len(p)-m:])
- nn, err := w.w.Write(p[:len(p)-m])
- return n + nn, err
-}
-
-type flateWriteWrapper struct {
- fw *flate.Writer
- tw *truncWriter
- p *sync.Pool
-}
-
-func (w *flateWriteWrapper) Write(p []byte) (int, error) {
- if w.fw == nil {
- return 0, errWriteClosed
- }
- return w.fw.Write(p)
-}
-
-func (w *flateWriteWrapper) Close() error {
- if w.fw == nil {
- return errWriteClosed
- }
- err1 := w.fw.Flush()
- w.p.Put(w.fw)
- w.fw = nil
- if w.tw.p != [4]byte{0, 0, 0xff, 0xff} {
- return errors.New("websocket: internal error, unexpected bytes at end of flate stream")
- }
- err2 := w.tw.w.Close()
- if err1 != nil {
- return err1
- }
- return err2
-}
-
-type flateReadWrapper struct {
- fr io.ReadCloser
-}
-
-func (r *flateReadWrapper) Read(p []byte) (int, error) {
- if r.fr == nil {
- return 0, io.ErrClosedPipe
- }
- n, err := r.fr.Read(p)
- if err == io.EOF {
- // Preemptively place the reader back in the pool. This helps with
- // scenarios where the application does not call NextReader() soon after
- // this final read.
- r.Close()
- }
- return n, err
-}
-
-func (r *flateReadWrapper) Close() error {
- if r.fr == nil {
- return io.ErrClosedPipe
- }
- err := r.fr.Close()
- flateReaderPool.Put(r.fr)
- r.fr = nil
- return err
-}
diff --git a/vendor/github.com/gorilla/websocket/conn.go b/vendor/github.com/gorilla/websocket/conn.go
deleted file mode 100644
index 97e1dbacb1237677ceece110c3e9a0a45068f49f..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/conn.go
+++ /dev/null
@@ -1,1149 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package websocket
-
-import (
- "bufio"
- "encoding/binary"
- "errors"
- "io"
- "io/ioutil"
- "math/rand"
- "net"
- "strconv"
- "sync"
- "time"
- "unicode/utf8"
-)
-
-const (
- // Frame header byte 0 bits from Section 5.2 of RFC 6455
- finalBit = 1 << 7
- rsv1Bit = 1 << 6
- rsv2Bit = 1 << 5
- rsv3Bit = 1 << 4
-
- // Frame header byte 1 bits from Section 5.2 of RFC 6455
- maskBit = 1 << 7
-
- maxFrameHeaderSize = 2 + 8 + 4 // Fixed header + length + mask
- maxControlFramePayloadSize = 125
-
- writeWait = time.Second
-
- defaultReadBufferSize = 4096
- defaultWriteBufferSize = 4096
-
- continuationFrame = 0
- noFrame = -1
-)
-
-// Close codes defined in RFC 6455, section 11.7.
-const (
- CloseNormalClosure = 1000
- CloseGoingAway = 1001
- CloseProtocolError = 1002
- CloseUnsupportedData = 1003
- CloseNoStatusReceived = 1005
- CloseAbnormalClosure = 1006
- CloseInvalidFramePayloadData = 1007
- ClosePolicyViolation = 1008
- CloseMessageTooBig = 1009
- CloseMandatoryExtension = 1010
- CloseInternalServerErr = 1011
- CloseServiceRestart = 1012
- CloseTryAgainLater = 1013
- CloseTLSHandshake = 1015
-)
-
-// The message types are defined in RFC 6455, section 11.8.
-const (
- // TextMessage denotes a text data message. The text message payload is
- // interpreted as UTF-8 encoded text data.
- TextMessage = 1
-
- // BinaryMessage denotes a binary data message.
- BinaryMessage = 2
-
- // CloseMessage denotes a close control message. The optional message
- // payload contains a numeric code and text. Use the FormatCloseMessage
- // function to format a close message payload.
- CloseMessage = 8
-
- // PingMessage denotes a ping control message. The optional message payload
- // is UTF-8 encoded text.
- PingMessage = 9
-
- // PongMessage denotes a ping control message. The optional message payload
- // is UTF-8 encoded text.
- PongMessage = 10
-)
-
-// ErrCloseSent is returned when the application writes a message to the
-// connection after sending a close message.
-var ErrCloseSent = errors.New("websocket: close sent")
-
-// ErrReadLimit is returned when reading a message that is larger than the
-// read limit set for the connection.
-var ErrReadLimit = errors.New("websocket: read limit exceeded")
-
-// netError satisfies the net Error interface.
-type netError struct {
- msg string
- temporary bool
- timeout bool
-}
-
-func (e *netError) Error() string { return e.msg }
-func (e *netError) Temporary() bool { return e.temporary }
-func (e *netError) Timeout() bool { return e.timeout }
-
-// CloseError represents close frame.
-type CloseError struct {
-
- // Code is defined in RFC 6455, section 11.7.
- Code int
-
- // Text is the optional text payload.
- Text string
-}
-
-func (e *CloseError) Error() string {
- s := []byte("websocket: close ")
- s = strconv.AppendInt(s, int64(e.Code), 10)
- switch e.Code {
- case CloseNormalClosure:
- s = append(s, " (normal)"...)
- case CloseGoingAway:
- s = append(s, " (going away)"...)
- case CloseProtocolError:
- s = append(s, " (protocol error)"...)
- case CloseUnsupportedData:
- s = append(s, " (unsupported data)"...)
- case CloseNoStatusReceived:
- s = append(s, " (no status)"...)
- case CloseAbnormalClosure:
- s = append(s, " (abnormal closure)"...)
- case CloseInvalidFramePayloadData:
- s = append(s, " (invalid payload data)"...)
- case ClosePolicyViolation:
- s = append(s, " (policy violation)"...)
- case CloseMessageTooBig:
- s = append(s, " (message too big)"...)
- case CloseMandatoryExtension:
- s = append(s, " (mandatory extension missing)"...)
- case CloseInternalServerErr:
- s = append(s, " (internal server error)"...)
- case CloseTLSHandshake:
- s = append(s, " (TLS handshake error)"...)
- }
- if e.Text != "" {
- s = append(s, ": "...)
- s = append(s, e.Text...)
- }
- return string(s)
-}
-
-// IsCloseError returns boolean indicating whether the error is a *CloseError
-// with one of the specified codes.
-func IsCloseError(err error, codes ...int) bool {
- if e, ok := err.(*CloseError); ok {
- for _, code := range codes {
- if e.Code == code {
- return true
- }
- }
- }
- return false
-}
-
-// IsUnexpectedCloseError returns boolean indicating whether the error is a
-// *CloseError with a code not in the list of expected codes.
-func IsUnexpectedCloseError(err error, expectedCodes ...int) bool {
- if e, ok := err.(*CloseError); ok {
- for _, code := range expectedCodes {
- if e.Code == code {
- return false
- }
- }
- return true
- }
- return false
-}
-
-var (
- errWriteTimeout = &netError{msg: "websocket: write timeout", timeout: true, temporary: true}
- errUnexpectedEOF = &CloseError{Code: CloseAbnormalClosure, Text: io.ErrUnexpectedEOF.Error()}
- errBadWriteOpCode = errors.New("websocket: bad write message type")
- errWriteClosed = errors.New("websocket: write closed")
- errInvalidControlFrame = errors.New("websocket: invalid control frame")
-)
-
-func newMaskKey() [4]byte {
- n := rand.Uint32()
- return [4]byte{byte(n), byte(n >> 8), byte(n >> 16), byte(n >> 24)}
-}
-
-func hideTempErr(err error) error {
- if e, ok := err.(net.Error); ok && e.Temporary() {
- err = &netError{msg: e.Error(), timeout: e.Timeout()}
- }
- return err
-}
-
-func isControl(frameType int) bool {
- return frameType == CloseMessage || frameType == PingMessage || frameType == PongMessage
-}
-
-func isData(frameType int) bool {
- return frameType == TextMessage || frameType == BinaryMessage
-}
-
-var validReceivedCloseCodes = map[int]bool{
- // see http://www.iana.org/assignments/websocket/websocket.xhtml#close-code-number
-
- CloseNormalClosure: true,
- CloseGoingAway: true,
- CloseProtocolError: true,
- CloseUnsupportedData: true,
- CloseNoStatusReceived: false,
- CloseAbnormalClosure: false,
- CloseInvalidFramePayloadData: true,
- ClosePolicyViolation: true,
- CloseMessageTooBig: true,
- CloseMandatoryExtension: true,
- CloseInternalServerErr: true,
- CloseServiceRestart: true,
- CloseTryAgainLater: true,
- CloseTLSHandshake: false,
-}
-
-func isValidReceivedCloseCode(code int) bool {
- return validReceivedCloseCodes[code] || (code >= 3000 && code <= 4999)
-}
-
-// The Conn type represents a WebSocket connection.
-type Conn struct {
- conn net.Conn
- isServer bool
- subprotocol string
-
- // Write fields
- mu chan bool // used as mutex to protect write to conn
- writeBuf []byte // frame is constructed in this buffer.
- writeDeadline time.Time
- writer io.WriteCloser // the current writer returned to the application
- isWriting bool // for best-effort concurrent write detection
-
- writeErrMu sync.Mutex
- writeErr error
-
- enableWriteCompression bool
- compressionLevel int
- newCompressionWriter func(io.WriteCloser, int) io.WriteCloser
-
- // Read fields
- reader io.ReadCloser // the current reader returned to the application
- readErr error
- br *bufio.Reader
- readRemaining int64 // bytes remaining in current frame.
- readFinal bool // true the current message has more frames.
- readLength int64 // Message size.
- readLimit int64 // Maximum message size.
- readMaskPos int
- readMaskKey [4]byte
- handlePong func(string) error
- handlePing func(string) error
- handleClose func(int, string) error
- readErrCount int
- messageReader *messageReader // the current low-level reader
-
- readDecompress bool // whether last read frame had RSV1 set
- newDecompressionReader func(io.Reader) io.ReadCloser
-}
-
-func newConn(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int) *Conn {
- return newConnBRW(conn, isServer, readBufferSize, writeBufferSize, nil)
-}
-
-type writeHook struct {
- p []byte
-}
-
-func (wh *writeHook) Write(p []byte) (int, error) {
- wh.p = p
- return len(p), nil
-}
-
-func newConnBRW(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int, brw *bufio.ReadWriter) *Conn {
- mu := make(chan bool, 1)
- mu <- true
-
- var br *bufio.Reader
- if readBufferSize == 0 && brw != nil && brw.Reader != nil {
- // Reuse the supplied bufio.Reader if the buffer has a useful size.
- // This code assumes that peek on a reader returns
- // bufio.Reader.buf[:0].
- brw.Reader.Reset(conn)
- if p, err := brw.Reader.Peek(0); err == nil && cap(p) >= 256 {
- br = brw.Reader
- }
- }
- if br == nil {
- if readBufferSize == 0 {
- readBufferSize = defaultReadBufferSize
- }
- if readBufferSize < maxControlFramePayloadSize {
- readBufferSize = maxControlFramePayloadSize
- }
- br = bufio.NewReaderSize(conn, readBufferSize)
- }
-
- var writeBuf []byte
- if writeBufferSize == 0 && brw != nil && brw.Writer != nil {
- // Use the bufio.Writer's buffer if the buffer has a useful size. This
- // code assumes that bufio.Writer.buf[:1] is passed to the
- // bufio.Writer's underlying writer.
- var wh writeHook
- brw.Writer.Reset(&wh)
- brw.Writer.WriteByte(0)
- brw.Flush()
- if cap(wh.p) >= maxFrameHeaderSize+256 {
- writeBuf = wh.p[:cap(wh.p)]
- }
- }
-
- if writeBuf == nil {
- if writeBufferSize == 0 {
- writeBufferSize = defaultWriteBufferSize
- }
- writeBuf = make([]byte, writeBufferSize+maxFrameHeaderSize)
- }
-
- c := &Conn{
- isServer: isServer,
- br: br,
- conn: conn,
- mu: mu,
- readFinal: true,
- writeBuf: writeBuf,
- enableWriteCompression: true,
- compressionLevel: defaultCompressionLevel,
- }
- c.SetCloseHandler(nil)
- c.SetPingHandler(nil)
- c.SetPongHandler(nil)
- return c
-}
-
-// Subprotocol returns the negotiated protocol for the connection.
-func (c *Conn) Subprotocol() string {
- return c.subprotocol
-}
-
-// Close closes the underlying network connection without sending or waiting for a close frame.
-func (c *Conn) Close() error {
- return c.conn.Close()
-}
-
-// LocalAddr returns the local network address.
-func (c *Conn) LocalAddr() net.Addr {
- return c.conn.LocalAddr()
-}
-
-// RemoteAddr returns the remote network address.
-func (c *Conn) RemoteAddr() net.Addr {
- return c.conn.RemoteAddr()
-}
-
-// Write methods
-
-func (c *Conn) writeFatal(err error) error {
- err = hideTempErr(err)
- c.writeErrMu.Lock()
- if c.writeErr == nil {
- c.writeErr = err
- }
- c.writeErrMu.Unlock()
- return err
-}
-
-func (c *Conn) write(frameType int, deadline time.Time, bufs ...[]byte) error {
- <-c.mu
- defer func() { c.mu <- true }()
-
- c.writeErrMu.Lock()
- err := c.writeErr
- c.writeErrMu.Unlock()
- if err != nil {
- return err
- }
-
- c.conn.SetWriteDeadline(deadline)
- for _, buf := range bufs {
- if len(buf) > 0 {
- _, err := c.conn.Write(buf)
- if err != nil {
- return c.writeFatal(err)
- }
- }
- }
-
- if frameType == CloseMessage {
- c.writeFatal(ErrCloseSent)
- }
- return nil
-}
-
-// WriteControl writes a control message with the given deadline. The allowed
-// message types are CloseMessage, PingMessage and PongMessage.
-func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) error {
- if !isControl(messageType) {
- return errBadWriteOpCode
- }
- if len(data) > maxControlFramePayloadSize {
- return errInvalidControlFrame
- }
-
- b0 := byte(messageType) | finalBit
- b1 := byte(len(data))
- if !c.isServer {
- b1 |= maskBit
- }
-
- buf := make([]byte, 0, maxFrameHeaderSize+maxControlFramePayloadSize)
- buf = append(buf, b0, b1)
-
- if c.isServer {
- buf = append(buf, data...)
- } else {
- key := newMaskKey()
- buf = append(buf, key[:]...)
- buf = append(buf, data...)
- maskBytes(key, 0, buf[6:])
- }
-
- d := time.Hour * 1000
- if !deadline.IsZero() {
- d = deadline.Sub(time.Now())
- if d < 0 {
- return errWriteTimeout
- }
- }
-
- timer := time.NewTimer(d)
- select {
- case <-c.mu:
- timer.Stop()
- case <-timer.C:
- return errWriteTimeout
- }
- defer func() { c.mu <- true }()
-
- c.writeErrMu.Lock()
- err := c.writeErr
- c.writeErrMu.Unlock()
- if err != nil {
- return err
- }
-
- c.conn.SetWriteDeadline(deadline)
- _, err = c.conn.Write(buf)
- if err != nil {
- return c.writeFatal(err)
- }
- if messageType == CloseMessage {
- c.writeFatal(ErrCloseSent)
- }
- return err
-}
-
-func (c *Conn) prepWrite(messageType int) error {
- // Close previous writer if not already closed by the application. It's
- // probably better to return an error in this situation, but we cannot
- // change this without breaking existing applications.
- if c.writer != nil {
- c.writer.Close()
- c.writer = nil
- }
-
- if !isControl(messageType) && !isData(messageType) {
- return errBadWriteOpCode
- }
-
- c.writeErrMu.Lock()
- err := c.writeErr
- c.writeErrMu.Unlock()
- return err
-}
-
-// NextWriter returns a writer for the next message to send. The writer's Close
-// method flushes the complete message to the network.
-//
-// There can be at most one open writer on a connection. NextWriter closes the
-// previous writer if the application has not already done so.
-func (c *Conn) NextWriter(messageType int) (io.WriteCloser, error) {
- if err := c.prepWrite(messageType); err != nil {
- return nil, err
- }
-
- mw := &messageWriter{
- c: c,
- frameType: messageType,
- pos: maxFrameHeaderSize,
- }
- c.writer = mw
- if c.newCompressionWriter != nil && c.enableWriteCompression && isData(messageType) {
- w := c.newCompressionWriter(c.writer, c.compressionLevel)
- mw.compress = true
- c.writer = w
- }
- return c.writer, nil
-}
-
-type messageWriter struct {
- c *Conn
- compress bool // whether next call to flushFrame should set RSV1
- pos int // end of data in writeBuf.
- frameType int // type of the current frame.
- err error
-}
-
-func (w *messageWriter) fatal(err error) error {
- if w.err != nil {
- w.err = err
- w.c.writer = nil
- }
- return err
-}
-
-// flushFrame writes buffered data and extra as a frame to the network. The
-// final argument indicates that this is the last frame in the message.
-func (w *messageWriter) flushFrame(final bool, extra []byte) error {
- c := w.c
- length := w.pos - maxFrameHeaderSize + len(extra)
-
- // Check for invalid control frames.
- if isControl(w.frameType) &&
- (!final || length > maxControlFramePayloadSize) {
- return w.fatal(errInvalidControlFrame)
- }
-
- b0 := byte(w.frameType)
- if final {
- b0 |= finalBit
- }
- if w.compress {
- b0 |= rsv1Bit
- }
- w.compress = false
-
- b1 := byte(0)
- if !c.isServer {
- b1 |= maskBit
- }
-
- // Assume that the frame starts at beginning of c.writeBuf.
- framePos := 0
- if c.isServer {
- // Adjust up if mask not included in the header.
- framePos = 4
- }
-
- switch {
- case length >= 65536:
- c.writeBuf[framePos] = b0
- c.writeBuf[framePos+1] = b1 | 127
- binary.BigEndian.PutUint64(c.writeBuf[framePos+2:], uint64(length))
- case length > 125:
- framePos += 6
- c.writeBuf[framePos] = b0
- c.writeBuf[framePos+1] = b1 | 126
- binary.BigEndian.PutUint16(c.writeBuf[framePos+2:], uint16(length))
- default:
- framePos += 8
- c.writeBuf[framePos] = b0
- c.writeBuf[framePos+1] = b1 | byte(length)
- }
-
- if !c.isServer {
- key := newMaskKey()
- copy(c.writeBuf[maxFrameHeaderSize-4:], key[:])
- maskBytes(key, 0, c.writeBuf[maxFrameHeaderSize:w.pos])
- if len(extra) > 0 {
- return c.writeFatal(errors.New("websocket: internal error, extra used in client mode"))
- }
- }
-
- // Write the buffers to the connection with best-effort detection of
- // concurrent writes. See the concurrency section in the package
- // documentation for more info.
-
- if c.isWriting {
- panic("concurrent write to websocket connection")
- }
- c.isWriting = true
-
- err := c.write(w.frameType, c.writeDeadline, c.writeBuf[framePos:w.pos], extra)
-
- if !c.isWriting {
- panic("concurrent write to websocket connection")
- }
- c.isWriting = false
-
- if err != nil {
- return w.fatal(err)
- }
-
- if final {
- c.writer = nil
- return nil
- }
-
- // Setup for next frame.
- w.pos = maxFrameHeaderSize
- w.frameType = continuationFrame
- return nil
-}
-
-func (w *messageWriter) ncopy(max int) (int, error) {
- n := len(w.c.writeBuf) - w.pos
- if n <= 0 {
- if err := w.flushFrame(false, nil); err != nil {
- return 0, err
- }
- n = len(w.c.writeBuf) - w.pos
- }
- if n > max {
- n = max
- }
- return n, nil
-}
-
-func (w *messageWriter) Write(p []byte) (int, error) {
- if w.err != nil {
- return 0, w.err
- }
-
- if len(p) > 2*len(w.c.writeBuf) && w.c.isServer {
- // Don't buffer large messages.
- err := w.flushFrame(false, p)
- if err != nil {
- return 0, err
- }
- return len(p), nil
- }
-
- nn := len(p)
- for len(p) > 0 {
- n, err := w.ncopy(len(p))
- if err != nil {
- return 0, err
- }
- copy(w.c.writeBuf[w.pos:], p[:n])
- w.pos += n
- p = p[n:]
- }
- return nn, nil
-}
-
-func (w *messageWriter) WriteString(p string) (int, error) {
- if w.err != nil {
- return 0, w.err
- }
-
- nn := len(p)
- for len(p) > 0 {
- n, err := w.ncopy(len(p))
- if err != nil {
- return 0, err
- }
- copy(w.c.writeBuf[w.pos:], p[:n])
- w.pos += n
- p = p[n:]
- }
- return nn, nil
-}
-
-func (w *messageWriter) ReadFrom(r io.Reader) (nn int64, err error) {
- if w.err != nil {
- return 0, w.err
- }
- for {
- if w.pos == len(w.c.writeBuf) {
- err = w.flushFrame(false, nil)
- if err != nil {
- break
- }
- }
- var n int
- n, err = r.Read(w.c.writeBuf[w.pos:])
- w.pos += n
- nn += int64(n)
- if err != nil {
- if err == io.EOF {
- err = nil
- }
- break
- }
- }
- return nn, err
-}
-
-func (w *messageWriter) Close() error {
- if w.err != nil {
- return w.err
- }
- if err := w.flushFrame(true, nil); err != nil {
- return err
- }
- w.err = errWriteClosed
- return nil
-}
-
-// WritePreparedMessage writes prepared message into connection.
-func (c *Conn) WritePreparedMessage(pm *PreparedMessage) error {
- frameType, frameData, err := pm.frame(prepareKey{
- isServer: c.isServer,
- compress: c.newCompressionWriter != nil && c.enableWriteCompression && isData(pm.messageType),
- compressionLevel: c.compressionLevel,
- })
- if err != nil {
- return err
- }
- if c.isWriting {
- panic("concurrent write to websocket connection")
- }
- c.isWriting = true
- err = c.write(frameType, c.writeDeadline, frameData, nil)
- if !c.isWriting {
- panic("concurrent write to websocket connection")
- }
- c.isWriting = false
- return err
-}
-
-// WriteMessage is a helper method for getting a writer using NextWriter,
-// writing the message and closing the writer.
-func (c *Conn) WriteMessage(messageType int, data []byte) error {
-
- if c.isServer && (c.newCompressionWriter == nil || !c.enableWriteCompression) {
- // Fast path with no allocations and single frame.
-
- if err := c.prepWrite(messageType); err != nil {
- return err
- }
- mw := messageWriter{c: c, frameType: messageType, pos: maxFrameHeaderSize}
- n := copy(c.writeBuf[mw.pos:], data)
- mw.pos += n
- data = data[n:]
- return mw.flushFrame(true, data)
- }
-
- w, err := c.NextWriter(messageType)
- if err != nil {
- return err
- }
- if _, err = w.Write(data); err != nil {
- return err
- }
- return w.Close()
-}
-
-// SetWriteDeadline sets the write deadline on the underlying network
-// connection. After a write has timed out, the websocket state is corrupt and
-// all future writes will return an error. A zero value for t means writes will
-// not time out.
-func (c *Conn) SetWriteDeadline(t time.Time) error {
- c.writeDeadline = t
- return nil
-}
-
-// Read methods
-
-func (c *Conn) advanceFrame() (int, error) {
-
- // 1. Skip remainder of previous frame.
-
- if c.readRemaining > 0 {
- if _, err := io.CopyN(ioutil.Discard, c.br, c.readRemaining); err != nil {
- return noFrame, err
- }
- }
-
- // 2. Read and parse first two bytes of frame header.
-
- p, err := c.read(2)
- if err != nil {
- return noFrame, err
- }
-
- final := p[0]&finalBit != 0
- frameType := int(p[0] & 0xf)
- mask := p[1]&maskBit != 0
- c.readRemaining = int64(p[1] & 0x7f)
-
- c.readDecompress = false
- if c.newDecompressionReader != nil && (p[0]&rsv1Bit) != 0 {
- c.readDecompress = true
- p[0] &^= rsv1Bit
- }
-
- if rsv := p[0] & (rsv1Bit | rsv2Bit | rsv3Bit); rsv != 0 {
- return noFrame, c.handleProtocolError("unexpected reserved bits 0x" + strconv.FormatInt(int64(rsv), 16))
- }
-
- switch frameType {
- case CloseMessage, PingMessage, PongMessage:
- if c.readRemaining > maxControlFramePayloadSize {
- return noFrame, c.handleProtocolError("control frame length > 125")
- }
- if !final {
- return noFrame, c.handleProtocolError("control frame not final")
- }
- case TextMessage, BinaryMessage:
- if !c.readFinal {
- return noFrame, c.handleProtocolError("message start before final message frame")
- }
- c.readFinal = final
- case continuationFrame:
- if c.readFinal {
- return noFrame, c.handleProtocolError("continuation after final message frame")
- }
- c.readFinal = final
- default:
- return noFrame, c.handleProtocolError("unknown opcode " + strconv.Itoa(frameType))
- }
-
- // 3. Read and parse frame length.
-
- switch c.readRemaining {
- case 126:
- p, err := c.read(2)
- if err != nil {
- return noFrame, err
- }
- c.readRemaining = int64(binary.BigEndian.Uint16(p))
- case 127:
- p, err := c.read(8)
- if err != nil {
- return noFrame, err
- }
- c.readRemaining = int64(binary.BigEndian.Uint64(p))
- }
-
- // 4. Handle frame masking.
-
- if mask != c.isServer {
- return noFrame, c.handleProtocolError("incorrect mask flag")
- }
-
- if mask {
- c.readMaskPos = 0
- p, err := c.read(len(c.readMaskKey))
- if err != nil {
- return noFrame, err
- }
- copy(c.readMaskKey[:], p)
- }
-
- // 5. For text and binary messages, enforce read limit and return.
-
- if frameType == continuationFrame || frameType == TextMessage || frameType == BinaryMessage {
-
- c.readLength += c.readRemaining
- if c.readLimit > 0 && c.readLength > c.readLimit {
- c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait))
- return noFrame, ErrReadLimit
- }
-
- return frameType, nil
- }
-
- // 6. Read control frame payload.
-
- var payload []byte
- if c.readRemaining > 0 {
- payload, err = c.read(int(c.readRemaining))
- c.readRemaining = 0
- if err != nil {
- return noFrame, err
- }
- if c.isServer {
- maskBytes(c.readMaskKey, 0, payload)
- }
- }
-
- // 7. Process control frame payload.
-
- switch frameType {
- case PongMessage:
- if err := c.handlePong(string(payload)); err != nil {
- return noFrame, err
- }
- case PingMessage:
- if err := c.handlePing(string(payload)); err != nil {
- return noFrame, err
- }
- case CloseMessage:
- closeCode := CloseNoStatusReceived
- closeText := ""
- if len(payload) >= 2 {
- closeCode = int(binary.BigEndian.Uint16(payload))
- if !isValidReceivedCloseCode(closeCode) {
- return noFrame, c.handleProtocolError("invalid close code")
- }
- closeText = string(payload[2:])
- if !utf8.ValidString(closeText) {
- return noFrame, c.handleProtocolError("invalid utf8 payload in close frame")
- }
- }
- if err := c.handleClose(closeCode, closeText); err != nil {
- return noFrame, err
- }
- return noFrame, &CloseError{Code: closeCode, Text: closeText}
- }
-
- return frameType, nil
-}
-
-func (c *Conn) handleProtocolError(message string) error {
- c.WriteControl(CloseMessage, FormatCloseMessage(CloseProtocolError, message), time.Now().Add(writeWait))
- return errors.New("websocket: " + message)
-}
-
-// NextReader returns the next data message received from the peer. The
-// returned messageType is either TextMessage or BinaryMessage.
-//
-// There can be at most one open reader on a connection. NextReader discards
-// the previous message if the application has not already consumed it.
-//
-// Applications must break out of the application's read loop when this method
-// returns a non-nil error value. Errors returned from this method are
-// permanent. Once this method returns a non-nil error, all subsequent calls to
-// this method return the same error.
-func (c *Conn) NextReader() (messageType int, r io.Reader, err error) {
- // Close previous reader, only relevant for decompression.
- if c.reader != nil {
- c.reader.Close()
- c.reader = nil
- }
-
- c.messageReader = nil
- c.readLength = 0
-
- for c.readErr == nil {
- frameType, err := c.advanceFrame()
- if err != nil {
- c.readErr = hideTempErr(err)
- break
- }
- if frameType == TextMessage || frameType == BinaryMessage {
- c.messageReader = &messageReader{c}
- c.reader = c.messageReader
- if c.readDecompress {
- c.reader = c.newDecompressionReader(c.reader)
- }
- return frameType, c.reader, nil
- }
- }
-
- // Applications that do handle the error returned from this method spin in
- // tight loop on connection failure. To help application developers detect
- // this error, panic on repeated reads to the failed connection.
- c.readErrCount++
- if c.readErrCount >= 1000 {
- panic("repeated read on failed websocket connection")
- }
-
- return noFrame, nil, c.readErr
-}
-
-type messageReader struct{ c *Conn }
-
-func (r *messageReader) Read(b []byte) (int, error) {
- c := r.c
- if c.messageReader != r {
- return 0, io.EOF
- }
-
- for c.readErr == nil {
-
- if c.readRemaining > 0 {
- if int64(len(b)) > c.readRemaining {
- b = b[:c.readRemaining]
- }
- n, err := c.br.Read(b)
- c.readErr = hideTempErr(err)
- if c.isServer {
- c.readMaskPos = maskBytes(c.readMaskKey, c.readMaskPos, b[:n])
- }
- c.readRemaining -= int64(n)
- if c.readRemaining > 0 && c.readErr == io.EOF {
- c.readErr = errUnexpectedEOF
- }
- return n, c.readErr
- }
-
- if c.readFinal {
- c.messageReader = nil
- return 0, io.EOF
- }
-
- frameType, err := c.advanceFrame()
- switch {
- case err != nil:
- c.readErr = hideTempErr(err)
- case frameType == TextMessage || frameType == BinaryMessage:
- c.readErr = errors.New("websocket: internal error, unexpected text or binary in Reader")
- }
- }
-
- err := c.readErr
- if err == io.EOF && c.messageReader == r {
- err = errUnexpectedEOF
- }
- return 0, err
-}
-
-func (r *messageReader) Close() error {
- return nil
-}
-
-// ReadMessage is a helper method for getting a reader using NextReader and
-// reading from that reader to a buffer.
-func (c *Conn) ReadMessage() (messageType int, p []byte, err error) {
- var r io.Reader
- messageType, r, err = c.NextReader()
- if err != nil {
- return messageType, nil, err
- }
- p, err = ioutil.ReadAll(r)
- return messageType, p, err
-}
-
-// SetReadDeadline sets the read deadline on the underlying network connection.
-// After a read has timed out, the websocket connection state is corrupt and
-// all future reads will return an error. A zero value for t means reads will
-// not time out.
-func (c *Conn) SetReadDeadline(t time.Time) error {
- return c.conn.SetReadDeadline(t)
-}
-
-// SetReadLimit sets the maximum size for a message read from the peer. If a
-// message exceeds the limit, the connection sends a close frame to the peer
-// and returns ErrReadLimit to the application.
-func (c *Conn) SetReadLimit(limit int64) {
- c.readLimit = limit
-}
-
-// CloseHandler returns the current close handler
-func (c *Conn) CloseHandler() func(code int, text string) error {
- return c.handleClose
-}
-
-// SetCloseHandler sets the handler for close messages received from the peer.
-// The code argument to h is the received close code or CloseNoStatusReceived
-// if the close message is empty. The default close handler sends a close frame
-// back to the peer.
-//
-// The application must read the connection to process close messages as
-// described in the section on Control Frames above.
-//
-// The connection read methods return a CloseError when a close frame is
-// received. Most applications should handle close messages as part of their
-// normal error handling. Applications should only set a close handler when the
-// application must perform some action before sending a close frame back to
-// the peer.
-func (c *Conn) SetCloseHandler(h func(code int, text string) error) {
- if h == nil {
- h = func(code int, text string) error {
- message := []byte{}
- if code != CloseNoStatusReceived {
- message = FormatCloseMessage(code, "")
- }
- c.WriteControl(CloseMessage, message, time.Now().Add(writeWait))
- return nil
- }
- }
- c.handleClose = h
-}
-
-// PingHandler returns the current ping handler
-func (c *Conn) PingHandler() func(appData string) error {
- return c.handlePing
-}
-
-// SetPingHandler sets the handler for ping messages received from the peer.
-// The appData argument to h is the PING frame application data. The default
-// ping handler sends a pong to the peer.
-//
-// The application must read the connection to process ping messages as
-// described in the section on Control Frames above.
-func (c *Conn) SetPingHandler(h func(appData string) error) {
- if h == nil {
- h = func(message string) error {
- err := c.WriteControl(PongMessage, []byte(message), time.Now().Add(writeWait))
- if err == ErrCloseSent {
- return nil
- } else if e, ok := err.(net.Error); ok && e.Temporary() {
- return nil
- }
- return err
- }
- }
- c.handlePing = h
-}
-
-// PongHandler returns the current pong handler
-func (c *Conn) PongHandler() func(appData string) error {
- return c.handlePong
-}
-
-// SetPongHandler sets the handler for pong messages received from the peer.
-// The appData argument to h is the PONG frame application data. The default
-// pong handler does nothing.
-//
-// The application must read the connection to process ping messages as
-// described in the section on Control Frames above.
-func (c *Conn) SetPongHandler(h func(appData string) error) {
- if h == nil {
- h = func(string) error { return nil }
- }
- c.handlePong = h
-}
-
-// UnderlyingConn returns the internal net.Conn. This can be used to further
-// modifications to connection specific flags.
-func (c *Conn) UnderlyingConn() net.Conn {
- return c.conn
-}
-
-// EnableWriteCompression enables and disables write compression of
-// subsequent text and binary messages. This function is a noop if
-// compression was not negotiated with the peer.
-func (c *Conn) EnableWriteCompression(enable bool) {
- c.enableWriteCompression = enable
-}
-
-// SetCompressionLevel sets the flate compression level for subsequent text and
-// binary messages. This function is a noop if compression was not negotiated
-// with the peer. See the compress/flate package for a description of
-// compression levels.
-func (c *Conn) SetCompressionLevel(level int) error {
- if !isValidCompressionLevel(level) {
- return errors.New("websocket: invalid compression level")
- }
- c.compressionLevel = level
- return nil
-}
-
-// FormatCloseMessage formats closeCode and text as a WebSocket close message.
-func FormatCloseMessage(closeCode int, text string) []byte {
- buf := make([]byte, 2+len(text))
- binary.BigEndian.PutUint16(buf, uint16(closeCode))
- copy(buf[2:], text)
- return buf
-}
diff --git a/vendor/github.com/gorilla/websocket/conn_read.go b/vendor/github.com/gorilla/websocket/conn_read.go
deleted file mode 100644
index 1ea15059ee14b675f1ee138a0f3c9df24c727be1..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/conn_read.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.5
-
-package websocket
-
-import "io"
-
-func (c *Conn) read(n int) ([]byte, error) {
- p, err := c.br.Peek(n)
- if err == io.EOF {
- err = errUnexpectedEOF
- }
- c.br.Discard(len(p))
- return p, err
-}
diff --git a/vendor/github.com/gorilla/websocket/conn_read_legacy.go b/vendor/github.com/gorilla/websocket/conn_read_legacy.go
deleted file mode 100644
index 018541cf6cbb2d22d86df0e35ad9db30f7f63689..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/conn_read_legacy.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !go1.5
-
-package websocket
-
-import "io"
-
-func (c *Conn) read(n int) ([]byte, error) {
- p, err := c.br.Peek(n)
- if err == io.EOF {
- err = errUnexpectedEOF
- }
- if len(p) > 0 {
- // advance over the bytes just read
- io.ReadFull(c.br, p)
- }
- return p, err
-}
diff --git a/vendor/github.com/gorilla/websocket/doc.go b/vendor/github.com/gorilla/websocket/doc.go
deleted file mode 100644
index e291a952c1e805604fc6c87e4590ce0d2802780a..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/doc.go
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package websocket implements the WebSocket protocol defined in RFC 6455.
-//
-// Overview
-//
-// The Conn type represents a WebSocket connection. A server application uses
-// the Upgrade function from an Upgrader object with a HTTP request handler
-// to get a pointer to a Conn:
-//
-// var upgrader = websocket.Upgrader{
-// ReadBufferSize: 1024,
-// WriteBufferSize: 1024,
-// }
-//
-// func handler(w http.ResponseWriter, r *http.Request) {
-// conn, err := upgrader.Upgrade(w, r, nil)
-// if err != nil {
-// log.Println(err)
-// return
-// }
-// ... Use conn to send and receive messages.
-// }
-//
-// Call the connection's WriteMessage and ReadMessage methods to send and
-// receive messages as a slice of bytes. This snippet of code shows how to echo
-// messages using these methods:
-//
-// for {
-// messageType, p, err := conn.ReadMessage()
-// if err != nil {
-// return
-// }
-// if err = conn.WriteMessage(messageType, p); err != nil {
-// return err
-// }
-// }
-//
-// In above snippet of code, p is a []byte and messageType is an int with value
-// websocket.BinaryMessage or websocket.TextMessage.
-//
-// An application can also send and receive messages using the io.WriteCloser
-// and io.Reader interfaces. To send a message, call the connection NextWriter
-// method to get an io.WriteCloser, write the message to the writer and close
-// the writer when done. To receive a message, call the connection NextReader
-// method to get an io.Reader and read until io.EOF is returned. This snippet
-// shows how to echo messages using the NextWriter and NextReader methods:
-//
-// for {
-// messageType, r, err := conn.NextReader()
-// if err != nil {
-// return
-// }
-// w, err := conn.NextWriter(messageType)
-// if err != nil {
-// return err
-// }
-// if _, err := io.Copy(w, r); err != nil {
-// return err
-// }
-// if err := w.Close(); err != nil {
-// return err
-// }
-// }
-//
-// Data Messages
-//
-// The WebSocket protocol distinguishes between text and binary data messages.
-// Text messages are interpreted as UTF-8 encoded text. The interpretation of
-// binary messages is left to the application.
-//
-// This package uses the TextMessage and BinaryMessage integer constants to
-// identify the two data message types. The ReadMessage and NextReader methods
-// return the type of the received message. The messageType argument to the
-// WriteMessage and NextWriter methods specifies the type of a sent message.
-//
-// It is the application's responsibility to ensure that text messages are
-// valid UTF-8 encoded text.
-//
-// Control Messages
-//
-// The WebSocket protocol defines three types of control messages: close, ping
-// and pong. Call the connection WriteControl, WriteMessage or NextWriter
-// methods to send a control message to the peer.
-//
-// Connections handle received close messages by sending a close message to the
-// peer and returning a *CloseError from the the NextReader, ReadMessage or the
-// message Read method.
-//
-// Connections handle received ping and pong messages by invoking callback
-// functions set with SetPingHandler and SetPongHandler methods. The callback
-// functions are called from the NextReader, ReadMessage and the message Read
-// methods.
-//
-// The default ping handler sends a pong to the peer. The application's reading
-// goroutine can block for a short time while the handler writes the pong data
-// to the connection.
-//
-// The application must read the connection to process ping, pong and close
-// messages sent from the peer. If the application is not otherwise interested
-// in messages from the peer, then the application should start a goroutine to
-// read and discard messages from the peer. A simple example is:
-//
-// func readLoop(c *websocket.Conn) {
-// for {
-// if _, _, err := c.NextReader(); err != nil {
-// c.Close()
-// break
-// }
-// }
-// }
-//
-// Concurrency
-//
-// Connections support one concurrent reader and one concurrent writer.
-//
-// Applications are responsible for ensuring that no more than one goroutine
-// calls the write methods (NextWriter, SetWriteDeadline, WriteMessage,
-// WriteJSON, EnableWriteCompression, SetCompressionLevel) concurrently and
-// that no more than one goroutine calls the read methods (NextReader,
-// SetReadDeadline, ReadMessage, ReadJSON, SetPongHandler, SetPingHandler)
-// concurrently.
-//
-// The Close and WriteControl methods can be called concurrently with all other
-// methods.
-//
-// Origin Considerations
-//
-// Web browsers allow Javascript applications to open a WebSocket connection to
-// any host. It's up to the server to enforce an origin policy using the Origin
-// request header sent by the browser.
-//
-// The Upgrader calls the function specified in the CheckOrigin field to check
-// the origin. If the CheckOrigin function returns false, then the Upgrade
-// method fails the WebSocket handshake with HTTP status 403.
-//
-// If the CheckOrigin field is nil, then the Upgrader uses a safe default: fail
-// the handshake if the Origin request header is present and not equal to the
-// Host request header.
-//
-// An application can allow connections from any origin by specifying a
-// function that always returns true:
-//
-// var upgrader = websocket.Upgrader{
-// CheckOrigin: func(r *http.Request) bool { return true },
-// }
-//
-// The deprecated Upgrade function does not enforce an origin policy. It's the
-// application's responsibility to check the Origin header before calling
-// Upgrade.
-//
-// Compression EXPERIMENTAL
-//
-// Per message compression extensions (RFC 7692) are experimentally supported
-// by this package in a limited capacity. Setting the EnableCompression option
-// to true in Dialer or Upgrader will attempt to negotiate per message deflate
-// support.
-//
-// var upgrader = websocket.Upgrader{
-// EnableCompression: true,
-// }
-//
-// If compression was successfully negotiated with the connection's peer, any
-// message received in compressed form will be automatically decompressed.
-// All Read methods will return uncompressed bytes.
-//
-// Per message compression of messages written to a connection can be enabled
-// or disabled by calling the corresponding Conn method:
-//
-// conn.EnableWriteCompression(false)
-//
-// Currently this package does not support compression with "context takeover".
-// This means that messages must be compressed and decompressed in isolation,
-// without retaining sliding window or dictionary state across messages. For
-// more details refer to RFC 7692.
-//
-// Use of compression is experimental and may result in decreased performance.
-package websocket
diff --git a/vendor/github.com/gorilla/websocket/json.go b/vendor/github.com/gorilla/websocket/json.go
deleted file mode 100644
index 4f0e36875a5c535e248485923ca74a2beddf9206..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/json.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package websocket
-
-import (
- "encoding/json"
- "io"
-)
-
-// WriteJSON is deprecated, use c.WriteJSON instead.
-func WriteJSON(c *Conn, v interface{}) error {
- return c.WriteJSON(v)
-}
-
-// WriteJSON writes the JSON encoding of v to the connection.
-//
-// See the documentation for encoding/json Marshal for details about the
-// conversion of Go values to JSON.
-func (c *Conn) WriteJSON(v interface{}) error {
- w, err := c.NextWriter(TextMessage)
- if err != nil {
- return err
- }
- err1 := json.NewEncoder(w).Encode(v)
- err2 := w.Close()
- if err1 != nil {
- return err1
- }
- return err2
-}
-
-// ReadJSON is deprecated, use c.ReadJSON instead.
-func ReadJSON(c *Conn, v interface{}) error {
- return c.ReadJSON(v)
-}
-
-// ReadJSON reads the next JSON-encoded message from the connection and stores
-// it in the value pointed to by v.
-//
-// See the documentation for the encoding/json Unmarshal function for details
-// about the conversion of JSON to a Go value.
-func (c *Conn) ReadJSON(v interface{}) error {
- _, r, err := c.NextReader()
- if err != nil {
- return err
- }
- err = json.NewDecoder(r).Decode(v)
- if err == io.EOF {
- // One value is expected in the message.
- err = io.ErrUnexpectedEOF
- }
- return err
-}
diff --git a/vendor/github.com/gorilla/websocket/mask.go b/vendor/github.com/gorilla/websocket/mask.go
deleted file mode 100644
index 6a88bbc74342cd64c6d342c1578fb02ee42bfd22..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/mask.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of
-// this source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
-
-// +build !appengine
-
-package websocket
-
-import "unsafe"
-
-const wordSize = int(unsafe.Sizeof(uintptr(0)))
-
-func maskBytes(key [4]byte, pos int, b []byte) int {
-
- // Mask one byte at a time for small buffers.
- if len(b) < 2*wordSize {
- for i := range b {
- b[i] ^= key[pos&3]
- pos++
- }
- return pos & 3
- }
-
- // Mask one byte at a time to word boundary.
- if n := int(uintptr(unsafe.Pointer(&b[0]))) % wordSize; n != 0 {
- n = wordSize - n
- for i := range b[:n] {
- b[i] ^= key[pos&3]
- pos++
- }
- b = b[n:]
- }
-
- // Create aligned word size key.
- var k [wordSize]byte
- for i := range k {
- k[i] = key[(pos+i)&3]
- }
- kw := *(*uintptr)(unsafe.Pointer(&k))
-
- // Mask one word at a time.
- n := (len(b) / wordSize) * wordSize
- for i := 0; i < n; i += wordSize {
- *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&b[0])) + uintptr(i))) ^= kw
- }
-
- // Mask one byte at a time for remaining bytes.
- b = b[n:]
- for i := range b {
- b[i] ^= key[pos&3]
- pos++
- }
-
- return pos & 3
-}
diff --git a/vendor/github.com/gorilla/websocket/mask_safe.go b/vendor/github.com/gorilla/websocket/mask_safe.go
deleted file mode 100644
index 2aac060e52e7093d2dce5051d639a31560f6c4e8..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/mask_safe.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved. Use of
-// this source code is governed by a BSD-style license that can be found in the
-// LICENSE file.
-
-// +build appengine
-
-package websocket
-
-func maskBytes(key [4]byte, pos int, b []byte) int {
- for i := range b {
- b[i] ^= key[pos&3]
- pos++
- }
- return pos & 3
-}
diff --git a/vendor/github.com/gorilla/websocket/prepared.go b/vendor/github.com/gorilla/websocket/prepared.go
deleted file mode 100644
index 1efffbd1ebe91160879664fe5c62d2c94be09064..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/prepared.go
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2017 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package websocket
-
-import (
- "bytes"
- "net"
- "sync"
- "time"
-)
-
-// PreparedMessage caches on the wire representations of a message payload.
-// Use PreparedMessage to efficiently send a message payload to multiple
-// connections. PreparedMessage is especially useful when compression is used
-// because the CPU and memory expensive compression operation can be executed
-// once for a given set of compression options.
-type PreparedMessage struct {
- messageType int
- data []byte
- err error
- mu sync.Mutex
- frames map[prepareKey]*preparedFrame
-}
-
-// prepareKey defines a unique set of options to cache prepared frames in PreparedMessage.
-type prepareKey struct {
- isServer bool
- compress bool
- compressionLevel int
-}
-
-// preparedFrame contains data in wire representation.
-type preparedFrame struct {
- once sync.Once
- data []byte
-}
-
-// NewPreparedMessage returns an initialized PreparedMessage. You can then send
-// it to connection using WritePreparedMessage method. Valid wire
-// representation will be calculated lazily only once for a set of current
-// connection options.
-func NewPreparedMessage(messageType int, data []byte) (*PreparedMessage, error) {
- pm := &PreparedMessage{
- messageType: messageType,
- frames: make(map[prepareKey]*preparedFrame),
- data: data,
- }
-
- // Prepare a plain server frame.
- _, frameData, err := pm.frame(prepareKey{isServer: true, compress: false})
- if err != nil {
- return nil, err
- }
-
- // To protect against caller modifying the data argument, remember the data
- // copied to the plain server frame.
- pm.data = frameData[len(frameData)-len(data):]
- return pm, nil
-}
-
-func (pm *PreparedMessage) frame(key prepareKey) (int, []byte, error) {
- pm.mu.Lock()
- frame, ok := pm.frames[key]
- if !ok {
- frame = &preparedFrame{}
- pm.frames[key] = frame
- }
- pm.mu.Unlock()
-
- var err error
- frame.once.Do(func() {
- // Prepare a frame using a 'fake' connection.
- // TODO: Refactor code in conn.go to allow more direct construction of
- // the frame.
- mu := make(chan bool, 1)
- mu <- true
- var nc prepareConn
- c := &Conn{
- conn: &nc,
- mu: mu,
- isServer: key.isServer,
- compressionLevel: key.compressionLevel,
- enableWriteCompression: true,
- writeBuf: make([]byte, defaultWriteBufferSize+maxFrameHeaderSize),
- }
- if key.compress {
- c.newCompressionWriter = compressNoContextTakeover
- }
- err = c.WriteMessage(pm.messageType, pm.data)
- frame.data = nc.buf.Bytes()
- })
- return pm.messageType, frame.data, err
-}
-
-type prepareConn struct {
- buf bytes.Buffer
- net.Conn
-}
-
-func (pc *prepareConn) Write(p []byte) (int, error) { return pc.buf.Write(p) }
-func (pc *prepareConn) SetWriteDeadline(t time.Time) error { return nil }
diff --git a/vendor/github.com/gorilla/websocket/server.go b/vendor/github.com/gorilla/websocket/server.go
deleted file mode 100644
index 3495e0f1abc6663c286edc6abc709b1d1729712b..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/server.go
+++ /dev/null
@@ -1,291 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package websocket
-
-import (
- "bufio"
- "errors"
- "net"
- "net/http"
- "net/url"
- "strings"
- "time"
-)
-
-// HandshakeError describes an error with the handshake from the peer.
-type HandshakeError struct {
- message string
-}
-
-func (e HandshakeError) Error() string { return e.message }
-
-// Upgrader specifies parameters for upgrading an HTTP connection to a
-// WebSocket connection.
-type Upgrader struct {
- // HandshakeTimeout specifies the duration for the handshake to complete.
- HandshakeTimeout time.Duration
-
- // ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer
- // size is zero, then buffers allocated by the HTTP server are used. The
- // I/O buffer sizes do not limit the size of the messages that can be sent
- // or received.
- ReadBufferSize, WriteBufferSize int
-
- // Subprotocols specifies the server's supported protocols in order of
- // preference. If this field is set, then the Upgrade method negotiates a
- // subprotocol by selecting the first match in this list with a protocol
- // requested by the client.
- Subprotocols []string
-
- // Error specifies the function for generating HTTP error responses. If Error
- // is nil, then http.Error is used to generate the HTTP response.
- Error func(w http.ResponseWriter, r *http.Request, status int, reason error)
-
- // CheckOrigin returns true if the request Origin header is acceptable. If
- // CheckOrigin is nil, the host in the Origin header must not be set or
- // must match the host of the request.
- CheckOrigin func(r *http.Request) bool
-
- // EnableCompression specify if the server should attempt to negotiate per
- // message compression (RFC 7692). Setting this value to true does not
- // guarantee that compression will be supported. Currently only "no context
- // takeover" modes are supported.
- EnableCompression bool
-}
-
-func (u *Upgrader) returnError(w http.ResponseWriter, r *http.Request, status int, reason string) (*Conn, error) {
- err := HandshakeError{reason}
- if u.Error != nil {
- u.Error(w, r, status, err)
- } else {
- w.Header().Set("Sec-Websocket-Version", "13")
- http.Error(w, http.StatusText(status), status)
- }
- return nil, err
-}
-
-// checkSameOrigin returns true if the origin is not set or is equal to the request host.
-func checkSameOrigin(r *http.Request) bool {
- origin := r.Header["Origin"]
- if len(origin) == 0 {
- return true
- }
- u, err := url.Parse(origin[0])
- if err != nil {
- return false
- }
- return u.Host == r.Host
-}
-
-func (u *Upgrader) selectSubprotocol(r *http.Request, responseHeader http.Header) string {
- if u.Subprotocols != nil {
- clientProtocols := Subprotocols(r)
- for _, serverProtocol := range u.Subprotocols {
- for _, clientProtocol := range clientProtocols {
- if clientProtocol == serverProtocol {
- return clientProtocol
- }
- }
- }
- } else if responseHeader != nil {
- return responseHeader.Get("Sec-Websocket-Protocol")
- }
- return ""
-}
-
-// Upgrade upgrades the HTTP server connection to the WebSocket protocol.
-//
-// The responseHeader is included in the response to the client's upgrade
-// request. Use the responseHeader to specify cookies (Set-Cookie) and the
-// application negotiated subprotocol (Sec-Websocket-Protocol).
-//
-// If the upgrade fails, then Upgrade replies to the client with an HTTP error
-// response.
-func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (*Conn, error) {
- if r.Method != "GET" {
- return u.returnError(w, r, http.StatusMethodNotAllowed, "websocket: not a websocket handshake: request method is not GET")
- }
-
- if _, ok := responseHeader["Sec-Websocket-Extensions"]; ok {
- return u.returnError(w, r, http.StatusInternalServerError, "websocket: application specific 'Sec-Websocket-Extensions' headers are unsupported")
- }
-
- if !tokenListContainsValue(r.Header, "Connection", "upgrade") {
- return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: 'upgrade' token not found in 'Connection' header")
- }
-
- if !tokenListContainsValue(r.Header, "Upgrade", "websocket") {
- return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: 'websocket' token not found in 'Upgrade' header")
- }
-
- if !tokenListContainsValue(r.Header, "Sec-Websocket-Version", "13") {
- return u.returnError(w, r, http.StatusBadRequest, "websocket: unsupported version: 13 not found in 'Sec-Websocket-Version' header")
- }
-
- checkOrigin := u.CheckOrigin
- if checkOrigin == nil {
- checkOrigin = checkSameOrigin
- }
- if !checkOrigin(r) {
- return u.returnError(w, r, http.StatusForbidden, "websocket: 'Origin' header value not allowed")
- }
-
- challengeKey := r.Header.Get("Sec-Websocket-Key")
- if challengeKey == "" {
- return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: `Sec-Websocket-Key' header is missing or blank")
- }
-
- subprotocol := u.selectSubprotocol(r, responseHeader)
-
- // Negotiate PMCE
- var compress bool
- if u.EnableCompression {
- for _, ext := range parseExtensions(r.Header) {
- if ext[""] != "permessage-deflate" {
- continue
- }
- compress = true
- break
- }
- }
-
- var (
- netConn net.Conn
- err error
- )
-
- h, ok := w.(http.Hijacker)
- if !ok {
- return u.returnError(w, r, http.StatusInternalServerError, "websocket: response does not implement http.Hijacker")
- }
- var brw *bufio.ReadWriter
- netConn, brw, err = h.Hijack()
- if err != nil {
- return u.returnError(w, r, http.StatusInternalServerError, err.Error())
- }
-
- if brw.Reader.Buffered() > 0 {
- netConn.Close()
- return nil, errors.New("websocket: client sent data before handshake is complete")
- }
-
- c := newConnBRW(netConn, true, u.ReadBufferSize, u.WriteBufferSize, brw)
- c.subprotocol = subprotocol
-
- if compress {
- c.newCompressionWriter = compressNoContextTakeover
- c.newDecompressionReader = decompressNoContextTakeover
- }
-
- p := c.writeBuf[:0]
- p = append(p, "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: "...)
- p = append(p, computeAcceptKey(challengeKey)...)
- p = append(p, "\r\n"...)
- if c.subprotocol != "" {
- p = append(p, "Sec-Websocket-Protocol: "...)
- p = append(p, c.subprotocol...)
- p = append(p, "\r\n"...)
- }
- if compress {
- p = append(p, "Sec-Websocket-Extensions: permessage-deflate; server_no_context_takeover; client_no_context_takeover\r\n"...)
- }
- for k, vs := range responseHeader {
- if k == "Sec-Websocket-Protocol" {
- continue
- }
- for _, v := range vs {
- p = append(p, k...)
- p = append(p, ": "...)
- for i := 0; i < len(v); i++ {
- b := v[i]
- if b <= 31 {
- // prevent response splitting.
- b = ' '
- }
- p = append(p, b)
- }
- p = append(p, "\r\n"...)
- }
- }
- p = append(p, "\r\n"...)
-
- // Clear deadlines set by HTTP server.
- netConn.SetDeadline(time.Time{})
-
- if u.HandshakeTimeout > 0 {
- netConn.SetWriteDeadline(time.Now().Add(u.HandshakeTimeout))
- }
- if _, err = netConn.Write(p); err != nil {
- netConn.Close()
- return nil, err
- }
- if u.HandshakeTimeout > 0 {
- netConn.SetWriteDeadline(time.Time{})
- }
-
- return c, nil
-}
-
-// Upgrade upgrades the HTTP server connection to the WebSocket protocol.
-//
-// This function is deprecated, use websocket.Upgrader instead.
-//
-// The application is responsible for checking the request origin before
-// calling Upgrade. An example implementation of the same origin policy is:
-//
-// if req.Header.Get("Origin") != "http://"+req.Host {
-// http.Error(w, "Origin not allowed", 403)
-// return
-// }
-//
-// If the endpoint supports subprotocols, then the application is responsible
-// for negotiating the protocol used on the connection. Use the Subprotocols()
-// function to get the subprotocols requested by the client. Use the
-// Sec-Websocket-Protocol response header to specify the subprotocol selected
-// by the application.
-//
-// The responseHeader is included in the response to the client's upgrade
-// request. Use the responseHeader to specify cookies (Set-Cookie) and the
-// negotiated subprotocol (Sec-Websocket-Protocol).
-//
-// The connection buffers IO to the underlying network connection. The
-// readBufSize and writeBufSize parameters specify the size of the buffers to
-// use. Messages can be larger than the buffers.
-//
-// If the request is not a valid WebSocket handshake, then Upgrade returns an
-// error of type HandshakeError. Applications should handle this error by
-// replying to the client with an HTTP error response.
-func Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header, readBufSize, writeBufSize int) (*Conn, error) {
- u := Upgrader{ReadBufferSize: readBufSize, WriteBufferSize: writeBufSize}
- u.Error = func(w http.ResponseWriter, r *http.Request, status int, reason error) {
- // don't return errors to maintain backwards compatibility
- }
- u.CheckOrigin = func(r *http.Request) bool {
- // allow all connections by default
- return true
- }
- return u.Upgrade(w, r, responseHeader)
-}
-
-// Subprotocols returns the subprotocols requested by the client in the
-// Sec-Websocket-Protocol header.
-func Subprotocols(r *http.Request) []string {
- h := strings.TrimSpace(r.Header.Get("Sec-Websocket-Protocol"))
- if h == "" {
- return nil
- }
- protocols := strings.Split(h, ",")
- for i := range protocols {
- protocols[i] = strings.TrimSpace(protocols[i])
- }
- return protocols
-}
-
-// IsWebSocketUpgrade returns true if the client requested upgrade to the
-// WebSocket protocol.
-func IsWebSocketUpgrade(r *http.Request) bool {
- return tokenListContainsValue(r.Header, "Connection", "upgrade") &&
- tokenListContainsValue(r.Header, "Upgrade", "websocket")
-}
diff --git a/vendor/github.com/gorilla/websocket/util.go b/vendor/github.com/gorilla/websocket/util.go
deleted file mode 100644
index 9a4908df2ee7621eed19134a17f82746d6a8695d..0000000000000000000000000000000000000000
--- a/vendor/github.com/gorilla/websocket/util.go
+++ /dev/null
@@ -1,214 +0,0 @@
-// Copyright 2013 The Gorilla WebSocket Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package websocket
-
-import (
- "crypto/rand"
- "crypto/sha1"
- "encoding/base64"
- "io"
- "net/http"
- "strings"
-)
-
-var keyGUID = []byte("258EAFA5-E914-47DA-95CA-C5AB0DC85B11")
-
-func computeAcceptKey(challengeKey string) string {
- h := sha1.New()
- h.Write([]byte(challengeKey))
- h.Write(keyGUID)
- return base64.StdEncoding.EncodeToString(h.Sum(nil))
-}
-
-func generateChallengeKey() (string, error) {
- p := make([]byte, 16)
- if _, err := io.ReadFull(rand.Reader, p); err != nil {
- return "", err
- }
- return base64.StdEncoding.EncodeToString(p), nil
-}
-
-// Octet types from RFC 2616.
-var octetTypes [256]byte
-
-const (
- isTokenOctet = 1 << iota
- isSpaceOctet
-)
-
-func init() {
- // From RFC 2616
- //
- // OCTET =
- // CHAR =
- // CTL =
- // CR =
- // LF =
- // SP =
- // HT =
- // <"> =
- // CRLF = CR LF
- // LWS = [CRLF] 1*( SP | HT )
- // TEXT =
- // separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <">
- // | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT
- // token = 1*
- // qdtext = >
-
- for c := 0; c < 256; c++ {
- var t byte
- isCtl := c <= 31 || c == 127
- isChar := 0 <= c && c <= 127
- isSeparator := strings.IndexRune(" \t\"(),/:;<=>?@[]\\{}", rune(c)) >= 0
- if strings.IndexRune(" \t\r\n", rune(c)) >= 0 {
- t |= isSpaceOctet
- }
- if isChar && !isCtl && !isSeparator {
- t |= isTokenOctet
- }
- octetTypes[c] = t
- }
-}
-
-func skipSpace(s string) (rest string) {
- i := 0
- for ; i < len(s); i++ {
- if octetTypes[s[i]]&isSpaceOctet == 0 {
- break
- }
- }
- return s[i:]
-}
-
-func nextToken(s string) (token, rest string) {
- i := 0
- for ; i < len(s); i++ {
- if octetTypes[s[i]]&isTokenOctet == 0 {
- break
- }
- }
- return s[:i], s[i:]
-}
-
-func nextTokenOrQuoted(s string) (value string, rest string) {
- if !strings.HasPrefix(s, "\"") {
- return nextToken(s)
- }
- s = s[1:]
- for i := 0; i < len(s); i++ {
- switch s[i] {
- case '"':
- return s[:i], s[i+1:]
- case '\\':
- p := make([]byte, len(s)-1)
- j := copy(p, s[:i])
- escape := true
- for i = i + 1; i < len(s); i++ {
- b := s[i]
- switch {
- case escape:
- escape = false
- p[j] = b
- j += 1
- case b == '\\':
- escape = true
- case b == '"':
- return string(p[:j]), s[i+1:]
- default:
- p[j] = b
- j += 1
- }
- }
- return "", ""
- }
- }
- return "", ""
-}
-
-// tokenListContainsValue returns true if the 1#token header with the given
-// name contains token.
-func tokenListContainsValue(header http.Header, name string, value string) bool {
-headers:
- for _, s := range header[name] {
- for {
- var t string
- t, s = nextToken(skipSpace(s))
- if t == "" {
- continue headers
- }
- s = skipSpace(s)
- if s != "" && s[0] != ',' {
- continue headers
- }
- if strings.EqualFold(t, value) {
- return true
- }
- if s == "" {
- continue headers
- }
- s = s[1:]
- }
- }
- return false
-}
-
-// parseExtensiosn parses WebSocket extensions from a header.
-func parseExtensions(header http.Header) []map[string]string {
-
- // From RFC 6455:
- //
- // Sec-WebSocket-Extensions = extension-list
- // extension-list = 1#extension
- // extension = extension-token *( ";" extension-param )
- // extension-token = registered-token
- // registered-token = token
- // extension-param = token [ "=" (token | quoted-string) ]
- // ;When using the quoted-string syntax variant, the value
- // ;after quoted-string unescaping MUST conform to the
- // ;'token' ABNF.
-
- var result []map[string]string
-headers:
- for _, s := range header["Sec-Websocket-Extensions"] {
- for {
- var t string
- t, s = nextToken(skipSpace(s))
- if t == "" {
- continue headers
- }
- ext := map[string]string{"": t}
- for {
- s = skipSpace(s)
- if !strings.HasPrefix(s, ";") {
- break
- }
- var k string
- k, s = nextToken(skipSpace(s[1:]))
- if k == "" {
- continue headers
- }
- s = skipSpace(s)
- var v string
- if strings.HasPrefix(s, "=") {
- v, s = nextTokenOrQuoted(skipSpace(s[1:]))
- s = skipSpace(s)
- }
- if s != "" && s[0] != ',' && s[0] != ';' {
- continue headers
- }
- ext[k] = v
- }
- if s != "" && s[0] != ',' {
- continue headers
- }
- result = append(result, ext)
- if s == "" {
- continue headers
- }
- s = s[1:]
- }
- }
- return result
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/.gitignore b/vendor/github.com/hashicorp/golang-lru/.gitignore
deleted file mode 100644
index 836562412fe8a44fa99a515eeff68d2bc1a86daa..0000000000000000000000000000000000000000
--- a/vendor/github.com/hashicorp/golang-lru/.gitignore
+++ /dev/null
@@ -1,23 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
diff --git a/vendor/github.com/hashicorp/golang-lru/2q.go b/vendor/github.com/hashicorp/golang-lru/2q.go
deleted file mode 100644
index e474cd07581ac908575132b99cf3b118bc9d1059..0000000000000000000000000000000000000000
--- a/vendor/github.com/hashicorp/golang-lru/2q.go
+++ /dev/null
@@ -1,223 +0,0 @@
-package lru
-
-import (
- "fmt"
- "sync"
-
- "github.com/hashicorp/golang-lru/simplelru"
-)
-
-const (
- // Default2QRecentRatio is the ratio of the 2Q cache dedicated
- // to recently added entries that have only been accessed once.
- Default2QRecentRatio = 0.25
-
- // Default2QGhostEntries is the default ratio of ghost
- // entries kept to track entries recently evicted
- Default2QGhostEntries = 0.50
-)
-
-// TwoQueueCache is a thread-safe fixed size 2Q cache.
-// 2Q is an enhancement over the standard LRU cache
-// in that it tracks both frequently and recently used
-// entries separately. This avoids a burst in access to new
-// entries from evicting frequently used entries. It adds some
-// additional tracking overhead to the standard LRU cache, and is
-// computationally about 2x the cost, and adds some metadata over
-// head. The ARCCache is similar, but does not require setting any
-// parameters.
-type TwoQueueCache struct {
- size int
- recentSize int
-
- recent simplelru.LRUCache
- frequent simplelru.LRUCache
- recentEvict simplelru.LRUCache
- lock sync.RWMutex
-}
-
-// New2Q creates a new TwoQueueCache using the default
-// values for the parameters.
-func New2Q(size int) (*TwoQueueCache, error) {
- return New2QParams(size, Default2QRecentRatio, Default2QGhostEntries)
-}
-
-// New2QParams creates a new TwoQueueCache using the provided
-// parameter values.
-func New2QParams(size int, recentRatio float64, ghostRatio float64) (*TwoQueueCache, error) {
- if size <= 0 {
- return nil, fmt.Errorf("invalid size")
- }
- if recentRatio < 0.0 || recentRatio > 1.0 {
- return nil, fmt.Errorf("invalid recent ratio")
- }
- if ghostRatio < 0.0 || ghostRatio > 1.0 {
- return nil, fmt.Errorf("invalid ghost ratio")
- }
-
- // Determine the sub-sizes
- recentSize := int(float64(size) * recentRatio)
- evictSize := int(float64(size) * ghostRatio)
-
- // Allocate the LRUs
- recent, err := simplelru.NewLRU(size, nil)
- if err != nil {
- return nil, err
- }
- frequent, err := simplelru.NewLRU(size, nil)
- if err != nil {
- return nil, err
- }
- recentEvict, err := simplelru.NewLRU(evictSize, nil)
- if err != nil {
- return nil, err
- }
-
- // Initialize the cache
- c := &TwoQueueCache{
- size: size,
- recentSize: recentSize,
- recent: recent,
- frequent: frequent,
- recentEvict: recentEvict,
- }
- return c, nil
-}
-
-// Get looks up a key's value from the cache.
-func (c *TwoQueueCache) Get(key interface{}) (value interface{}, ok bool) {
- c.lock.Lock()
- defer c.lock.Unlock()
-
- // Check if this is a frequent value
- if val, ok := c.frequent.Get(key); ok {
- return val, ok
- }
-
- // If the value is contained in recent, then we
- // promote it to frequent
- if val, ok := c.recent.Peek(key); ok {
- c.recent.Remove(key)
- c.frequent.Add(key, val)
- return val, ok
- }
-
- // No hit
- return nil, false
-}
-
-// Add adds a value to the cache.
-func (c *TwoQueueCache) Add(key, value interface{}) {
- c.lock.Lock()
- defer c.lock.Unlock()
-
- // Check if the value is frequently used already,
- // and just update the value
- if c.frequent.Contains(key) {
- c.frequent.Add(key, value)
- return
- }
-
- // Check if the value is recently used, and promote
- // the value into the frequent list
- if c.recent.Contains(key) {
- c.recent.Remove(key)
- c.frequent.Add(key, value)
- return
- }
-
- // If the value was recently evicted, add it to the
- // frequently used list
- if c.recentEvict.Contains(key) {
- c.ensureSpace(true)
- c.recentEvict.Remove(key)
- c.frequent.Add(key, value)
- return
- }
-
- // Add to the recently seen list
- c.ensureSpace(false)
- c.recent.Add(key, value)
- return
-}
-
-// ensureSpace is used to ensure we have space in the cache
-func (c *TwoQueueCache) ensureSpace(recentEvict bool) {
- // If we have space, nothing to do
- recentLen := c.recent.Len()
- freqLen := c.frequent.Len()
- if recentLen+freqLen < c.size {
- return
- }
-
- // If the recent buffer is larger than
- // the target, evict from there
- if recentLen > 0 && (recentLen > c.recentSize || (recentLen == c.recentSize && !recentEvict)) {
- k, _, _ := c.recent.RemoveOldest()
- c.recentEvict.Add(k, nil)
- return
- }
-
- // Remove from the frequent list otherwise
- c.frequent.RemoveOldest()
-}
-
-// Len returns the number of items in the cache.
-func (c *TwoQueueCache) Len() int {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.recent.Len() + c.frequent.Len()
-}
-
-// Keys returns a slice of the keys in the cache.
-// The frequently used keys are first in the returned slice.
-func (c *TwoQueueCache) Keys() []interface{} {
- c.lock.RLock()
- defer c.lock.RUnlock()
- k1 := c.frequent.Keys()
- k2 := c.recent.Keys()
- return append(k1, k2...)
-}
-
-// Remove removes the provided key from the cache.
-func (c *TwoQueueCache) Remove(key interface{}) {
- c.lock.Lock()
- defer c.lock.Unlock()
- if c.frequent.Remove(key) {
- return
- }
- if c.recent.Remove(key) {
- return
- }
- if c.recentEvict.Remove(key) {
- return
- }
-}
-
-// Purge is used to completely clear the cache.
-func (c *TwoQueueCache) Purge() {
- c.lock.Lock()
- defer c.lock.Unlock()
- c.recent.Purge()
- c.frequent.Purge()
- c.recentEvict.Purge()
-}
-
-// Contains is used to check if the cache contains a key
-// without updating recency or frequency.
-func (c *TwoQueueCache) Contains(key interface{}) bool {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.frequent.Contains(key) || c.recent.Contains(key)
-}
-
-// Peek is used to inspect the cache value of a key
-// without updating recency or frequency.
-func (c *TwoQueueCache) Peek(key interface{}) (value interface{}, ok bool) {
- c.lock.RLock()
- defer c.lock.RUnlock()
- if val, ok := c.frequent.Peek(key); ok {
- return val, ok
- }
- return c.recent.Peek(key)
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/LICENSE b/vendor/github.com/hashicorp/golang-lru/LICENSE
deleted file mode 100644
index be2cc4dfb609fb6c38f6365ec345bded3350dd63..0000000000000000000000000000000000000000
--- a/vendor/github.com/hashicorp/golang-lru/LICENSE
+++ /dev/null
@@ -1,362 +0,0 @@
-Mozilla Public License, version 2.0
-
-1. Definitions
-
-1.1. "Contributor"
-
- means each individual or legal entity that creates, contributes to the
- creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
-
- means the combination of the Contributions of others (if any) used by a
- Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
-
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
-
- means Source Code Form to which the initial Contributor has attached the
- notice in Exhibit A, the Executable Form of such Source Code Form, and
- Modifications of such Source Code Form, in each case including portions
- thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- a. that the initial Contributor has attached the notice described in
- Exhibit B to the Covered Software; or
-
- b. that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the terms of
- a Secondary License.
-
-1.6. "Executable Form"
-
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
-
- means a work that combines Covered Software with other material, in a
- separate file or files, that is not Covered Software.
-
-1.8. "License"
-
- means this document.
-
-1.9. "Licensable"
-
- means having the right to grant, to the maximum extent possible, whether
- at the time of the initial grant or subsequently, any and all of the
- rights conveyed by this License.
-
-1.10. "Modifications"
-
- means any of the following:
-
- a. any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered Software; or
-
- b. any new file in Source Code Form that contains any Covered Software.
-
-1.11. "Patent Claims" of a Contributor
-
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the License,
- by the making, using, selling, offering for sale, having made, import,
- or transfer of either its Contributions or its Contributor Version.
-
-1.12. "Secondary License"
-
- means either the GNU General Public License, Version 2.0, the GNU Lesser
- General Public License, Version 2.1, the GNU Affero General Public
- License, Version 3.0, or any later versions of those licenses.
-
-1.13. "Source Code Form"
-
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
-
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that controls, is
- controlled by, or is under common control with You. For purposes of this
- definition, "control" means (a) the power, direct or indirect, to cause
- the direction or management of such entity, whether by contract or
- otherwise, or (b) ownership of more than fifty percent (50%) of the
- outstanding shares or beneficial ownership of such entity.
-
-
-2. License Grants and Conditions
-
-2.1. Grants
-
- Each Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- a. under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
- b. under Patent Claims of such Contributor to make, use, sell, offer for
- sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
- The licenses granted in Section 2.1 with respect to any Contribution
- become effective for each Contribution on the date the Contributor first
- distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
- The licenses granted in this Section 2 are the only rights granted under
- this License. No additional rights or licenses will be implied from the
- distribution or licensing of Covered Software under this License.
- Notwithstanding Section 2.1(b) above, no patent license is granted by a
- Contributor:
-
- a. for any code that a Contributor has removed from Covered Software; or
-
- b. for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
- c. under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
- This License does not grant any rights in the trademarks, service marks,
- or logos of any Contributor (except as may be necessary to comply with
- the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
- No Contributor makes additional grants as a result of Your choice to
- distribute the Covered Software under a subsequent version of this
- License (see Section 10.2) or under the terms of a Secondary License (if
- permitted under the terms of Section 3.3).
-
-2.5. Representation
-
- Each Contributor represents that the Contributor believes its
- Contributions are its original creation(s) or it has sufficient rights to
- grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
- This License is not intended to limit any rights You have under
- applicable copyright doctrines of fair use, fair dealing, or other
- equivalents.
-
-2.7. Conditions
-
- Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
- Section 2.1.
-
-
-3. Responsibilities
-
-3.1. Distribution of Source Form
-
- All distribution of Covered Software in Source Code Form, including any
- Modifications that You create or to which You contribute, must be under
- the terms of this License. You must inform recipients that the Source
- Code Form of the Covered Software is governed by the terms of this
- License, and how they can obtain a copy of this License. You may not
- attempt to alter or restrict the recipients' rights in the Source Code
- Form.
-
-3.2. Distribution of Executable Form
-
- If You distribute Covered Software in Executable Form then:
-
- a. such Covered Software must also be made available in Source Code Form,
- as described in Section 3.1, and You must inform recipients of the
- Executable Form how they can obtain a copy of such Source Code Form by
- reasonable means in a timely manner, at a charge no more than the cost
- of distribution to the recipient; and
-
- b. You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter the
- recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
- You may create and distribute a Larger Work under terms of Your choice,
- provided that You also comply with the requirements of this License for
- the Covered Software. If the Larger Work is a combination of Covered
- Software with a work governed by one or more Secondary Licenses, and the
- Covered Software is not Incompatible With Secondary Licenses, this
- License permits You to additionally distribute such Covered Software
- under the terms of such Secondary License(s), so that the recipient of
- the Larger Work may, at their option, further distribute the Covered
- Software under the terms of either this License or such Secondary
- License(s).
-
-3.4. Notices
-
- You may not remove or alter the substance of any license notices
- (including copyright notices, patent notices, disclaimers of warranty, or
- limitations of liability) contained within the Source Code Form of the
- Covered Software, except that You may alter any license notices to the
- extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
- You may choose to offer, and to charge a fee for, warranty, support,
- indemnity or liability obligations to one or more recipients of Covered
- Software. However, You may do so only on Your own behalf, and not on
- behalf of any Contributor. You must make it absolutely clear that any
- such warranty, support, indemnity, or liability obligation is offered by
- You alone, and You hereby agree to indemnify every Contributor for any
- liability incurred by such Contributor as a result of warranty, support,
- indemnity or liability terms You offer. You may include additional
- disclaimers of warranty and limitations of liability specific to any
- jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
-
- If it is impossible for You to comply with any of the terms of this License
- with respect to some or all of the Covered Software due to statute,
- judicial order, or regulation then You must: (a) comply with the terms of
- this License to the maximum extent possible; and (b) describe the
- limitations and the code they affect. Such description must be placed in a
- text file included with all distributions of the Covered Software under
- this License. Except to the extent prohibited by statute or regulation,
- such description must be sufficiently detailed for a recipient of ordinary
- skill to be able to understand it.
-
-5. Termination
-
-5.1. The rights granted under this License will terminate automatically if You
- fail to comply with any of its terms. However, if You become compliant,
- then the rights granted under this License from a particular Contributor
- are reinstated (a) provisionally, unless and until such Contributor
- explicitly and finally terminates Your grants, and (b) on an ongoing
- basis, if such Contributor fails to notify You of the non-compliance by
- some reasonable means prior to 60 days after You have come back into
- compliance. Moreover, Your grants from a particular Contributor are
- reinstated on an ongoing basis if such Contributor notifies You of the
- non-compliance by some reasonable means, this is the first time You have
- received notice of non-compliance with this License from such
- Contributor, and You become compliant prior to 30 days after Your receipt
- of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
- infringement claim (excluding declaratory judgment actions,
- counter-claims, and cross-claims) alleging that a Contributor Version
- directly or indirectly infringes any patent, then the rights granted to
- You by any and all Contributors for the Covered Software under Section
- 2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
- license agreements (excluding distributors and resellers) which have been
- validly granted by You or Your distributors under this License prior to
- termination shall survive termination.
-
-6. Disclaimer of Warranty
-
- Covered Software is provided under this License on an "as is" basis,
- without warranty of any kind, either expressed, implied, or statutory,
- including, without limitation, warranties that the Covered Software is free
- of defects, merchantable, fit for a particular purpose or non-infringing.
- The entire risk as to the quality and performance of the Covered Software
- is with You. Should any Covered Software prove defective in any respect,
- You (not any Contributor) assume the cost of any necessary servicing,
- repair, or correction. This disclaimer of warranty constitutes an essential
- part of this License. No use of any Covered Software is authorized under
- this License except under this disclaimer.
-
-7. Limitation of Liability
-
- Under no circumstances and under no legal theory, whether tort (including
- negligence), contract, or otherwise, shall any Contributor, or anyone who
- distributes Covered Software as permitted above, be liable to You for any
- direct, indirect, special, incidental, or consequential damages of any
- character including, without limitation, damages for lost profits, loss of
- goodwill, work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses, even if such party shall have been
- informed of the possibility of such damages. This limitation of liability
- shall not apply to liability for death or personal injury resulting from
- such party's negligence to the extent applicable law prohibits such
- limitation. Some jurisdictions do not allow the exclusion or limitation of
- incidental or consequential damages, so this exclusion and limitation may
- not apply to You.
-
-8. Litigation
-
- Any litigation relating to this License may be brought only in the courts
- of a jurisdiction where the defendant maintains its principal place of
- business and such litigation shall be governed by laws of that
- jurisdiction, without reference to its conflict-of-law provisions. Nothing
- in this Section shall prevent a party's ability to bring cross-claims or
- counter-claims.
-
-9. Miscellaneous
-
- This License represents the complete agreement concerning the subject
- matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the extent
- necessary to make it enforceable. Any law or regulation which provides that
- the language of a contract shall be construed against the drafter shall not
- be used to construe this License against a Contributor.
-
-
-10. Versions of the License
-
-10.1. New Versions
-
- Mozilla Foundation is the license steward. Except as provided in Section
- 10.3, no one other than the license steward has the right to modify or
- publish new versions of this License. Each version will be given a
- distinguishing version number.
-
-10.2. Effect of New Versions
-
- You may distribute the Covered Software under the terms of the version
- of the License under which You originally received the Covered Software,
- or under the terms of any subsequent version published by the license
- steward.
-
-10.3. Modified Versions
-
- If you create software not governed by this License, and you want to
- create a new license for such software, you may create and use a
- modified version of this License if you rename the license and remove
- any references to the name of the license steward (except to note that
- such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
- Licenses If You choose to distribute Source Code Form that is
- Incompatible With Secondary Licenses under the terms of this version of
- the License, the notice described in Exhibit B of this License must be
- attached.
-
-Exhibit A - Source Code Form License Notice
-
- This Source Code Form is subject to the
- terms of the Mozilla Public License, v.
- 2.0. If a copy of the MPL was not
- distributed with this file, You can
- obtain one at
- http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular file,
-then You may include the notice in a location (such as a LICENSE file in a
-relevant directory) where a recipient would be likely to look for such a
-notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
-
- This Source Code Form is "Incompatible
- With Secondary Licenses", as defined by
- the Mozilla Public License, v. 2.0.
diff --git a/vendor/github.com/hashicorp/golang-lru/README.md b/vendor/github.com/hashicorp/golang-lru/README.md
deleted file mode 100644
index 33e58cfaf97ea1b48948e4da2cf326b74f74a773..0000000000000000000000000000000000000000
--- a/vendor/github.com/hashicorp/golang-lru/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-golang-lru
-==========
-
-This provides the `lru` package which implements a fixed-size
-thread safe LRU cache. It is based on the cache in Groupcache.
-
-Documentation
-=============
-
-Full docs are available on [Godoc](http://godoc.org/github.com/hashicorp/golang-lru)
-
-Example
-=======
-
-Using the LRU is very simple:
-
-```go
-l, _ := New(128)
-for i := 0; i < 256; i++ {
- l.Add(i, nil)
-}
-if l.Len() != 128 {
- panic(fmt.Sprintf("bad len: %v", l.Len()))
-}
-```
diff --git a/vendor/github.com/hashicorp/golang-lru/arc.go b/vendor/github.com/hashicorp/golang-lru/arc.go
deleted file mode 100644
index 555225a218c968e756812976829e3d548e7bffda..0000000000000000000000000000000000000000
--- a/vendor/github.com/hashicorp/golang-lru/arc.go
+++ /dev/null
@@ -1,257 +0,0 @@
-package lru
-
-import (
- "sync"
-
- "github.com/hashicorp/golang-lru/simplelru"
-)
-
-// ARCCache is a thread-safe fixed size Adaptive Replacement Cache (ARC).
-// ARC is an enhancement over the standard LRU cache in that tracks both
-// frequency and recency of use. This avoids a burst in access to new
-// entries from evicting the frequently used older entries. It adds some
-// additional tracking overhead to a standard LRU cache, computationally
-// it is roughly 2x the cost, and the extra memory overhead is linear
-// with the size of the cache. ARC has been patented by IBM, but is
-// similar to the TwoQueueCache (2Q) which requires setting parameters.
-type ARCCache struct {
- size int // Size is the total capacity of the cache
- p int // P is the dynamic preference towards T1 or T2
-
- t1 simplelru.LRUCache // T1 is the LRU for recently accessed items
- b1 simplelru.LRUCache // B1 is the LRU for evictions from t1
-
- t2 simplelru.LRUCache // T2 is the LRU for frequently accessed items
- b2 simplelru.LRUCache // B2 is the LRU for evictions from t2
-
- lock sync.RWMutex
-}
-
-// NewARC creates an ARC of the given size
-func NewARC(size int) (*ARCCache, error) {
- // Create the sub LRUs
- b1, err := simplelru.NewLRU(size, nil)
- if err != nil {
- return nil, err
- }
- b2, err := simplelru.NewLRU(size, nil)
- if err != nil {
- return nil, err
- }
- t1, err := simplelru.NewLRU(size, nil)
- if err != nil {
- return nil, err
- }
- t2, err := simplelru.NewLRU(size, nil)
- if err != nil {
- return nil, err
- }
-
- // Initialize the ARC
- c := &ARCCache{
- size: size,
- p: 0,
- t1: t1,
- b1: b1,
- t2: t2,
- b2: b2,
- }
- return c, nil
-}
-
-// Get looks up a key's value from the cache.
-func (c *ARCCache) Get(key interface{}) (value interface{}, ok bool) {
- c.lock.Lock()
- defer c.lock.Unlock()
-
- // If the value is contained in T1 (recent), then
- // promote it to T2 (frequent)
- if val, ok := c.t1.Peek(key); ok {
- c.t1.Remove(key)
- c.t2.Add(key, val)
- return val, ok
- }
-
- // Check if the value is contained in T2 (frequent)
- if val, ok := c.t2.Get(key); ok {
- return val, ok
- }
-
- // No hit
- return nil, false
-}
-
-// Add adds a value to the cache.
-func (c *ARCCache) Add(key, value interface{}) {
- c.lock.Lock()
- defer c.lock.Unlock()
-
- // Check if the value is contained in T1 (recent), and potentially
- // promote it to frequent T2
- if c.t1.Contains(key) {
- c.t1.Remove(key)
- c.t2.Add(key, value)
- return
- }
-
- // Check if the value is already in T2 (frequent) and update it
- if c.t2.Contains(key) {
- c.t2.Add(key, value)
- return
- }
-
- // Check if this value was recently evicted as part of the
- // recently used list
- if c.b1.Contains(key) {
- // T1 set is too small, increase P appropriately
- delta := 1
- b1Len := c.b1.Len()
- b2Len := c.b2.Len()
- if b2Len > b1Len {
- delta = b2Len / b1Len
- }
- if c.p+delta >= c.size {
- c.p = c.size
- } else {
- c.p += delta
- }
-
- // Potentially need to make room in the cache
- if c.t1.Len()+c.t2.Len() >= c.size {
- c.replace(false)
- }
-
- // Remove from B1
- c.b1.Remove(key)
-
- // Add the key to the frequently used list
- c.t2.Add(key, value)
- return
- }
-
- // Check if this value was recently evicted as part of the
- // frequently used list
- if c.b2.Contains(key) {
- // T2 set is too small, decrease P appropriately
- delta := 1
- b1Len := c.b1.Len()
- b2Len := c.b2.Len()
- if b1Len > b2Len {
- delta = b1Len / b2Len
- }
- if delta >= c.p {
- c.p = 0
- } else {
- c.p -= delta
- }
-
- // Potentially need to make room in the cache
- if c.t1.Len()+c.t2.Len() >= c.size {
- c.replace(true)
- }
-
- // Remove from B2
- c.b2.Remove(key)
-
- // Add the key to the frequently used list
- c.t2.Add(key, value)
- return
- }
-
- // Potentially need to make room in the cache
- if c.t1.Len()+c.t2.Len() >= c.size {
- c.replace(false)
- }
-
- // Keep the size of the ghost buffers trim
- if c.b1.Len() > c.size-c.p {
- c.b1.RemoveOldest()
- }
- if c.b2.Len() > c.p {
- c.b2.RemoveOldest()
- }
-
- // Add to the recently seen list
- c.t1.Add(key, value)
- return
-}
-
-// replace is used to adaptively evict from either T1 or T2
-// based on the current learned value of P
-func (c *ARCCache) replace(b2ContainsKey bool) {
- t1Len := c.t1.Len()
- if t1Len > 0 && (t1Len > c.p || (t1Len == c.p && b2ContainsKey)) {
- k, _, ok := c.t1.RemoveOldest()
- if ok {
- c.b1.Add(k, nil)
- }
- } else {
- k, _, ok := c.t2.RemoveOldest()
- if ok {
- c.b2.Add(k, nil)
- }
- }
-}
-
-// Len returns the number of cached entries
-func (c *ARCCache) Len() int {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.t1.Len() + c.t2.Len()
-}
-
-// Keys returns all the cached keys
-func (c *ARCCache) Keys() []interface{} {
- c.lock.RLock()
- defer c.lock.RUnlock()
- k1 := c.t1.Keys()
- k2 := c.t2.Keys()
- return append(k1, k2...)
-}
-
-// Remove is used to purge a key from the cache
-func (c *ARCCache) Remove(key interface{}) {
- c.lock.Lock()
- defer c.lock.Unlock()
- if c.t1.Remove(key) {
- return
- }
- if c.t2.Remove(key) {
- return
- }
- if c.b1.Remove(key) {
- return
- }
- if c.b2.Remove(key) {
- return
- }
-}
-
-// Purge is used to clear the cache
-func (c *ARCCache) Purge() {
- c.lock.Lock()
- defer c.lock.Unlock()
- c.t1.Purge()
- c.t2.Purge()
- c.b1.Purge()
- c.b2.Purge()
-}
-
-// Contains is used to check if the cache contains a key
-// without updating recency or frequency.
-func (c *ARCCache) Contains(key interface{}) bool {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.t1.Contains(key) || c.t2.Contains(key)
-}
-
-// Peek is used to inspect the cache value of a key
-// without updating recency or frequency.
-func (c *ARCCache) Peek(key interface{}) (value interface{}, ok bool) {
- c.lock.RLock()
- defer c.lock.RUnlock()
- if val, ok := c.t1.Peek(key); ok {
- return val, ok
- }
- return c.t2.Peek(key)
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/doc.go b/vendor/github.com/hashicorp/golang-lru/doc.go
deleted file mode 100644
index 2547df979d0baf6a9f942477f1e907d4fe8fecbe..0000000000000000000000000000000000000000
--- a/vendor/github.com/hashicorp/golang-lru/doc.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Package lru provides three different LRU caches of varying sophistication.
-//
-// Cache is a simple LRU cache. It is based on the
-// LRU implementation in groupcache:
-// https://github.com/golang/groupcache/tree/master/lru
-//
-// TwoQueueCache tracks frequently used and recently used entries separately.
-// This avoids a burst of accesses from taking out frequently used entries,
-// at the cost of about 2x computational overhead and some extra bookkeeping.
-//
-// ARCCache is an adaptive replacement cache. It tracks recent evictions as
-// well as recent usage in both the frequent and recent caches. Its
-// computational overhead is comparable to TwoQueueCache, but the memory
-// overhead is linear with the size of the cache.
-//
-// ARC has been patented by IBM, so do not use it if that is problematic for
-// your program.
-//
-// All caches in this package take locks while operating, and are therefore
-// thread-safe for consumers.
-package lru
diff --git a/vendor/github.com/hashicorp/golang-lru/go.mod b/vendor/github.com/hashicorp/golang-lru/go.mod
deleted file mode 100644
index 824cb97e8346d182f037e0a2ea57cb5f982624ea..0000000000000000000000000000000000000000
--- a/vendor/github.com/hashicorp/golang-lru/go.mod
+++ /dev/null
@@ -1 +0,0 @@
-module github.com/hashicorp/golang-lru
diff --git a/vendor/github.com/hashicorp/golang-lru/lru.go b/vendor/github.com/hashicorp/golang-lru/lru.go
deleted file mode 100644
index c8d9b0a230f9f33c047407d831171da9e716d04e..0000000000000000000000000000000000000000
--- a/vendor/github.com/hashicorp/golang-lru/lru.go
+++ /dev/null
@@ -1,110 +0,0 @@
-package lru
-
-import (
- "sync"
-
- "github.com/hashicorp/golang-lru/simplelru"
-)
-
-// Cache is a thread-safe fixed size LRU cache.
-type Cache struct {
- lru simplelru.LRUCache
- lock sync.RWMutex
-}
-
-// New creates an LRU of the given size.
-func New(size int) (*Cache, error) {
- return NewWithEvict(size, nil)
-}
-
-// NewWithEvict constructs a fixed size cache with the given eviction
-// callback.
-func NewWithEvict(size int, onEvicted func(key interface{}, value interface{})) (*Cache, error) {
- lru, err := simplelru.NewLRU(size, simplelru.EvictCallback(onEvicted))
- if err != nil {
- return nil, err
- }
- c := &Cache{
- lru: lru,
- }
- return c, nil
-}
-
-// Purge is used to completely clear the cache.
-func (c *Cache) Purge() {
- c.lock.Lock()
- c.lru.Purge()
- c.lock.Unlock()
-}
-
-// Add adds a value to the cache. Returns true if an eviction occurred.
-func (c *Cache) Add(key, value interface{}) (evicted bool) {
- c.lock.Lock()
- defer c.lock.Unlock()
- return c.lru.Add(key, value)
-}
-
-// Get looks up a key's value from the cache.
-func (c *Cache) Get(key interface{}) (value interface{}, ok bool) {
- c.lock.Lock()
- defer c.lock.Unlock()
- return c.lru.Get(key)
-}
-
-// Contains checks if a key is in the cache, without updating the
-// recent-ness or deleting it for being stale.
-func (c *Cache) Contains(key interface{}) bool {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.lru.Contains(key)
-}
-
-// Peek returns the key value (or undefined if not found) without updating
-// the "recently used"-ness of the key.
-func (c *Cache) Peek(key interface{}) (value interface{}, ok bool) {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.lru.Peek(key)
-}
-
-// ContainsOrAdd checks if a key is in the cache without updating the
-// recent-ness or deleting it for being stale, and if not, adds the value.
-// Returns whether found and whether an eviction occurred.
-func (c *Cache) ContainsOrAdd(key, value interface{}) (ok, evicted bool) {
- c.lock.Lock()
- defer c.lock.Unlock()
-
- if c.lru.Contains(key) {
- return true, false
- }
- evicted = c.lru.Add(key, value)
- return false, evicted
-}
-
-// Remove removes the provided key from the cache.
-func (c *Cache) Remove(key interface{}) {
- c.lock.Lock()
- c.lru.Remove(key)
- c.lock.Unlock()
-}
-
-// RemoveOldest removes the oldest item from the cache.
-func (c *Cache) RemoveOldest() {
- c.lock.Lock()
- c.lru.RemoveOldest()
- c.lock.Unlock()
-}
-
-// Keys returns a slice of the keys in the cache, from oldest to newest.
-func (c *Cache) Keys() []interface{} {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.lru.Keys()
-}
-
-// Len returns the number of items in the cache.
-func (c *Cache) Len() int {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.lru.Len()
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go b/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go
deleted file mode 100644
index 5673773b22beb6bb11a6d4b0516d5caa8f246ac1..0000000000000000000000000000000000000000
--- a/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go
+++ /dev/null
@@ -1,161 +0,0 @@
-package simplelru
-
-import (
- "container/list"
- "errors"
-)
-
-// EvictCallback is used to get a callback when a cache entry is evicted
-type EvictCallback func(key interface{}, value interface{})
-
-// LRU implements a non-thread safe fixed size LRU cache
-type LRU struct {
- size int
- evictList *list.List
- items map[interface{}]*list.Element
- onEvict EvictCallback
-}
-
-// entry is used to hold a value in the evictList
-type entry struct {
- key interface{}
- value interface{}
-}
-
-// NewLRU constructs an LRU of the given size
-func NewLRU(size int, onEvict EvictCallback) (*LRU, error) {
- if size <= 0 {
- return nil, errors.New("Must provide a positive size")
- }
- c := &LRU{
- size: size,
- evictList: list.New(),
- items: make(map[interface{}]*list.Element),
- onEvict: onEvict,
- }
- return c, nil
-}
-
-// Purge is used to completely clear the cache.
-func (c *LRU) Purge() {
- for k, v := range c.items {
- if c.onEvict != nil {
- c.onEvict(k, v.Value.(*entry).value)
- }
- delete(c.items, k)
- }
- c.evictList.Init()
-}
-
-// Add adds a value to the cache. Returns true if an eviction occurred.
-func (c *LRU) Add(key, value interface{}) (evicted bool) {
- // Check for existing item
- if ent, ok := c.items[key]; ok {
- c.evictList.MoveToFront(ent)
- ent.Value.(*entry).value = value
- return false
- }
-
- // Add new item
- ent := &entry{key, value}
- entry := c.evictList.PushFront(ent)
- c.items[key] = entry
-
- evict := c.evictList.Len() > c.size
- // Verify size not exceeded
- if evict {
- c.removeOldest()
- }
- return evict
-}
-
-// Get looks up a key's value from the cache.
-func (c *LRU) Get(key interface{}) (value interface{}, ok bool) {
- if ent, ok := c.items[key]; ok {
- c.evictList.MoveToFront(ent)
- return ent.Value.(*entry).value, true
- }
- return
-}
-
-// Contains checks if a key is in the cache, without updating the recent-ness
-// or deleting it for being stale.
-func (c *LRU) Contains(key interface{}) (ok bool) {
- _, ok = c.items[key]
- return ok
-}
-
-// Peek returns the key value (or undefined if not found) without updating
-// the "recently used"-ness of the key.
-func (c *LRU) Peek(key interface{}) (value interface{}, ok bool) {
- var ent *list.Element
- if ent, ok = c.items[key]; ok {
- return ent.Value.(*entry).value, true
- }
- return nil, ok
-}
-
-// Remove removes the provided key from the cache, returning if the
-// key was contained.
-func (c *LRU) Remove(key interface{}) (present bool) {
- if ent, ok := c.items[key]; ok {
- c.removeElement(ent)
- return true
- }
- return false
-}
-
-// RemoveOldest removes the oldest item from the cache.
-func (c *LRU) RemoveOldest() (key interface{}, value interface{}, ok bool) {
- ent := c.evictList.Back()
- if ent != nil {
- c.removeElement(ent)
- kv := ent.Value.(*entry)
- return kv.key, kv.value, true
- }
- return nil, nil, false
-}
-
-// GetOldest returns the oldest entry
-func (c *LRU) GetOldest() (key interface{}, value interface{}, ok bool) {
- ent := c.evictList.Back()
- if ent != nil {
- kv := ent.Value.(*entry)
- return kv.key, kv.value, true
- }
- return nil, nil, false
-}
-
-// Keys returns a slice of the keys in the cache, from oldest to newest.
-func (c *LRU) Keys() []interface{} {
- keys := make([]interface{}, len(c.items))
- i := 0
- for ent := c.evictList.Back(); ent != nil; ent = ent.Prev() {
- keys[i] = ent.Value.(*entry).key
- i++
- }
- return keys
-}
-
-// Len returns the number of items in the cache.
-func (c *LRU) Len() int {
- return c.evictList.Len()
-}
-
-// removeOldest removes the oldest item from the cache.
-func (c *LRU) removeOldest() {
- ent := c.evictList.Back()
- if ent != nil {
- c.removeElement(ent)
- }
-}
-
-// removeElement is used to remove a given list element from the cache
-func (c *LRU) removeElement(e *list.Element) {
- c.evictList.Remove(e)
- kv := e.Value.(*entry)
- delete(c.items, kv.key)
- if c.onEvict != nil {
- c.onEvict(kv.key, kv.value)
- }
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go b/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go
deleted file mode 100644
index 74c7077440c917d518bd8139d312e00a709bfa25..0000000000000000000000000000000000000000
--- a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package simplelru
-
-// LRUCache is the interface for simple LRU cache.
-type LRUCache interface {
- // Adds a value to the cache, returns true if an eviction occurred and
- // updates the "recently used"-ness of the key.
- Add(key, value interface{}) bool
-
- // Returns key's value from the cache and
- // updates the "recently used"-ness of the key. #value, isFound
- Get(key interface{}) (value interface{}, ok bool)
-
- // Check if a key exsists in cache without updating the recent-ness.
- Contains(key interface{}) (ok bool)
-
- // Returns key's value without updating the "recently used"-ness of the key.
- Peek(key interface{}) (value interface{}, ok bool)
-
- // Removes a key from the cache.
- Remove(key interface{}) bool
-
- // Removes the oldest entry from cache.
- RemoveOldest() (interface{}, interface{}, bool)
-
- // Returns the oldest entry from the cache. #key, value, isFound
- GetOldest() (interface{}, interface{}, bool)
-
- // Returns a slice of the keys in the cache, from oldest to newest.
- Keys() []interface{}
-
- // Returns the number of items in the cache.
- Len() int
-
- // Clear all cache entries
- Purge()
-}
diff --git a/vendor/github.com/icrowley/fake/.gitignore b/vendor/github.com/icrowley/fake/.gitignore
deleted file mode 100644
index 3df5d9f039991d196711bfba62ab38722f066738..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/.gitignore
+++ /dev/null
@@ -1,26 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-/vendor
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
-.DS_Store
diff --git a/vendor/github.com/icrowley/fake/.go-makefile.json b/vendor/github.com/icrowley/fake/.go-makefile.json
deleted file mode 100644
index 7f688de04d87cfb3bcf7b451a930be94bcbd80e7..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/.go-makefile.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "build_id_generator": "0x$(shell echo $(version) | sha1sum | awk '{print $$1}')",
- "host": "github.com",
- "include": [],
- "kind": "package",
- "name": "fake",
- "tool": [],
- "user": "icrowley",
- "version_generator": "$(shell git rev-list --count HEAD).$(shell git rev-parse --short HEAD)",
- "version_variable": "cli.version"
-}
diff --git a/vendor/github.com/icrowley/fake/.travis.yml b/vendor/github.com/icrowley/fake/.travis.yml
deleted file mode 100644
index b809e455fa159217de9433a58a0330a49720dd1f..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-sudo: false
-language: go
-
-go:
- - 1.6
- - 1.7
- - 1.8
- - master
- - tip
-
-script: make test
diff --git a/vendor/github.com/icrowley/fake/LICENSE b/vendor/github.com/icrowley/fake/LICENSE
deleted file mode 100644
index ad962fa768efb8012c488e2640de1af6e40e2047..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Dmitry Afanasyev
-
-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/icrowley/fake/Makefile b/vendor/github.com/icrowley/fake/Makefile
deleted file mode 100644
index ab4233b3aee17ed74332008e245ffb0d51f4cb53..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-.DEFAULT_GOAL = all
-
-numcpus := $(shell cat /proc/cpuinfo | grep '^processor\s*:' | wc -l)
-version := $(shell git rev-list --count HEAD).$(shell git rev-parse --short HEAD)
-
-name := fake
-package := github.com/icrowley/$(name)
-
-.PHONY: all
-all:: dependencies
-
-.PHONY: tools
-tools::
- @if [ ! -e "$(GOPATH)"/bin/glide ]; then go get github.com/Masterminds/glide; fi
- @if [ ! -e "$(GOPATH)"/bin/godef ]; then go get github.com/rogpeppe/godef; fi
- @if [ ! -e "$(GOPATH)"/bin/gocode ]; then go get github.com/nsf/gocode; fi
- @if [ ! -e "$(GOPATH)"/bin/gometalinter ]; then go get github.com/alecthomas/gometalinter && gometalinter --install; fi
- @if [ ! -e "$(GOPATH)"/src/github.com/stretchr/testify/assert ]; then go get github.com/stretchr/testify/assert; fi
-
-.PHONY: dependencies
-dependencies:: tools
- glide install
-
-.PHONY: clean
-clean:: tools
- glide cache-clear
-
-.PHONY: test
-test:: dependencies
- go test -v \
- $(shell glide novendor)
-
-.PHONY: bench
-bench:: dependencies
- go test \
- -bench=. -v \
- $(shell glide novendor)
-
-.PHONY: lint
-lint:: dependencies
- go vet $(shell glide novendor)
- gometalinter \
- --deadline=5m \
- --concurrency=$(numcpus) \
- $(shell glide novendor)
-
-.PHONY: check
-check:: lint test
diff --git a/vendor/github.com/icrowley/fake/README.md b/vendor/github.com/icrowley/fake/README.md
deleted file mode 100644
index 3c1fe8a1bcb8e1731cdf2df0d1ef5a697f5ac41d..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/README.md
+++ /dev/null
@@ -1,90 +0,0 @@
-[](https://travis-ci.org/icrowley/fake) [](https://godoc.org/github.com/icrowley/fake) [](https://raw.githubusercontent.com/icrowley/fake/master/LICENSE)
-
-Fake
-====
-
-Fake is a fake data generator for Go (Golang), heavily inspired by the forgery and ffaker Ruby gems.
-
-## About
-
-Most data and methods are ported from forgery/ffaker Ruby gems.
-For the list of available methods please look at https://godoc.org/github.com/icrowley/fake.
-Currently english and russian languages are available.
-
-Fake embeds samples data files unless you call `UseExternalData(true)` in order to be able to work without external files dependencies when compiled, so, if you add new data files or make changes to existing ones don't forget to regenerate data.go file using `github.com/mjibson/esc` tool and `esc -o data.go -pkg fake data` command (or you can just use `go generate` command if you are using Go 1.4 or later).
-
-## Install
-
-```shell
-go get github.com/icrowley/fake
-```
-
-## Import
-
-```go
-import (
- "github.com/icrowley/fake"
-)
-```
-
-## Documentation
-
-Documentation can be found at godoc:
-
-https://godoc.org/github.com/icrowley/fake
-
-## Test
-To run the project tests:
-
-```shell
-cd test
-go test
-```
-
-## Examples
-
-```go
-name := fake.FirstName()
-fullname := fake.FullName()
-product := fake.Product()
-```
-
-Changing language:
-
-```go
-err := fake.SetLang("ru")
-if err != nil {
- panic(err)
-}
-password := fake.SimplePassword()
-```
-
-Using english fallback:
-
-```go
-err := fake.SetLang("ru")
-if err != nil {
- panic(err)
-}
-fake.EnFallback(true)
-password := fake.Paragraph()
-```
-
-Using external data:
-
-```go
-fake.UseExternalData(true)
-password := fake.Paragraph()
-```
-
-### Author
-
-Dmitry Afanasyev,
-http://twitter.com/i_crowley
-dimarzio1986@gmail.com
-
-
-### Maintainers
-
-Dmitry Moskowski
-https://github.com/corpix
diff --git a/vendor/github.com/icrowley/fake/addresses.go b/vendor/github.com/icrowley/fake/addresses.go
deleted file mode 100644
index 4ef4011e50e4be3dd4f1edfd1ccaff33a6220243..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/addresses.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package fake
-
-import "strconv"
-
-// Continent generates random continent
-func Continent() string {
- return lookup(lang, "continents", true)
-}
-
-// Country generates random country
-func Country() string {
- return lookup(lang, "countries", true)
-}
-
-// City generates random city
-func City() string {
- city := lookup(lang, "cities", true)
- switch r.Intn(5) {
- case 0:
- return join(cityPrefix(), city)
- case 1:
- return join(city, citySuffix())
- default:
- return city
- }
-}
-
-func cityPrefix() string {
- return lookup(lang, "city_prefixes", false)
-}
-
-func citySuffix() string {
- return lookup(lang, "city_suffixes", false)
-}
-
-// State generates random state
-func State() string {
- return lookup(lang, "states", false)
-}
-
-// StateAbbrev generates random state abbreviation
-func StateAbbrev() string {
- return lookup(lang, "state_abbrevs", false)
-}
-
-// Street generates random street name
-func Street() string {
- street := lookup(lang, "streets", true)
- return join(street, streetSuffix())
-}
-
-// StreetAddress generates random street name along with building number
-func StreetAddress() string {
- return join(Street(), strconv.Itoa(r.Intn(100)))
-}
-
-func streetSuffix() string {
- return lookup(lang, "street_suffixes", true)
-}
-
-// Zip generates random zip code using one of the formats specifies in zip_format file
-func Zip() string {
- return generate(lang, "zips", true)
-}
-
-// Phone generates random phone number using one of the formats format specified in phone_format file
-func Phone() string {
- return generate(lang, "phones", true)
-}
diff --git a/vendor/github.com/icrowley/fake/credit_cards.go b/vendor/github.com/icrowley/fake/credit_cards.go
deleted file mode 100644
index 47d6ca726895e4cbe49850925f1ecfe76909e812..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/credit_cards.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package fake
-
-import (
- "strings"
-
- "strconv"
-)
-
-type creditCard struct {
- vendor string
- length int
- prefixes []int
-}
-
-var creditCards = map[string]creditCard{
- "visa": {"VISA", 16, []int{4539, 4556, 4916, 4532, 4929, 40240071, 4485, 4716, 4}},
- "mastercard": {"MasterCard", 16, []int{51, 52, 53, 54, 55}},
- "amex": {"American Express", 15, []int{34, 37}},
- "discover": {"Discover", 16, []int{6011}},
-}
-
-// CreditCardType returns one of the following credit values:
-// VISA, MasterCard, American Express and Discover
-func CreditCardType() string {
- n := len(creditCards)
- var vendors []string
- for _, cc := range creditCards {
- vendors = append(vendors, cc.vendor)
- }
-
- return vendors[r.Intn(n)]
-}
-
-// CreditCardNum generated credit card number according to the card number rules
-func CreditCardNum(vendor string) string {
- if vendor != "" {
- vendor = strings.ToLower(vendor)
- } else {
- var vendors []string
- for v := range creditCards {
- vendors = append(vendors, v)
- }
- vendor = vendors[r.Intn(len(vendors))]
- }
- card := creditCards[vendor]
- prefix := strconv.Itoa(card.prefixes[r.Intn(len(card.prefixes))])
- num := []rune(prefix)
- for i := 0; i < card.length-len(prefix); i++ {
- num = append(num, genCCDigit(num))
- }
- return string(num)
-}
-
-func genCCDigit(num []rune) rune {
- sum := 0
- for i := len(num) - 1; i >= 0; i-- {
- n := int(num[i])
- if i%2 != 0 {
- sum += n
- } else {
- if n*2 > 9 {
- sum += n*2 - 9
- } else {
- sum += n * 2
- }
- }
- }
- return rune(((sum/10+1)*10 - sum) % 10)
-}
diff --git a/vendor/github.com/icrowley/fake/currencies.go b/vendor/github.com/icrowley/fake/currencies.go
deleted file mode 100644
index b85c943638cc1735cfcf57e326002275f4bd5ceb..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/currencies.go
+++ /dev/null
@@ -1,11 +0,0 @@
-package fake
-
-// Currency generates currency name
-func Currency() string {
- return lookup(lang, "currencies", true)
-}
-
-// CurrencyCode generates currency code
-func CurrencyCode() string {
- return lookup(lang, "currency_codes", true)
-}
diff --git a/vendor/github.com/icrowley/fake/data.go b/vendor/github.com/icrowley/fake/data.go
deleted file mode 100644
index 7249a9d3859c98a0decb4f9db384d03acdbdca7a..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/data.go
+++ /dev/null
@@ -1,493 +0,0 @@
-package fake
-
-import (
- "bytes"
- "compress/gzip"
- "io/ioutil"
- "net/http"
- "os"
- "path"
- "sync"
- "time"
-)
-
-type localFS struct{}
-
-var local localFS
-
-type staticFS struct{}
-
-var static staticFS
-
-type file struct {
- compressed string
- size int64
- local string
- isDir bool
-
- data []byte
- once sync.Once
- name string
-}
-
-func (fs localFS) Open(name string) (http.File, error) {
- f, present := data[name]
- if !present {
- return nil, os.ErrNotExist
- }
- return os.Open(f.local)
-}
-
-func (fs staticFS) Open(name string) (http.File, error) {
- f, present := data[path.Clean(name)]
- if !present {
- return nil, os.ErrNotExist
- }
- var err error
- f.once.Do(func() {
- f.name = path.Base(name)
- if f.size == 0 {
- return
- }
- var gr *gzip.Reader
- gr, err = gzip.NewReader(bytes.NewBufferString(f.compressed))
- if err != nil {
- return
- }
- f.data, err = ioutil.ReadAll(gr)
- })
- if err != nil {
- return nil, err
- }
- return f.File()
-}
-
-func (f *file) File() (http.File, error) {
- return &httpFile{
- Reader: bytes.NewReader(f.data),
- file: f,
- }, nil
-}
-
-type httpFile struct {
- *bytes.Reader
- *file
-}
-
-func (f *file) Close() error {
- return nil
-}
-
-func (f *file) Readdir(count int) ([]os.FileInfo, error) {
- return nil, nil
-}
-
-func (f *file) Stat() (os.FileInfo, error) {
- return f, nil
-}
-
-func (f *file) Name() string {
- return f.name
-}
-
-func (f *file) Size() int64 {
- return f.size
-}
-
-func (f *file) Mode() os.FileMode {
- return 0
-}
-
-func (f *file) ModTime() time.Time {
- return time.Time{}
-}
-
-func (f *file) IsDir() bool {
- return f.isDir
-}
-
-func (f *file) Sys() interface{} {
- return f
-}
-
-// FS returns a http.Filesystem for the embedded assets. If useLocal is true,
-// the filesystem's contents are instead used.
-func FS(useLocal bool) http.FileSystem {
- if useLocal {
- return local
- }
- return static
-}
-
-var data = map[string]*file{
-
- "/data/en/adjectives": {
- local: "data/en/adjectives",
- size: 119,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\x14\x8b\xc1\n\xc20\x10D\xef\xf3W\x85H\xf5d\xb0\xe2=\xa6cYH\xbb\xb2n\xf0\xf7\xbb\xb9\xcc\xf0\x98y\x93\x18f6L\xdd\x15Y\xff4<\xcb\x16\xb8ʻ\x11ׄ9/1\x98\x97\xc1I~\x15\x97\xc6\xea&\x15\x99\xf6Q\xdb\xcbQ\x89EV\xe2\x15\xa1\xb8\x1d\xdf\xee\xb8w\x1f\x95\xc4\xe2\x8d\aw\xf5\xe1o\xe2\xa5\xe1\f\x00\x00\xff\xff\xd8\x18m\xadw\x00\x00\x00",
- },
-
- "/data/en/characters": {
- local: "data/en/characters",
- size: 72,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\x04\xc0\xc3\x01\xc4\x00\x00\x00\xb0\u007f\xa69c\x9c\xdav\xa7o\x02\xa1H,\x91\xca\xe4\n\xa5J\xad\xd1\xea\xf4\x06\xa3\xc9l\xb1\xda\xec\x0e\xa7\x9b\xbb\x87\xa7\x97\xb7\x8f\xaf\x9f\xbf+\x00\x00\xff\xffq\xa7L\x96H\x00\x00\x00",
- },
-
- "/data/en/cities": {
- local: "data/en/cities",
- size: 4837,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\\X[\x9a\xe3(\xd2}\xd7*\xb4\x81\xfe\xf7\x90wgwf\xa5\u007f\u06dd\xf9\xd5cX\xc2\x16m\x04\x1a@v\xb9v5k\x98\x8d\xcd9\x01rWϋ\xe3\x04B\b\xe2r\"\xf0]o\x9c\xf8\x1c\x9a\xbbc\x98\xa3\xb4+\xeb\\j\ue70c\xa6\x17Ƚ\xf8+\xc4 \xe3>R\xb7)\xb4\x9f\xd6\xfc\x85\x17\\\xc6\v\x98;J\x1fb\xfb`3&\x8e&\xdaN|\xfb\x80ׂo\xee\xbc\fƎ\x90\xbd\x89I\a\x8e\xc6%<\x1e'\xe0lC74w\xd3\xe4L\xfb)\xce\x19\xac\x10;魨\xcc\x141\\C\xfb\x12\x05+@\xcb&\xe9ó\xc5ZY\x12&\x9b\x88\xbd\xe4\xc1\xc4\xcc\xf5\xf3E\xb2\x89\xcdݼ\x9f#Գ8\x8e\x9e\x8d\x17\xd7\xdc\xfd\x9c\x934\xf7r\xc2^\x0eָ\x1e\xd8\xf5\x17\xeb۵\xc4\x13\x14\xef\xad?BƔå\xb972\x8f\xc1g\x00\xe7\xf4\xa7}\x91\xd8\x1b\x9fT9\xb8p\xc1\x97\x00\x97Ig\x83\xcd\x18 o;\xec\xf2\xdeē\xe1\x99\xee\xcd\xd9Dw\xad\xb6\xbd\xb7\xc7\x16K\xc7\xf6\r\x1b\xa1v\xe4X\x1a\xc2\xd4ܻ\xd9\xd4awő\x9a\xfb(=\x0er%\xb8\xe8R\xd1\b\u007f|\xbe\x84\x80\xfdG\x9b\xe0!L\x9c\xb1#\x1a\x00\xc0K=\xcf\x1c\xf1L\xa5ù\xe0\xd1\xe6A\x9c\xec%\xc1k@\xe6\x87\xed\x02\x81=\x84\xe8\xad\x14\x17R\x1f\r\xecD0I\x8e\xb6@\x98\xe4H4J\xc41\xf8\x1e=\\v\xfb \x93\xcd\xc1\xf1qt\xd8PO0\x1a\xf7\xdb\xfe\xfa\x1b\x8e\xf1\xdb\xd6\xe8\xa3\xc9z\xf8F\xd7\xd3`x\x10<죸\xfae\x18/\xf17b1\x80A\xb77X_\u007f\xab\xfd\x1e\x86p\xe9\x06@\xac3\xccN\x10\x8e\t\x91\x82%\xe2\x9cڕ\xb1\xc7!c\x96\x93h\xd41@WZ\xe6\xc1\xc1\xe8N\xb7\xeb\x02\x1c\xd2\xc3\x02\n-f\a\xe9\x06\xa3K\x06Qc\x01\xb8\x83\xfc\xa0\x18U\xd1%\x82c\x04q\xb7m8\xb4\x0faD\xbcwX%\x8cSy\xee\xbb\x10q\xfa\x10!\x85\x03QC\n2x\xa9\xa2\x0f\x04ٴ\xef\f^\x8eb\xff\xed\xbb\xda\x8d\xb3\x8d͓\xa4\xac\x13[0Gh\x9e\xe0u\xf9\v\xcb\x10\xe0\x90\xb1\f\x15\xef\x13\xbe\xc3y\x86`k\x8e\xb3\xef9v\x02\x11\xc0u\xcd\x13\xcc~-Gz\xf2\x9d\xf5\x16L\xd0<\x81\f\x98\xec\x90خ\xe5\v\x19F|\x9a\xa39A\xfc0\xe4\x85g\xb1\x91nU\xa9\x14\xf0\xccH\x8d\xa9\xac\xf6l\xa2\u05f8x\x86:\x86H\x10\xcd^\xe6\xe3\xd0<\a\x97\xc2\b\xe13L\v\t;!-\x8f\xc7\x02\u007f\x0f\x1e\xd1K8\xebӔ\x17/=\x87\x19\xaf\x80e*\xc5=\a\xa42\xb6R\xe3\x132\xc1\xf2\xcf3\x1e*\x87\xbd\x88\xcbMa\x9azޢH\xf3b\x1d\xe8\xb0yq\xa6\xecR\x01\x02\xady\t\xced\n\xff\x13\xe3\xa9Q\xbelw0\xa6 <\xa1\xa5\xb4|\xfd%\x1a\xe3\xcb\xd1_\xa2\xed\xcb\x10\xf3\x81\xa4\x046~\x99\x05k#\xb0\x80\x12b\xcb4+q\ax\x03\xc9~/Wh\xfe\xc0\x18_\xc9E\xac\x05\xd5/\x9c\x88\x81< \xde\xf9\xc2\xf5\"\x9cb@\xaf\t\xfcu\x04\x1cM\xc6o\xecf\xee\x0f`\fI\xea'W&M\xca\v+\xdb\xf3\xd0%\xcfWHd\xc4$\x96\xa1\xbaG\xea\xd0\v\xab\xe0\xc8E\xb0\x1fP.^[\xe1\x01\xf9d\x05;#d3wZ\x16\xfe{@\x19q5#\xff\x9a\xd7Q\xbf\xe6n\xa0\xce~E\xd4\xe0<_\x86_\xa7\x12n\x99\x0e\r\xc6\x00\x0f\xbf\xfa\xa33J\xbd\xaf\xf0w\xf3\xcaBD\x81\"\xa2\x1eyMp\x04\xbe\xf1\xbbt'n\xe9\x0f\x1c\x14<\xf0\avQ\x82\x81\xa8\x98\xe4\r\x84+\xff\xf97\xac\xdd>#Q@\xb4\xfd\xd1pt%,\xb5\v\xb81\xda[\xe5\bJ\x8b\xba\xa0\b\xf94\x16\x00\xde\xcf\xfa\xfa\xff\xcfXL\xc7>\r\xbd\xf1&\a\xb9\x9a\xac\x0f\x91H\x8bѫRl]\x95o\xf6\x88:\xb2h_8&\x1f\x9dL\xfb\xe4\x12X&\x9a\xa2!\xc8Mʊ'Ļ\x02\xb5ɛ\xf8N\xd49o0w\x9af\x825\x94\x01\xed\xc1`2\v\x10f\xe0\xcd%É\x118\x86`Rj|\xb7)YX\xbd4n\uf847\xfb(=\xbc\x80\xb4#\xd3\xc2\xe5FA\xe7@\x8d\x8a\f\x98\x17\x9dF(\xcaް\xea+\x8c\xfcH\x05u7p\xe3T\x00\x18\x91+\xf2\xc5ۆB\xd1/]\xc27cz\xba\xe8\x9b93u\xea\u0605\x1f\x87`\xb2ALJ\xcej\xf9o\xac\xc5\xfc\xbd\x88Ôp\x863\x1bĖ\x06#\xa4\x1a\x98\x12\x1b\xfd\xe8\x8c\xf8d\xd1i~\xfc%\xb6\xf9\xc0\x96\"X\xe0\x03l\x8a\xd4,\x02U\xffL\xac\xa1\xf7Q\xfc\xf3A;\xd2u\x1f?<\x89o-\x9d=خFyդa\xb2\xb6\xa5\xc2\x16\xbc\x94X*\xba\x9f\xbfˣVTf0|\xd5>\xc1D\xe8|1\x88\xbc\xb7\xc9(\x18i2\"g\x91pktuZ#\x00B\xbb\t{\xa7\xf3\x91\xf6\xdaj\xad\x8d\xd6\xea5\x8c\xeaf0\xc6\x1aQ\xd8n\x98]Ħ\xd7J\xb4F\x8es\x136\x8d\xa1Zoms.t\xb5v\xc2^\x04\xe1\xa2(\x96\x03\xaf\xd1T%\xc4vq\xee\xa2\xf1\x83\xee\x8a\rf\xac\xc0\x16\xa4\xbd\x8b\xba\xb70\x06\x15l1@X(\n\xaa\xdcV\x03f\x1bY\xe5\x12?\xebpA\xbcl@.C\x80\xf9c\x0f'\xdeԹc{r\xbc\r\x90\x1bᬪ\xfdj\xc6el\x8b\x1d\n;\xa0#\xbc\x8b \xdb\x1847n>\x1c\x88z\xb6k\x90\xf4k\"@/\xb1\x18\x03\x1a\x13\xb3\xc4\xdcF\xe3\x10Ғ\x15 \xba\x81m\x12\x00h\xbcS\x82\xdc\xd8\x00w\xc3.\x04\xa5K\xdd\xd8\t\xc6Q\xc3ko\xaeH#n\x13\xba\x13\xfb\xa5M\x18<[0ͫ\r\xab\x1d\xf8\xac0\xd4?\xb4[PlB\x82\x1d\xd1s\x13\x14;\x02\xa5f+\x1d\x82\xc4\xf0n\xb7eO+\x1c\xf2\xa0\xb8\xc4\x1b\x8bb\xdcP\x18\xafl U\x8dsE\xec\xe3C\x99\x8f\xb6y\xd4\xd2B\xe5њc\xa8h\xac\v\xb2g\x12\xf6g\xaa G:\x8b\x0eL\xb5\x17\x140t\x1a\x8aQ\x11m\xd9\vp\x90\u007f\xa1JU\x9c\xcaڿ\xcf܂\xccY\ru\x1b\xe1\xdd\x02\xa5W\xea\xceސ\xa1}\xacx\xb6\xa9\xfd\xd8\xdb4\x15\x1d.\xed\uab95^\x97\xd1l\nZ\xcb\xde\x15\xb4AM\xac\xfb\xda0|\x88\xaa_\xb7L\xf2ؔ \xc1\xfd\xb5\"t\xbf{$]\xd5x\xbb\xf8\x15\xdb|\xd3\xe2\xfc\xb3\xc2gsK\xf0[\xc8\xd9e\x1e\xf8\x93\x94P\x94\xb5\xe0\x1eS1|W\xa0\xa1Y\xa2\xe8\xb5k+\xb8w86\xc6\xdb. #\x97\xcc\xc0\xc5j\xe9^\x005\x8e\xb6hW\xc1\xeeS\xc0\xf1\f\x9b\x030\xec\x81%\xb90m\xb9\xb0m-[C^@\"\x95#\xd9U3xkG{[\x1c)xk\x17\xa0\x98\x1eA\x06y\x86\x85 }\xe0\xe2\x10\xb4\x04S\xbd\xbd5\xedEE\xd9\\\xa0\xb6\r;\x19\xc22p\xa3\xab\xa2\xfeO\xe8\xe4\xffC\xd7\xe3\xf4q.t\xb2\xcdH\x8f\x02f4f\xd5U\xf0\xff\xec\x17\xec\xfd\xf5L\x0e\xdd\xc2T\xf5\xbe\xb3\x9d\xb3v\xe1hyO\xcd\x0efhvf\xc0i\x10R\x8ap\x80\x1d\xa2\xbb\xa3\xf5\x01\xf87\x84.\xb6\x1b\x02\x17\xe9\xcb\xd5h\x87\xf2ξq\x87҅-\x9af\x87\xae\x1a\x93\xe0ZK\x93\xec\xe2ܝ\xe0\xad\xdd\xcc;'\x85\xd1k\xe6\x0e\xf7n\xec\x1a\x92}t\xb3\xbb \x8d\xae\xb8\x0e\x1a\xed\xdaR\xf3\xe7\xc9\xca\xd0\xfc\xe9Y\x99\xf5\xb3\u007fNZM>\xa5\x93\xb2\u007fu\x04*\xf6'ޜaf6t\xd8ȧ\xedr\xa8\x94\xf9ɋp!\v0\fbD\x9a\xc24_\xe2\xfc\x9c\xab\xa8&\xf8\x12\x9a\xf7\x8b\xff\x90h\x0f\x0f\x84\xe2P\x16\xfa\x02\x9f\xe1\aw\xb4z\xfbT\xfc\v\x89P\xe7\xb9Z\xfd\xe4\xd1\xe8\xc0h\xbd\xf6{\x8aC\xa9\x86_\x83\x91\\\x11\xca\a\xab\xd3\x17^\xc152\x15\x90\x8b\f\x17J\xd0l\xe0\x04\xb6\x13\xd0\xc1\xafj\xbc\x02\xb8\x06\xbbP\x06\xf6\xf7\x80\f\xac-\xdfw־\xb2\xef\xefz\xbd\xfb\x8eki1\xe2w\x14\x04;q\xa4\xeb\x96\n\xf2\xdf\x00\x00\x00\xff\xffPpU\a\xe5\x12\x00\x00",
- },
-
- "/data/en/colors": {
- local: "data/en/colors",
- size: 128,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\f\xcaA\xaa\xc2P\f\x05\xd0\xf9\xdd\xd5\xff\x82ED,R\x04\x87\xa1\xefRC\xd3ĦF\xb7oGgrnl\xf8\xb7\"\xba$\x1d\x0f\x9a\xc5\x17\xd7\x14\x9f\x88\xbe\xf2e\xc4]\xc3\xf8\xc6ɛN\x81\x81b\xe8\xd5g\x1ck\x1bUЅ5zF\xc3Eꃿ\xb5d\x91T'\x86ʵB7\u243al\xe1\xfb\xc8\xd8\xe9k$\xceO\x99\xf5\x17\x00\x00\xff\xff\xfe\x16\b\xa6\x80\x00\x00\x00",
- },
-
- "/data/en/companies": {
- local: "data/en/companies",
- size: 3157,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffTV\xdbR\xe3<\x13\xbc\xd7[q\b\xd4G\b\xb0@\xb1\u007fr'\xc7J\xa2\x8dm\xb9|\b\xb1\x9f\xfe\xef\xee\x91\xd9ڋ-6\xb6<\x9a\xe9\xe9\xee\x99\xf5w\xac\xe2pr+?%\xf7\x95R\xfeQ\xa4\xab{\x8cG\xfd݄p\t\xc9mS]\x8cn\x15\xbb\xe0^\xa7Ԕ\xa1s\xf7S\xe3\xe7yr\xf7\xa1\x8e|\xf9;\x9e\xe3<\xbb\xff\x9a&\xed\xdc[\xbc\xa6f\xba\xba\x8fƷ\x83?\xf6n\xeb\xeb\xe8\xdd\xcd\xc5\u05f5\xbb\v\xcd\x10\xf5\xb3\xf0\x83w\x0f!\x94u\xbc\xba\a_\xe2\xa6\xcfS\x1a\x8f\xa7\xa1\xe8by\f\xcb/\xbe\xbe9\xc6\xcb\xe8\x9e<\xc3ގEQ\x05>\xbd\x8f\x17\xdf\x06\xf7\x1c\x18\x13\xcf\xe7\xb9\b\xbe\xe1\xe1\xba\xf08}\xed[\xfc\xfc8O\xf8\xf6\xa1\x8am?\xa4\xaev\xb7]\xfa\xeeCQ\xf9\u00adpM;V}pw\xe9\x18Y\xf2\xb3\xff\x93\xdc{\xf0Ւ\xc3wD\xd2\xc0\xaa\x19\x97|,\n\xe3\xa5\x16u\xdc\xfb\xa2?\xa5\xa1w/\xad\a\x82\xa8\xf2\x12\x82\xbb\xad\xd2\xf1\u007f\x1f\b\ap\x91\x80\xd2)\x8a\xd0\xf5\xed)t?\xa5)\x89\x8fslP\xcc\x1b\x82\xa0\t\xfd \x14\xff\xf8Z/\b6@G\x95\x19\xe2[\xcf\xea\xf5\xe1\xfbi\x9ac\"\xba\x05n$\x18MJe\x15\xf2\x99>\f\xee\x13)\xee\xbf=nܦ2%\xf4\xebҦ\xd8\f\xaa\\A\xf0\xa4?\xf1\xc0g7\xf2\x04\x81\xe0_\x16\xd0\xfa\x92\xccP\x12\x9b\xa9\x19\x02\xda4\xcc\xee\xd1\x17\xc3\xd8\x04<*\x00\xb9[\xfb\x89,Y\xfbyt_\x91\xa7T\n+\x00\x81p~\x97\x12\x0f\xe8i1\x1eY\x0f\xf0 \xc8\xfb\xb1@\xfb\xe2%\x1cb\u007fB\x04\xa4\xf1D\xc4n\xbbHt\xd8L\xbe\x15\xb0@1\x97\x87\x94\xe3a\"\xf0\xbcc\xed\xed\x8azN\r?\xaf\x98\xbc\xb5\x18w}\x9c\xc6á\ne\x870L\x87\xa4}\xc0\xffs{QJߦ\xc1\xbd\xe3\xfbZ/\xf6'?\xa8x0\x97a\xf3\x9d\xeb\x05\xdb;p\xb9$\xe8e\xa8\x04\xaaal\xa4\xb0\x1e\x0fS\xcbD\x86.\x928\xe4\xf5\u007f\xecӗ\xee\x00+U\x17\x9a\x9b\xf9\xb8\x89\xd0\x01%\xb7\xafF\xb1\x81\xea\xc8\x19\xf4@\x14\xe5Qn\x17P(\f\xdfT\xe1\x06TM\xee\xd7(\x9a\xaf\"\xc9\xffJ\x86\x8du\vαc\xe0S曮\xf8\x87\xb9\x9b\xe9;u\xe7\x9e0\x12\xa1\xe7\u061c3\x1a@\xf4\x00=\x12'Q\n\xb9 \xecV\xdd[I\xef?=$\u007f\x94\xaf\x1c\xc1\xe4\xc5\xe7\xd4>\x93\xdb1\xdfO\u007f\x14Q\xd8\x1d\x8ak\x15\t\x1a\x10h\xfc\x10SCq\rC\xe8,\x9dߩ+\xdbPF\xf3\x84|\x02\x19\xed\xdcf$ʾ\xf2MX>Y\xd4ٙ\x871\xe1Zw\xb7?G$\xa5W2\x8d\xcc\x0e$\x85\x8f\xcd\x05\x90\x04\xa1m\xa2\x85\x86rc\xc9\xc7\x03\xd1\xddҗd\x01\xd4\a07\x87\xd8\xfa\xb3\x84\x81\xa2\xa8\v\x02\xf0m\xc7\xf7\xa13\xbd\xe4\xa4e\x01ɽ\x92\x89π\r\xe0\xe0\xb6\xecE\xb1\xd5% \xdc5\x1b\r5\xb4\x19\xf1K\xd4\a\x9b\x8c\xac/$\xa0\xb8\xa5$n\x00\x11ɕ\xb47\xa2\xa1\x91u\xceHS\x8a\xa3\x85\xbc@[\xcc\xfd䙨\x8fL\xfb\xa4\x96\xde\xe3\xe1`6aSN\f\x90\xc1\x10!\xf3'\xfa+\x1e\xb1\x19\xc0\x9b\xa2\xea\xc6\xd6:*L\x91&\xf4\xf9\xa2\x1bОC\x85s\xe4\x1bc\xab3\x1c\x82\xcaT\x84\x90\xd0\xe0Z\xe6S,\x8f3B\xde\xe39\xfd\xd8\xfa\xad \\\xa9\x06\x98\x8b>\xb9\xcf\xc5\xdc\xe18zn\x15\xbfU\xdc0\x10Ĩ\x1bI\x12f)\xd0wr\x05bn\x02:k\x1ba\xc5y\xb5\x90\xe1C\x97\xa4\xfb&\xda\b\xe2l\xd9L\x80)\x8f}\x99<\x00\x94/\xf0\x02b\xc7]b\b恙j\x1c\xcbc\xf6&\xac\n7Q\x06\xbb\xf3\x8c\xa7s\xb9\xa9\xb6o1\x88\x99\x80\xfd\x1e\xfe\x8a=\x17;ϸ\xdcB\x9bv:3\xcd?\x1a}\xd2\u007f6\x93\x0fˉ\x9a\x97\x1c\x81\x89\xc8\xfa\xb3\x12,\x0e\xf6\xcf\xceD룾1q\xd8\xd2e ?i\xb9\\\xc6&\xf3\x16WLUֲmb\xda0h3ASƍ\x82mu\x0f/\xe6B\xa9\x8c\xb4\r\xbd\x12\xe9ܸl\x85\\@\xcaŔ\xc8\xf0\xac\xe5\xec\xfa\x0fKBˈ\"\x1f?\xad0\xab\xe3g\x9f\x19\x96\xb5';\tF\xe5\x97\f\xe4-\x95\x92\x8e/d\x19Xl\xafZ\xac\xa2Qd`\xd6<\aAp\xb8\xa8w\xf4\x9f\xec\xc1\xcbVɛ\x1f\xf5\xe4\xcbx\xb5\x12FZo4\xb3\x93\r2\nD\xeb\x13ljm\x9c^\xb4\aČ\u007f\xa3\xdd^\x9a\x12\x99\xd8Mn5\xb6\xf1\xd8\xfc\x04r\xe6\xa4+nD\xff\x0f\x00\x00\xff\xff\x16.\x1a\x04\xa5\xad\xb7\x99$\xb1\x99\x89\x14ꈓ\xcaJ\x9b\xa8\xc0młB\x95\x1a\xc8B\xcb\x10;\xe5z\xce\xf7\x87Ta\x1djv\x83xW<\x0e\xd3\xf3i\x88\x81\xac\x1ePN\xe9\x99CE\xf2\x13&.\xa8\xa3\x9e\x06\xa5\x81D\xf7\xae\xb5\xd4\xf0\xd0\x19}\x88\x1a\x0f\x1d[\n)\xd3VR\xafT\xce\f\xe2\xf4\x03\x0e\xbd\x9a\xb3蒺\xbc\xf0V\x8exb\xe1\a\x98\x94\r~\xe0p\xe6\xd6\x1f\xd5ԅ\x8fÉ2\x93\x8e\x1c/&.\x02\x9dłH\x94\xa1+\xde$\xb4r\xb1\u007f\xb8\x8a\x1f]#\x88ڷ\x9a\xb1\xee8@\xec\xc3\bur,ō\xda8\x90%\x18\x98lK\xea\xe8\"\x85=\x9e-\xeeh\xf0\xbaI\xb8\xc1,\xa9\xafE17\xbe\x17\xa7W]\x98\x0f\x0e\xdf\xd6\t\x98\b\xe6\xb6\x1d\x0f\xd1\xdcZ`\xd8\x1e'ɯDȇ L\xf7I\x1c\x93\xb9E\x82\x82\xd2!z\xc5\xe7m\xec\xc4\x1f\xc0ܑݫ\xdd\x17\xf3\x8bO\x1b܂\xf0\r\x9f\xa1\v\x9e\xaf~\xdd\xc9O\xc1\xe2r\xcc\xee\x02\xb9\x9aA\xd8\xc1~<\xa2@\x9aw[oGǃ\\\x05%\\\xe98\xbc\x03Ex0\xf7T!\xdd\xf7\x94#\u007f\xcf\x1e0S\x1a\x90\xeb\xd1\xdcwz\u07fdT\xc84*\xcf\xdc\af<\xa7dz\x1f\\\xc6\xc9=B\xc0֧\x03+\xdb\xeb\x12\xb9\a\xf2\xc0\xe1Łq\xd7\x14\x81\x89\xfc\xb5\x10\x003a7\xea\v\x0f\x048\x9b\a\xa6\xd0\xe4\xfa\xd8\xd47ޑ\xbdF\xc3\xd1\x01\xaa'\x0ej\xef\x93\x0f\rv+:Ӿ˽k\xc5n$\xb3\x92 \x15\x00dV\x1e\x99\xfcR<\xfb\x10\xbb\xcb&\x87ج\xd2\t\x0e\x99\xd5\x18\xda\xf1\x9c?]\x13\U0003c9a8}`\xcd\xe8}\x88\xf9\x9a\a\x1f;o\xd6R\xe5\x1e\b:\xea\n$F\xb4\xab\xc8h%k\x89]ʝr\x9d~3\x8a4\x85\xd6l\xa8F\xe8\xb0r\x93A\xb4A\x06Z\x1aj$\b\xa0\xa1\x93d2\x0eYe\x1b9\"\xcd`\xb28\xaa,\f\x1dY{\r.\x04h\x9a\xf2+1\xd8\x04d\xd0t\xab\xb2\x92T?\xfa\x18\xa1\xe4\xdfR{\xb3\x91:\xcc1\xdex\xdb\xf8\xa3RG\xaa\xd1\xea\xb4Y\xee\xe0\x02\xb7!\xcb\xe2\x00\xbcQ\x04\x1b|\x9d\x8f\x9d\x15n\xf9=\xa4\x1f\x95f\x9e\xa9\x17\x05\xe03\x1eM\xe6\x99\x0fd\xb1*Z'\x13?\xf0\x85v~kY\x85\xa7bIv\x8e\x82\xee\xbe3\xe5L?#\x9b\x810\x1e\xc0\xe1\x95g\xc1\x94\x99V=\xe8\xc3\x0fo/\x8d\xc2\xe4\xfciUl\xb4?\xa23^\xc2\x02ʼnF\xf3\r\x95`\xb6\xb4\x9f\xe6\xd7\x16\x0f$]yИ}\xec\xba_І\xebt\x10n\xa0w\x80\x14\xc8\x01\x13J\r\x9b\xc1\xbf\x9d\xac\x1a͖\xe1\xe6\x16MR\x0e\ah\x06\xb3\x95X\x93\x84\xeb\x84B\xf1N$\xc4\xd4\"\x18[\x94Q\xf4\xdaμ\xf9/i-\xbepr\x18i\xe6\xc5\xf79_/h\xf5J0KP\x90%&W\xd4\xc1\b\xdf,\xf7\xe3,x\xc0\xc6]\xb4+\x89q\xc8\xf5\xf6\xccG\x19f\xe9:\xd5r91!c\xdel\x05\x9e\xf2T\x9f\x9a<\xeb/\x9a7A\x13\x02U\x15\xde+\xa6\xae\x90\xfd\x9a\xe6yISx\x9d\a닝\xef\xa7{\xb6\x10Ղ\xa6QRB\xf5\x16_\x03)\nJ\xc5\x0e\x9c.1\x93\xf3v\xacᅦ\xbcT\x1b\xa8X3\x00\x88\r:\xc0\x01\x85gJ\v\x14\xee\xf5(\x98<\xf8K\x1d&\xfe}\\\x95\x88\x92\xcdr\x14\xe8<\xb4\xe6\xcd\xdc\xf4\xae\xd6OR\x98ܜ\x04]\xf3z\xc3A\u007f\x06\xca Ś\xdc\x1e\x1f'm\x0f%\x8a\x04\xb9\x86\tG\xc2?\xcdܿ\x9e\xb2\xbf#\u007fx\xff\xa4\xe3\\SZ\x9e\xb8a|x\x92x\x9e m\xcaQq\xb9#A\xee@~\xca\f\xb6\x1d\xb9s\xce\xed\xae\xa3\xe9\xe3\x9d`4\xfe\x85\u0381r\xdc\xf9\xd6cٳ\"r\x87\xd2\xc39\x18#\rMF\xec|Ez\x020Q`\xec0\xf8\xd1֔\xe8\xbf\xd1\xf4\x006\x13\x02\x96h\x80~\xb8\x9a\xbbKp'\x99\xd76\x83\xe9u\xaf?Bl^\x9dDnr\x96\x8a\xdb^P\xd3H\xc9,\\!\x19\x8d\xef/\xdb2\xaaR\xbb\xed\xfck\xf7\x87\xe2\x8f\xff\x99אr]\xbc\x96\xc0\x96\xf3\xa1\xf8\x96\xa2\x1dq\xe5\xfb\x89\xb2|1\xaf\xe7\x8a\xe7ؼ\x91ÌI\xa01\x8f\xe3\xa5\xc4q\xba\xbc\xf8\xf4\x80\xc9W\x94̟\xcd\x1b\x90t\x06Tɼ\tG$\xca\xfc\x8d\xce'\x93\xcfw)\xa6\x0f\xf5\xfe\xb7F5\xe8/h\x8725\xff0\xc2d\xfeI\xad\x87^\xfb\xf6\xf7iF~\x97\xbe\xa2\xea\xc4\xff\x06\x00\x00\xff\xff\xf40\xec\xfc\xd6\n\x00\x00",
- },
-
- "/data/en/currencies": {
- local: "data/en/currencies",
- size: 1800,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xfftUKv\xeb6\f\x9ds\x15\x1c\xc6\xcb\xf0\xf7%\xb1\x9d\xb8\x96۞\x97\x19,\xa1\x12k\x8at!2~\xca\xea{)\x8bJzN:\xb1\t\x10\x04..>\x9a\xffU7\xe4L\x17\xc8\xe9|Vs{\xc6?\xe9\x1d_\x18B\xcd\x02ae\x1c\t\xeeZH%\xe9\x87ߝ\t\\\xe9\"P\xe0n\xa6W\xde\xda\xe1^jv\x01\xb6\xfa\xc0\x9d\x87\x1c\xbb d\x93\x83l\x914\x90\x8b\xb21\xd6\x1aWwjA\r\xb5\xd4M&\x90\x85\x8c\xcb1\x17\xe4jK\x15w\x8d>х ˙*\xffŞmmb\xab7B\xaeL\xa2\xb4\xb1\xfa\x8c\xb8\x10\xfa0V\x1f\x99\x90\xdc\"ښd\xc8\xee\x9dԒ\x1c}\xb1\\n\xe6z\xb1\\\xcf_\xb3\xabA\xb1\x9e/'\x19\x98yL\rg\xa4\xf93\x82\xba#\xbbָ\xb3Q\xc7\xfdB?|s1SKo}{6\x99\x97\xe5\xe60\xf9\xf4\xa0_\x1f\x13\xab\xc9\xc81T\xe2)\xc0v\x1b\x1d0\xf6W\x89\x9d>\xf8\xe8*\\}p\xd9\xc0\xef5\x9e\xad)\xf5\xd6Kt\xbdZ!\x0e\xc9Eo\x05\xef\x05b\f]ٰ~\xf8\x01.\xc8\xf53\xbd\xc7u\xa7V\x1ep\x10\xc9}z\xb8\xe3Y\xc5\x00\xb7\x0f/\x1c\x1a\x16K\x884\xd3?\xa2\xb1\x15\x83\x965u\x81\xc5\xe9%\x88;\x9f\x19\xaf3a뺿\x86\fm\xdd\x05\x9f\xfa\x06 \xf0\xaf\xd6Q\xe0xc\xfe6\x93\xf9Ƹ\xe4{\x00s!R\x03\x03\x9c\x89\x18\xb1\xea\t\xfd\x1d\xf3\x0fo+\xfd\x1aa\x88\xb30\xe3\xc1J\xa8lZb\xf5\x98\x1c\xc3\xe1\xff\x00\u007f\xf4\xae\x06E\xf8\xc9\b\x1e\xa3C\xf9{\xbd\xf1b\\PO%\x0f\xef\x13oQ\xd4\xd3~\xa3\x8b+\x97\x86l\x8aqCw\xa20u\x03CW!\xb3c\xbc2P@He\xba+\f5\xd0H\xa2\x14φ\xe3?\xb9s\x9f\xe4\xee~$\xe8\xa9\x13b\xab_\xf8\xa6\x8b\x06Õ\xac\x03\xd9^\uf330z\xc6\f\xa4&\xc8P\x9f\xe9\n\xa7?٩g/\x15M\xe3\xb0e\xd7c|\xa6\xe9A\v0\x06\xb2\xf0143\xfd\xa7wj\x1bodB\xb6\xdf1\xc6ٻ\fb\x17\u007fq{\xf6Q\xea\xcc\xfb\x9e,\xf5C6\xf0W\x9b0hВ@ep\x8cb\x82A\x03\x8e\xc9\xef\xf9\x97)\xfd\xd86{/\xbe\x84\xb42\x82\x11\xeeԗ2|V!\xe5\xfb\xc640\x91\x93{\xf1r\xa3>\xf7\xebk;\xd1w\xa0\xcb}\x1d\x8d\xe1\x0e\x84\aU\x9a\xee\xb1\x05\x0e,Q\xbfD~\xc7\x02(\xbcM\x1aPa\xaeW\x83\x92\x8c\xb0\x0e\x16\xe3㾼\xf1\xd6`{\xbcY\x1fz\b\x12b\x8d\n\xaf\xbb2b\x8d\xa8\xdf(\x90 |\x9f\xe2\x1f};,\xbf\x04z\xc7f\x92\x87s\xec\xeeE?\xa7\xb0\x05\xc5\xca\xe8\xb9\xd0y\xa0nx]\x18\xfbΒ\xc3\x16\xe0\x93\xae(ϔva\xfd;\x12\xa4<\xb7I\xe6\xe4\xfe\xe4\xef\xf7\xa9\x88\xd8\xc4Î=\x82\xb0Qs\xafq\xaamqM\x9b\x11ir \xd8\u007f\u05ec\x9d~@#\xcfT!F\xef\xc8]\xa6\xbe-bj\xa3\xb1\x0f\x8a\x1bW\xec\x86\nx\x81d\xc2ǽr\xb9-Ndn0ODd\xf8\xa7\x86\xcc`\x82\r\x1d\xd4\t#d*\xaatҜ\xfc\x99j\xffi\x19\xf1%\xf9\xfcl\x9c\xa2\\x\xe8sR\xe3\x97#\x11\xa7\xd7-4\xf8\x80L\r4^n\x91L\xe5ی\xf5?\x1f\x9b)\xc6\x1f\xec\xf8#b\xc2\xf4\x02\xf5}'\xe1ouz\x13YB\xba3\x1c\x1c\xb5x\xefj\xf5F\xc36\xdeްIH\xfd\x1b\x00\x00\xff\xff\xbc\xbdΙ\b\a\x00\x00",
- },
-
- "/data/en/currency_codes": {
- local: "data/en/currency_codes",
- size: 519,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff$\x91Kz\x80 \f\x84\xf7s+0\xa0\xc8C\x1a\xb0E\xef\u007f\x90\x0e\xb8\x98/Bb\x92\xf9q\xb7\xe2n\x82\xddVlF`n\xc1Y\x1f\x84\xa2(\xaf`;<^\xa3\x98u\xc6\x17\x98\x94 \xbc\x9f\xff\x18m\xab\xde\xf4\x06˳=(鰖\xd1y\xd8̨\tv/\xab\xf7\xb8<\x86\xf1\xd8\x12g\x95\xe7\xd3U1*\xeftá\x11\xdb\xc3\xdc\x1b!\x91r\x19\xc2|I;\xc6&p{\x85sq\xed\xe2O\x81\x0f\x19^\xfd\xaa\x1b\xe6Ʈ\xb2j\x8f(8n\x8f\xd0\"\x86\xe8\xf2\x12fT\xeaG\x10\\EH\r\xa1'\x9c\xf9\xf3{^\x82\xe8\x1a\xa2\xfe!\xfe\t\x12y$\xf6ȏ\"\xb3.sf\x1e\x05\xd9|3&\x9brE\\YQ\xa3҃\xa0\xba\x82zL?\x1d5\xf1\xbb;\xfc\x90\x9d^\x85J\xd0ۢ\xf1<̎\xb6\v\x1a=\xb6\xd0\x17\xdf9\u05f5\xba\xf6M\xecׄ5\xf4:\xf9w\xee\xd3\x0f\x8b\xde\x19\v\xa5\x0f\x8c\xfb\xdel\xbeï\xb3\x94\xc7/so\xfe\xf8L\u038b7\xd9.v\xf3Ntq\x9a\xf3W\xe4\x9eso\xe6\xfe\x03\x00\x00\xff\xff\xf7O\x92\xa7\a\x02\x00\x00",
- },
-
- "/data/en/domain_zones": {
- local: "data/en/domain_zones",
- size: 753,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\f\xcbA\xb6\xa5 \f\x00\xd1y\xed2 F\x84 \x8f\x80\xb6\xae\xbe\xff\xf4\x9e*\x89Ȇ$dG\x14\xc9HE\fiȅ\xfc\x90\x8182\x91\x85<\xc8?\xe4#\b!\x106B\"\xec\x04%\x1c\x84L8\t\x95`\x84F\xb8\b\x83\xe0\x84I\xb8\t\x0f\xe1%|D!F\xe2F܉J<\x88\x99X\x88\x95h\xc4F\xbc\x88\x83\xb8\x887\xf1\x1f\xf1%~l\x89\xedd+l\xc6v\xb1}\xa4HJ$%\x1d\xa4Ar\xd2$-\xf6\xcc~\xb2\x17vc\xbf\xd8\a*h@74\xa1;\xaa\xe8\x81f\xb4\xa2\x866\xb4\xa3?\xf4\xaftt\xa2\v}З\xa3p\x18G\xe3\x18\x1c\x93c\x917r\"W\xb2\x91\x1b\xf9\"\xffȃ\xec\xe4ə8\x8d\xf3\xe2\xec\x94DQ\xcaA\xc9\x14\xa34\xca\x1f\x0e\xcaCy)\x1fU\xa8\x81\x1a\xa9\x99Z\xa8\x83\xea\xd4I]ԛ\xfab\x82El\xc3\x12\xa6\u0601\x15\xacb\x865\xec\xc2:\xf6\xc3\x06\xe6\xd8\xc4\x16vc\x0f\xf6\x0f\xfb\xdb?\x9a\xd0\"-\xd1v\x9a\xd22\xad\xd2.Z\xa7\rڢ}\\F\x17z\xa2\xeft\xa5\x1f\xf4B\xaf\xf4?o\xf4Aw\xfa\xa4?\xf4\x97\x9f0\x12\xe3b8c1\x1e\\\xf0\x80G|\xc3\x13\xae\xf8\x81g\xfc\xc4\v^q\xc3\x1b~\xe1\x03\x9f\xf8\xc2o\xfc\xc5?fdn̝\xa9̃y2\v\xb32\x8d٘\x17\xb33\as2o\xe6\xc3\xfcX\xc2RVa\x19\xcbY/\xeb\xe3\x16\xeeȝ\xb8\x95;s7\xeeų\xf38o❼\x8bO\xf8\x8c\xef\xe1\u007f\x00\x00\x00\xff\xff\x88\xcdet\xf1\x02\x00\x00",
- },
-
- "/data/en/female_first_names": {
- local: "data/en/female_first_names",
- size: 686,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\xb7Y\xe8\xa2\x18\xa1ST\xd4\xfd\x16\x81y\x97}\x9c\x9ebR<\x0e\xac\xa4\xaf1{\xaco\x9f\xe24\xbd\xb0s\x89\xb5\x88X\xe2b\xb2\xec\x82\x0f\x92>\xa3{*\xc1\xed\xf7ۢ\x88\xf0\x91\xcb.\xc6Y\xae\b\xb1\xd1M\xe7\x1c\x9dri\xffU\x1f\xae\x1b=\xc3A\xdd\xc9\xe7\xbfl\x93\x02\xff\xe4\x15q}Cr\x871\x1a\xa0\x89\x1e\xecg\xd9\xfd\xba\xb4\x13n(\xc7\"\xc3\xe7\x907\x87\xfa\xb1ܴ\x03\xe7\xdf\x1b\x8e\x80\xf2\xc7\x1eb\x87s\xeb\xe1\x1dg\xd8&\xfc$\x19\x86\x9f.\xe7\x1eZĽ\xe8\x96m\xc5\x17o8\x84\a\xb6\xef\x02hP\xb4a\xf6m\x057LN\x9a\xfe\x06\x00\x00\xff\xff\xff\u0091\b\xae\x02\x00\x00",
- },
-
- "/data/en/female_last_names": {
- local: "data/en/female_last_names",
- size: 1764,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffDU\xddr\xe2:\x13\xbc\xd7[\x05\xb2@%\x90P\x86\xfa\xa8\xefr\xb0'X\x85-qF\x12\x8ey\xfa\xd3-\xb297\x9b\xb5\xfe\xa6\xa7\xbb\xa79\x8c>\xf7\xee-\xf6!\xc5\xe0N~\x18\xbc\x8c\t\vA\x93[X\x9c\x82{\x95\xbbOn\x87-5\x9e\xe0\xc1]\x8c\xa6\xee(\xf3\x10ͽ\x84N\x8d\xab\xc7>\x8e\x82\xcb\xd2^\xebk\xbd\xcf\xea6b\xc6\xfbb\xd9?\x8fܸ\xb9\x16k\xbd\xfc,\xeb\xc35\xf1\xec+\x86\xe5 v\xc5gg\xfeR\xb0\xb1\xd5\t\u05f7\xaa\xee$\xc3\x15\x1062\f\xee\x05h\x82\xfb\u007f,\xe1\xe26jA\x80\xe1\xe1\xde=>O\xb8\xd8g\xb7\x8d7\xacl\x00\xdb\x1dژ\xb3[\x9b\xe2\xcaK\xc7\xfe\x16\u0097\xd61d\xc5Bv\a\tx\xf4\x01\xe6*\x1dM\xbc\x803רv8\x1a\xaf\\\xbfHp\v>\xb8+v\xebg\x80\xf4\x83ή\xf1w5\xe1\xa9\x1b\xaa4\xbe\xedY\x80p\xe3\xb7\xdbD\x96\x035\xf8爧\xa1\xda^\xf3S\x8e\xb5\tn\xcb\xe8\xd9ś\x8c\xd8;I\xe6\x0e\x84\x8d\xd7\xe4\xdeQl&2\xea\xe7\xf6\xe6[\x05\x80\x10\x14l\x9db\xec\x80\xc0\xe8\x83&\xa6\x04\x96\xffʌ\xd6t\x04\xd67\rW\xb6\b\x9alv\xfb8\x11\xfb6B\x82\xbd\xe4\x1f\f\x9br\xe9\xf1\xc2\n>\xa9\xe5S\x0f\x892!\x94L?\x1d\xfc8F\xbc\xb1\x8a)\xff\xa7\b\xad7KȐY\xbf+<ה\x94\xf8\xfe\xda\xfc\xd7\x17\x8c\xf4\xea\x05\xeaʌ\xb3\xbb\x99\xf0W\x11\x14l\xd0퐟\xbd\xf72\xbaC\x81\nЅ\xde\x19\x04\xed\xb1\xad*\x0e\xfe\xab)\xc3\xe8\xd6a\xfbs\xd2@5\xe6\x10\a\xec\xaf|\xea\xa9(.\xa7\x1f\x03\xf3M\u007f\xae\xdeo\xbb\x18d\x80nV\x1e4p\xea\xe9\xc8O\x18\xf9\x81\x06F\x8a\\\x8cܯ\xe08\x12u\x02p4\xaf\xe73\xfb\xad\xf6\x87-\xee,y,-\xbd\xb3\x8f\xd5y\x9b\x12\xea\x1f\x8f\x01\xc2\xf32}զ4\x80\xdfE\x9c;T{N\x9fU\x92ީU7S}SR\xf2\x8dM\b\x1ek+d\x11\x96M\xc0d\x1dK\xf62\xc1/\x03}\xd0P\xea\x1fcW\x95\xc0\xf5\x02\x04]1\xed\xc1c\x1a !\x0eZ\x1d\xfb\xe4>`\xba\x88\xbf`\x15\a\xdfC\x1d\xb0\x95ڥ\xf06\xec\xa1h\b\x91\x01\xae\xa6j\x89\xd7\x12\x02}Q?6\xa5\xda\xf5p\xd3\xd0Rcx\x95\x83\x04\nn=9\xd8ˌ\xab{\xafV\xfdG3\xed`\xa0^\xa7\xe4^\x8c\x8a\xa0\xc3Kx\xa6\x0f\x15i\x84=\xe7\xfa\xf8\xe7\xdf\xc95\f\x1c\xeb\xb6 \xfc\x10\xe6\xae&\x05\x06o\t(\xf0\x1cݰ0\xe98Q[A=\xa4\x96\xb1BS<\x8dd\x1c\xae\x15&\xaa\xa9C\xf7bc\xcaF//\xb9Ue9\xa9܉\x9f9\xa2xd26T]\xc2|Y\xf6\xd8~Pa\xc0.\x89i\xf7\x1c\xc5:gJ;H\xb8\"\x14x\x95\xa0W \x1af[\x97\x8c\xd6k\xd2\xcc\xc4\xde\xf6\xa3\xefrm\xc9\xfdO\xd2?\f\xc1\xa5\xe0\xbda\x88\xc8TU\xce\r\x8a\xddh\xadρ\xe9\x00G\x84|\x81\xf5l\xfe\r\x88\xdf0G\xa5\x9a\xefu\xea\x80\x00\x03\x03s\x98[\xc0\xe4\xf1\x06;\xb7qf\x8eh\x8dջ\xd8oJ\xd1\x19\xc84Xk\xf5\x1b\xb1P\xef!\xe4\xebN\"}\xc6\x14\xd3f\xb9zZ\x02\xfb\xfc\xb8\x94\x19w֊HS\xfe\x1a\xc43\r\xe9;\xe4\xf3\xe8V\xa5\xfe\x90lg\xe4\xa1{U\xe1\\\r4\"\x9f6FO\xc3F\"\xa7\x06'\xb6Rs\x04\xdc=\xf2\xdbE\xefB\xffa\x03֮>[\xa5\xb5\xe8\x1f\x9e\xe1\xb2\xf6\x82okP\x8fhi5ba\x87^ȇ\xcb\b\x92\xaa\xf8\n\xbf\xfa[8\x1d\xad\x80\x10\xb82WZ\x81\t\x99\xa1\xadt\xb0\xbe\x88]\x99\x04\x92\x06f\xb8\xaa,\x8b\xa4Dk\xbb\xdd*\xfd\x1f\xefټ-\xb5\xe5߹ʒ\xe9\x14Z\xda']m\x1c\xe1\x8by\xda8\xc7\t\xd8`\xbd\x04~+m\x12\xff2\\\x04gM\x01A\u007f3\xfd\xe5aջV\xe4\x10\xe7\x16J\xb3i4\xfa\x1b\x00\x00\xff\xffa\x8c\xf8f\x9a\x02\x00\x00",
- },
-
- "/data/en/genders": {
- local: "data/en/genders",
- size: 11,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\xf2M\xccI\xe5rK\xcd\x05R\x80\x00\x00\x00\xff\xff\x92'H2\v\x00\x00\x00",
- },
-
- "/data/en/industries": {
- local: "data/en/industries",
- size: 4922,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xfftX\xcdV\xe3<\x12\xdd\xfb)\xbcb՜\xef\x19 \x01\x9a9\t\xe4\xc4\x19X+v\xc5\xd1`[\x1eY\x0e\x9dy\xfa\xb9%Y?\x0e\xeeM7\xae\x92JUW\xf5s\x95G1\xc82\xdf\nCZ\x8af\xc8\x1ej-˱1\xa3\x16M\xbe:S+K+n\xc6Vvc\x9b\x05Q~\x8f]\xffQ:_\xcb\v\xe9A\x9e$U\xd9J\xf5=\xe9\xecE5U\xf6\xdaU\xd4\x13\xfe\xe9L\xfe.\x9b\xfc.\u007f\x11\x03K\xc7\xc1\xf0Y\xf9\x96\f۹˷\xb2#ͧ8\x83\xaf\x9d\xa1Zã*\xd9\xf7\xa6\xba\x96\xd77\xec\xad[\xcf\xffˮ\xce¢|\xad%\x16t5>\x9f\xfe\xf4\x8d\x82\x11\xa9\xbad\xc1\xd3\u007fGٷ\xec\xd1]^\x90\xbeȒ\x86D\xbd\x93=a\xffL\xb6\xa7\x93=\x86\xfd\x14\xfa\x8b\f\x1fY\xc8\x06AgEO%\"1\xd7\x04\xa9\xc2\x10\xf1\xdeW\x8d\x93\x8bkg\xce\xd8R\x0e\x80\xa6\xab\x1b\xd5\x12\a\xb6\xf05\x8c\xf8\xc8_\x94\xaa\x00v\xdf7Rt\xec\xdb\xc3h\x14\xce\xedƓ(q'\x00\xda\xe3\xeeT;\xa1͐=\x12\xbc\x115\xb1\xf2Q\xd37\x96\xcdd\x85:\x19\x06\xa7\xfb\x9a\xcb?\x19HI|\ak9\x18\x80gw\x8e\x03c\x90\xa0\x95\xadd-4\x19\xebkC\xc2\xe2\xb1Ӫ\x1aKc\xbd?Q\xc9H\xf3\ued50\xfa\x1a\x95O\rT\x80\x02\xd7\x16\xcd=\v\xdd\xc6%\xcf\bz1\x9b~\x03\xa0\xfcyԝ\x1c\xce8\x91\xdd|\x96\u007f\x18\x86\x01\xbaq\xa0o8\xc5҇\x12X\r\x8aCɶ$L\xb4\xfd~:\xe1\x8e\xf3bdH\xa1݉\xf2K\xd4\xee:\xe1\xb7\x11\xd2:\xbd\x13H[\x88\xdc\xffa\xf7\x0e:\xd5!Ӣ䬌Br\xf6\xe74 Φp\x82V\xec\f\x92\x97\xcd\xf1i\xf8\xd3\xdd\xeb\x9eJM6%aҊ~\xe5\xef\xc8\x0f=\xd7|\x10\x8c70\xb5\x1f\x8fG\xe7V#\x06\x9bDE\xaf4'\xe0d\xf0@\u007fpi\x04\xf0\x902\xc0\x02\x15\xdb(\xc3X-\xa8\x00\xb3\xf9&\xa1o\xf0:\xa8\xa3(K\x15B\xf4.\x1d\xd4u\xb0%\xd0\xf2\"=\x96_\xfciu\xd1\xc3g\xd9!OQ\x02\x19L\xca\xcaA\xf1\x9bP\x12g\x94\xf1\x80&\x82,\xce\x1e\x00\x87\xe1,\x06\x16.\x9d\x1a\x05\x80\ue7fa\n\xd7\xdb\xf1\xe5\xaf\xe9\xb8$f\x84\xcduA\xf1\xac4ɺ\xcbV\x9a*ib-'\xe9\x03\a.4\x18>\x90s̮ϷHRT+d\b\xe3QpAx՞j\x87\xbf\x13\a\xf7QQꋓ$ڛD\b\a\xae\xbcM\xf7\xf67\xbd\xb7\x9bm\xe4\x89\x12T\x16\\\xd9\xe2vk\xde\x15Mq>!'\xd1b\x90\xb0b\x18m\xb7\x89F\x826Aw\xff\xf4z`H\x93J\x9aD\xeefJ\xa4C\xfe,J\xd9H\xc3\x19\xe0\x95\xcaP\xf3ϖ\xff\xf5\xa2ج\xbd\xc4Փ\xff\xda\xd3`/=Y\xb0G\x93\x96\xf8\xc2I\xf9\xd3`\xd0\xdep\xb7\x17j\x94\xab\xfc\x002\xea]V\xf7\x0f\xa6\x11\xd8^N\xf1ϵ߀\xe0\xa7\xe2\r\x18\x9dI,\xa9Pn\bw\xc1X\xa1ƿ\xed\xb1\xaa\xe4\xa4B\\\xa6V\xb3Q\xa2\xc37\xba\x8d\x05\xff M\x93^_\xc42{\x94\x00\xad\x9a\x88!\x18z\xc9\xc37\xdb`\x0e\xdd\x1f\b\xedxu\x93\x15[\x14\x16\x06Z\x1e\x87\x11O\xd5\xd0½\x1a\x80\x18=\xda\"K\xbb\xa0Wođ\xa7\xb0\x9a\xa6\f\x12\x06\x1d\xa8<\a\xfdN#J\xe9g\xc74O\xe5\xff\x10\xdf\xe4o\xa8\xec\x848LS\x924\xc2\x10%\xfd\xb3\xa6\x13u\x03-ΐ\x9f\xab\xa8,\x17\x8cK\xc1>l\n \xa7.\xae-\xf9\x9a\x9a\x19\xc9^\x98t\xe9\x10\xc4\rq\x9c\x89_\xdb^\xab\v\xa5`,\x16Xt\xe2_ \xd4M4\xbeQUmk\xc5\xf6\x1a$\x9d{1\xc4썐\x84\aC\"\x9a\x1a\xdf\xd2A[u\x91\x94\xd4\xef\xaf\xfc\x80\xa9ŷ\x9bmGN\xc0\xbb\xfc\x03զ\xbc'\x81\x9e\x06\xeb\xbb\xf1\xd8L1\xe3%\xa0\xd4\u05cd荾\xd1\f{KyS9,IU\xb9\a\xcc\x1eI\xc6\xf9\x9b\x8c\xc9\x10\xe4\x1e\x0e\v~\xddl0Mgq\xf9\xce>\x93(m\xdb\xec\x8a\xd7*+1\x82\xc7'ZVA娥\x9d\xac\bظ\xf7C\xdc\\\xa0:{\xfb\xd2\nO\xac'[94$\"G6|\xad\ar\x9c\xa4˜0{\xe0\n#\xc0c\xec#\xe0}4\x83\x1au9\v\xe6\xc0\xd3\xdc^S\x14)v\xf5\xb7:\x1eC\"XR\xcc>\x86\x1b\f\xdc9\xb2\x01;>\xa7\xaa\xe1gط%\f\xa1\xe0'\xc9l\x16\xa9\xb6\x1d;\xbf'y\x83M\xa5\x0e\xa2¯\x8b\xd0\x1d\xbc\x98\xef\xb0?\xbb\x87\xf4\x1a-ú\xc9d\x12\xfc\xeb\a7\x9e\x1f\xb2H\x9f\x83a\u007fR\xaaL*;aB\xe8\xe9'\xa5\xdb\x1b\xa3\xa9\xf0.v\xf0E}D.\xd5Ë\x0e/\x88t!\x92\xe6\x82ZЉzڰ\xa8Z\xc0\x99\xa9\x8f}\xf6Z\x92\x0f\xfa\x83䲕\xd6\x18٢J\x05\xbf~\xdcK/^T\xf6F\xe6[\xe9/\xff\x82LQ\xf48\x87\xb2\f\xcd\x194]vL\xdaVR\x97xѠ4\x85\xae\xc2[\xd1\xe6\x9e\x03ٕ\x83#v\x05\xa6\x1e&\xeb\xc9\x16~LɄq\xc5*Z\n\xb0\xe0\x9f$T\xc7\xc6Ш\xf8\x97\x01Tu\xbeA\xe6\xfdP%?\xb9L.\xfeܞ\x90\xb3\x1b]\xcaJ\"\xfb\x99\xad\x015\xa3Vi\xfe\xa1\x84\xc7n\x8c\xe6n\x8a<\"| \xe4\x96jC\x1c\x80OBh\xaf\x1c;hmZ\xa9\xb8ӦJ\xd8\xf1\v\x84w\xf2\x06+\xf2\x06\xb3\x01\v\xcaq\x82\xd9\x1f\xff\xbd\xfe\x9fl\x1c\xcd\xe5Y\xaa\x9e=Y+miq\x9e\x9b{\xf5\xd4NR\xa1\xc1\x84\xaf콶\xd6K\xd7I\x01\x98\x94\xe2\xa3\xee\xd9A\x1a\xe1\xa5c\xcf`e\xaf\xd8\xc4\x15\xef\xa3\xf5n\x1d\xab\x8d\xee\r\x9f&\x82\xd6Ͼ$\xa7\x8c@+9\xabG\xae\xd4\x06\xc7\xf0\x0e\xac\xd5\v\xa6\x85\xe4\x0eJ\xcc;=aVZ\xb1f\x06\xb4\x8e\x18\x16\x92\xfeKjK\xa4X'\x11W\x11\xf4m\x0f\xeeϒ\x90\x98f4[\xa9\xf0ˬA\b&\x8b5\xdd`\xd4\xf3\x84\xfc&\xcf\xea0\xc0$\x05\x1f\xd9Q\xf5\xe8\x8d\xd9\x1e\x06\t]\xaa?\xa3\xf2&K\xa7\x119\xa4\xb0\x9chu\xd0\xd3\xe4\x95twv\xf1\xce\x00\x17\xc3\xce:\x83\xb2\xa1\xbc\xf5v\x04\xbd\x03\xb3\xa6\xb8)\xe0\x805\xb3\xdc\xfe\xea\x99;\xbe\x11\x12\x01\x1f\xdcb\x8bsO\xb5\t\xc1Ϥ\xa2\x91\x9d\xef\xbd\x042U\xfb\x8a\xf0\xfc\xe9\xf4\xcc\x1a?\xcf\xda8v\x051\xa8\x85\xdd*\x12\x05\xe9SҀ\xa0\x0f\xeb\x8e5|\x04[\x1d[I\xf7\x1fG\xc4͖\xbe\xf4'\x84\x1e\xd5M\x1a\xad\xa6\x90LA\xc7\xd6@wW\xeb8\xb0\x06\x84\x01GR\xfe\x86\x95*\x8a\xc1\x12o\x92DR \x91\xc4oZ\xb7l\xe9#\x1eNߛT\t\xb9\x181H\x87IV'@%\"\x92\xb4z\x02\x8drߦ\x1e\xb1D\xff\xc9\xf0y\x90\"J\x01\xedg\xe0\xa3\x1b\xb0\x03\xd4\xda\xc5\xe5\f\xe3L\xf6OvA\xb6\x96\x9ed\xa8 \xf4\xecq\x90p\xba\xad\xf6F\x80ݏ\xe4ޜ\x92\xfc\xae:m\xd2DD\x85d\x1b\xeaFQ\x8d>4\xe3o\xd4\x1e\xf6(/\x95\x1fГ9]U\xfd\x90\x1f\x86\x1bJ煛O\xd8n\x90\x02K7\xbc`\xfe<\xaa<^\xbeR\x15\x06\xda3\xb4\xd2[s\xec\"\x15\x86\xff\xeea\x92۟\u07ba\xe5o9\x1b\xf5\xc0\x91:A\x9f\xac\x87\xbb]\xca\b\xb7܋\xaaq\xf9\xb4^\xb8\x9cn\xdeFyՅ\x14\x8a\xf3fJ\x11\xff\x89\n[i\xfbǣ\xc2q\t\x1c\xb4rFoD\x9fL\xebmo(tܶ\xf9_\xc9\xff\x1b\x90\x16\xc1@\xcb\x02\x89(\x10$\x18\xb5\xb7#\xa7\xc4\xc3R\xcdP\x88lx\axoVd\b\\\x86\xb9\x88\n\xe7\xed#T5\xb0\xe8j\xbf\x8c\"\xbc\xae\x8a\x04\xc4\xd5\x10O\x8f\xd3\x1a\r\x0fTD\xfc!%\xbdD\xbfkT':\xe9\xce\xfd\xe2\x06\x88\\\xebǐH¶\x9bg\x85\xaf`\xdd\xde6\x032\xc1j\xee\x868\xf1U\xe3xױ\xfd[\x1b\xd0F\xe0\nu\xd1k\xf7\x065Π~\xbcY+\x94Ŕ\x14ƌ\xa5M\xff\xb8\xb2\xaf\xfc\xabd\xf8JO\bF\xe4u\xf6n\x16\xad\xfc[\xb3\xfc\xe6\xd1i\x9d]:$I\a\x19\xd1\\\x10\xbaS%Aa\x95\xbf\xc3Ǻ\xe1B\x1a\x01ټ\x00\xbf\x03\x00\x00\xff\xff\xb11\x04X\xc6\b\x00\x00",
- },
-
- "/data/en/jobs_suffixes": {
- local: "data/en/jobs_suffixes",
- size: 12,
- compressed: "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xf2\xe4\xf2\x04\x21\x4f\x2e\xcf\x30\x2e\x40\x00\x00\x00\xff\xff\xa5\x82\x0b\x05\x0c\x00\x00\x00",
- },
-
- "/data/en/languages": {
- local: "data/en/languages",
- size: 821,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff,RQv\x1a;\f\xfd\xd7*f+@\x12\xc8\x03\xf2h\u171e\xe6O0\xaa-\xb0e\x8el\x87\xc2_\x17\xd4U\xb4\v\xab\xec\xc9nj\xaeeIֽ\xd2\xec\x87\xf2\x05Q2\xcc\xc2\x11\x85Q`\x16=*\x9f`\xa6x\xec&\xd2\xe4\xcf\x19#e\x82\xd9=\xa2\"\xcc\x1e\xa4\fs\n\xa85\xb7\x809\x89\xc3`.\xce\x01#\xc2<\xe5\x9e8\xaf\xc1YŎ\xb4WX`\xc1`\xe7\x85g\xe9gMXZ\xc0\xe2A'\x0fO\xd6Hn\xc6\xea?y\xfe o\xb6\x96v\xf3H\xe2.\x1e\xe1Y\\h1Ϲ\xa4\xfe\xc8\v\x9f'\x13\xf8ʒ\fH/\xf2\xa2$\x96\xf8\x8dr\x19^\x94{\xa3KtX\x1f\xb0\xa4\xa4\xae\x9fIc3Jt\x81e5r\xf2緁\xb3\xa1°Bn\xcd\r\v\xa5\x14\bVtT\xba\xc1\x8ae\xb4;V\x1e\xb6\xa9TXU\xf9d\xf9z2M\xec\xf2\x04\xaf2\u061d\xf6\xb6\x1f\x96H\xa1\xf9\x8d~s\xfe\x87W\xec\x02\xacQ\x04G4\x9b}\xb4\x92\x06\x1ex\xf1\xb0\xf6\x91\x14\xd6Iɢ\xd7U\xc7Fi}Ww\u007f\xc0\x06\x93}\xe5\xa3\x15\xdap\xf1u\x1aߦ\xfe\xa4xLըY\xec\x16O4N\nmMr\x87\xf9\xde\xc1\xe7\u07fe\xd8PiMl\xff\xfeJ\xf6\xf4\xb6\xb16ŷ)\x8c\xe9\xa3%\x9a\xe6\xa9\xf7k\xa8\x90\x90S\x16x\x1b\xe9H&\xc7\x1b]\xdb\xd0\xdf\xe86\xbcS\x9b\xea8\xec\xd9ɰAq\x15\x9d\x05$-\x9eT\x86}*>\xb5㍺\xec\xff+\xdf\x11vxe\xdb+)\xc9`\xf6͐v\xc9v\xa9\x8fxg\xf9\xd5\xd5\xd6\xe1\xae\xcaٖ\x12\xbeT[\x93\x8a\xf05ʼn\xf4ހ51\xbd\xb0\xbfN\xfb\xb3\xbf\xa1\xe7潵)\xeeo\xd4\xd5;\xe0\x99/\xf6\x8f\x1c\xe0@\xc1*\x9b)5\xc2\xc1#\xc3!]\x86\x9dm\x89\xc0!\x1bm4sCA\xf8\xcec\xcf~\xaf\xa1¿\x00\x00\x00\xff\xffq\xe9\xea75\x03\x00\x00",
- },
-
- "/data/en/male_first_names": {
- local: "data/en/male_first_names",
- size: 665,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff4\x92͎*;\f\x84\xf7~+\xfe\x06\xd4\xc3\\!@wֆ\xf6trH\xdbȝ\x80\xf2\xf6\xa7\x92\xd1\xd9 \x91vU\xea+g\xe0Y\x16\x1a,(\x9d\xed&\x9e\xe9+\xde\x03K\xa2\xef\x98R䙶\xfc\x8a#\x9d۩\x8f\xb4\xc1o\xea\x8aE\x9e\x81\xae\xc1f^p\xeaq\xc9\xf6\f\xe2\x98\xd7\b\xf9\x89K\xa2/\xf6\amM9\x8d\xb4\x17\xf3I\xe8ST%\a\xbady\x89\xd2n|7۵Gn\t\xfa\xe4Js0\xad\x18}E\xa5\x81\x17S8\xe5\x1c\xe4M{\xf6J\xd78[\x0e\xb5\x87\xa0#;\x8e\x06\xf9\xf9q\xa9\xf4\xe1\xac\x0f\xba\xdc-g\xday\xbc\xb7{\x10Ka::\xf4g\xae\xb3)ҸL\xe6\xdd\"\x14\x86\xbc\x99l\x91-.\xf4\xcd)\x03\xe4\xc4\x19\x06\x0f:I\xfbw`7d\xdbZ\x99\x12\x88\x0f\xa2\x10lP\x06\xad<\x87\xe2t\xae\x9d`\xc2\xec`BC\xe1\x96\x1d\xfaU\xea\xbd\x0e\x80ˡ\x1d\x96%\x83\xebگ܋7\xe4O\x89\xad\x13\x9e˿\xe6\x05Q\x13\x1a>\xf2\xdbE\xefB\xffa\x03֮>[\xa5\xb5\xe8\x1f\x9e\xe1\xb2\xf6\x82okP\x8fhi5ba\x87^ȇ\xcb\b\x92\xaa\xf8\n\xbf\xfa[8\x1d\xad\x80\x10\xb82WZ\x81\t\x99\xa1\xadt\xb0\xbe\x88]\x99\x04\x92\x06f\xb8\xaa,\x8b\xa4Dk\xbb\xdd*\xfd\x1f\xefټ-\xb5\xe5߹ʒ\xe9\x14Z\xda']m\x1c\xe1\x8by\xda8\xc7\t\xd8`\xbd\x04~+m\x12\xff2\\\x04gM\x01A\u007f3\xfd\xe5aջV\xe4\x10\xe7\x16J\xb3i\xb4\xbf\x01\x00\x00\xff\xff\xf6\xdb\xdd\xf1\x99\x02\x00\x00",
- },
-
- "/data/en/male_last_names": {
- local: "data/en/male_last_names",
- size: 1764,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffDU\xddr\xe2:\x13\xbc\xd7[\x05\xb2@%\x90P\x86\xfa\xa8\xefr\xb0'X\x85-qF\x12\x8ey\xfa\xd3-\xb297\x9b\xb5\xfe\xa6\xa7\xbb\xa79\x8c>\xf7\xee-\xf6!\xc5\xe0N~\x18\xbc\x8c\t\vA\x93[X\x9c\x82{\x95\xbbOn\x87-5\x9e\xe0\xc1]\x8c\xa6\xee(\xf3\x10ͽ\x84N\x8d\xab\xc7>\x8e\x82\xcb\xd2^\xebk\xbd\xcf\xea6b\xc6\xfbb\xd9?\x8fܸ\xb9\x16k\xbd\xfc,\xeb\xc35\xf1\xec+\x86\xe5 v\xc5gg\xfeR\xb0\xb1\xd5\t\u05f7\xaa\xee$\xc3\x15\x1062\f\xee\x05h\x82\xfb\u007f,\xe1\xe26jA\x80\xe1\xe1\xde=>O\xb8\xd8g\xb7\x8d7\xacl\x00\xdb\x1dژ\xb3[\x9b\xe2\xcaK\xc7\xfe\x16\u0097\xd61d\xc5Bv\a\tx\xf4\x01\xe6*\x1dM\xbc\x803רv8\x1a\xaf\\\xbfHp\v>\xb8+v\xebg\x80\xf4\x83ή\xf1w5\xe1\xa9\x1b\xaa4\xbe\xedY\x80p\xe3\xb7\xdbD\x96\x035\xf8爧\xa1\xda^\xf3S\x8e\xb5\tn\xcb\xe8\xd9ś\x8c\xd8;I\xe6\x0e\x84\x8d\xd7\xe4\xdeQl&2\xea\xe7\xf6\xe6[\x05\x80\x10\x14l\x9db\xec\x80\xc0\xe8\x83&\xa6\x04\x96\xffʌ\xd6t\x04\xd67\rW\xb6\b\x9alv\xfb8\x11\xfb6B\x82\xbd\xe4\x1f\f\x9br\xe9\xf1\xc2\n>\xa9\xe5S\x0f\x892!\x94L?\x1d\xfc8F\xbc\xb1\x8a)\xff\xa7\b\xad7KȐY\xbf+<ה\x94\xf8\xfe\xda\xfc\xd7\x17\x8c\xf4\xea\x05\xeaʌ\xb3\xbb\x99\xf0W\x11\x14l\xd0퐟\xbd\xf72\xbaC\x81\nЅ\xde\x19\x04\xed\xb1\xad*\x0e\xfe\xab)\xc3\xe8\xd6a\xfbs\xd2@5\xe6\x10\a\xec\xaf|\xea\xa9(.\xa7\x1f\x03\xf3M\u007f\xae\xdeo\xbb\x18d\x80nV\x1e4p\xea\xe9\xc8O\x18\xf9\x81\x06F\x8a\\\x8cܯ\xe08\x12u\x02p4\xaf\xe73\xfb\xad\xf6\x87-\xee,y,-\xbd\xb3\x8f\xd5y\x9b\x12\xea\x1f\x8f\x01\xc2\xf32}զ4\x80\xdfE\x9c;T{N\x9fU\x92ީU7S}SR\xf2\x8dM\b\x1ek+d\x11\x96M\xc0d\x1dK\xf62\xc1/\x03}\xd0P\xea\x1fcW\x95\xc0\xf5\x02\x04]1\xed\xc1c\x1a !\x0eZ\x1d\xfb\xe4>`\xba\x88\xbf`\x15\a\xdfC\x1d\xb0\x95ڥ\xf06\xec\xa1h\b\x91\x01\xae\xa6j\x89\xd7\x12\x02}Q?6\xa5\xda\xf5p\xd3\xd0Rcx\x95\x83\x04\nn=9\xd8ˌ\xab{\xafV\xfdG3\xed`\xa0^\xa7\xe4^\x8c\x8a\xa0\xc3Kx\xa6\x0f\x15i\x84=\xe7\xfa\xf8\xe7\xdf\xc95\f\x1c\xeb\xb6 \xfc\x10\xe6\xae&\x05\x06o\t(\xf0\x1cݰ0\xe98Q[A=\xa4\x96\xb1BS<\x8dd\x1c\xae\x15&\xaa\xa9C\xf7bc\xcaF//\xb9Ue9\xa9܉\x9f9\xa2xd26T]\xc2|Y\xf6\xd8~Pa\xc0.\x89i\xf7\x1c\xc5:gJ;H\xb8\"\x14x\x95\xa0W \x1af[\x97\x8c\xd6k\xd2\xcc\xc4\xde\xf6\xa3\xefrm\xc9\xfdO\xd2?\f\xc1\xa5\xe0\xbda\x88\xc8TU\xce\r\x8a\xddh\xadρ\xe9\x00G\x84|\x81\xf5l\xfe\r\x88\xdf0G\xa5\x9a\xefu\xea\x80\x00\x03\x03s\x98[\xc0\xe4\xf1\x06;\xb7qf\x8eh\x8dջ\xd8oJ\xd1\x19\xc84Xk\xf5\x1b\xb1P\xef!\xe4\xebN\"}\xc6\x14\xd3f\xb9zZ\x02\xfb\xfc\xb8\x94\x19w֊HS\xfe\x1a\xc43\r\xe9;\xe4\xf3\xe8V\xa5\xfe\x90lg\xe4\xa1{U\xe1\\\r4\"\x9f6FO\xc3F\"\xa7\x06'\xb6Rs\x04\xdc=\xf2\xdbE\xefB\xffa\x03֮>[\xa5\xb5\xe8\x1f\x9e\xe1\xb2\xf6\x82okP\x8fhi5ba\x87^ȇ\xcb\b\x92\xaa\xf8\n\xbf\xfa[8\x1d\xad\x80\x10\xb82WZ\x81\t\x99\xa1\xadt\xb0\xbe\x88]\x99\x04\x92\x06f\xb8\xaa,\x8b\xa4Dk\xbb\xdd*\xfd\x1f\xefټ-\xb5\xe5߹ʒ\xe9\x14Z\xda']m\x1c\xe1\x8by\xda8\xc7\t\xd8`\xbd\x04~+m\x12\xff2\\\x04gM\x01A\u007f3\xfd\xe5aջV\xe4\x10\xe7\x16J\xb3i4\xfa\x1b\x00\x00\xff\xffa\x8c\xf8f\x9a\x02\x00\x00",
- },
-
- "/data/en/months": {
- local: "data/en/months",
- size: 86,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\xf2J\xcc+M,\xaa\xe4rKM*\x023|\x13\x8b\x923\xb8\x1c\v\x8a2s\x80\xecJ.\xafҼT \x91S\xc9\xe5X\x9a^Z\\\xc2\x15\x9cZP\x92\x9a\x9b\x94Z\xc4\xe5\x9f\\\x92\x0f\xa2\xfd\xf2\xcb \x02.\xa9\xc9\x10\x06 \x00\x00\xff\xff\xa4\x95F\xf2V\x00\x00\x00",
- },
-
- "/data/en/months_short": {
- local: "data/en/months_short",
- size: 48,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\xf2J\xcc\xe3rKM\xe2\xf2M,\xe2r,(\x02ҕ\\^\xa5y@\x9c\xc3\xe5X\x9a\xce\x15\x9cZ\xc0\xe5\x9f\\\xc2\xe5\x97_\xc6咚\xcc\x05\b\x00\x00\xff\xff\xc5\xed\xe490\x00\x00\x00",
- },
-
- "/data/en/nouns": {
- local: "data/en/nouns",
- size: 128,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff,\x8d\xc1\n\xc2@\f\x05\xef\xf9\xabZ\xf0\"^\xb4x_ڧ\x04w\x93%I\x15\xffެx\xca@\x867G\xae\x01\xa3Y[7\xb8\xab\xd1\xf5\xe3\x81F7\xc6;\x1fg\xdd%h.\x0e\x9a\xb6҇;\xb5^\xf9\xceI\a\xe3\xed\x81\xe6@\x96\xab\xbf\x02[\xa3b\xec\xef\x93\x0e\xde\xf2\x1b\x00\x00\xff\xff\x9e\xdfr&\xd7\x01\x00\x00",
- },
-
- "/data/en/street_suffixes": {
- local: "data/en/street_suffixes",
- size: 132,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\x1c\xc9\xc1\n\xc2@\f\x84\xe1\xfb\xbcU\xa9\a\x11\x0fE\v\x9e\xc3:H0d!\x9b\xad\xacOo\xeb\xe5\x1b\x86\u007f2\xe3\xc0\xb4\xd1;1ӓ\x81Y\xa3\xd8\xfej\x8f\xc4\x1c\xb55\xf5\x17N\xa1\x1bqV3\\\xba\x97\xd4긊\x13\x8b\xc4\xfb\xcfGƾ\xada1)<\xfc\n\x96\xaa\x9e\xb8Uy\xe2\x9eA&VF\x1c}\rQ\xc3C\xc6/\x00\x00\xff\xff\xb0\xa40\r\x84\x00\x00\x00",
- },
-
- "/data/en/streets": {
- local: "data/en/streets",
- size: 4162,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffDW\xc9b\xea:\x12\xdd\xfb+\xfc\v=\xf7\xf6\x86$p_\xe0\x86\x86\xbcd-\xec\xc2ֳ,\xd1\x1ap\xc8\xd7\xf79%\xd2oA\xd5\x11\x1ak.\xff%\xe5毾o\xfe\x16\xfb\xe6\xefyl\xfe\x81\xdf?\xf1\xfb\x17~\xff\xc6\xef\xc7I\xe2\xd0\xfc\xe8&\x89\xcd\x0f7\x84ـ\xcd\x01\xe4b\xbd4?f\x89\xb63\xfe\xff\xa0\xfd\x91\xb0i\x0e\xdc\xea{\x89)`Ώ\xc6e0of\x13'\x02{Ŕ\x897\xe0\xbd|2N\u007f\xe2vi~\xa2x!a\xf5j\xf3\x9f\xccT^\x03\x0e\xb9\xe1gXL\xf3\x9b\xd1l\f\xee9\xb85\xbf\x89\xb7\x10\x80\x9c\xff\x84ѷ\x1fP\x91\"]X\x90\x90^\f\xfd\x02\xeay1\x8c\xa4\x17\u9fd4\xa1\x06p\x163\x90\x91.\x02\xa8\xef|\x81\x03\xf4\x82c_`\x8c\x17L\xa6J\xb5V\x01%\x8a\xfdb/\x8e\xbayA\xaa\xe6U/1\\\xce\xcdִ\xcf\xd0\a\x82C\x80'\xa9\xceA\xa4.A\xa0W|\x03$Ox6\u07b65Lq[S\"i\xdaxcE|\x8b\xc5|6op\xee\x96\x01\x95\x9a\xdf=\x1b\xea\xdf/\xa3\x99\x9b߳\x19\x9bwv\xfc\xbe\xa9\x19\xa2}\xe2\xd3\xde\xc5\xc2|\xefx\x03\x89\xb6\x89\xe0\x1e\xfb\xdem\x97\x99\xc1\x01z\x1d\xf2\xa3F\xbey[[54\x17\xb4\xc8\a\xfa,z\xe3\x87QS}\xb0\xab\f\xe4i\xbc\x17\xca\x0fZ,\x19\xf0O\x8d\xbe\x0fs\xab\xea\xfb\xb8\x17\xa3\x0f\x91\v\xbf\xc0\xf4s\x16#\xa7\x14\x8d\x19\tJH\xe5\xf7\x0e\x9aX\x05'\xd0s\xfe\x17\x00\x00\xff\xffT\xdd\xfd\xb3B\x10\x00\x00",
- },
-
- "/data/en/top_level_domains": {
- local: "data/en/top_level_domains",
- size: 37,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffJʬ\xe2J\xce\xcf\xe5\xca\xccK\xcb\xe7\xcaK\xccM\xe5\xcaK-\xe1\xca/J\xe7J\xcf/\xe3JM)\xe5\xca\xcd\xcc\x01\x04\x00\x00\xff\xff\x04\x1a\xcc\xeb%\x00\x00\x00",
- },
-
- "/data/en/weekdays": {
- local: "data/en/weekdays",
- size: 57,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\n.\xcdKI\xac\xe4\xf2\xcd\aS!\xa5\xa9\xc5 :<5%\x0f\xc2\n\xc9(-\x023܊2ATpbIi\x11\x88\x01\b\x00\x00\xff\xff\u007f&+w9\x00\x00\x00",
- },
-
- "/data/en/weekdays_short": {
- local: "data/en/weekdays_short",
- size: 28,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\n.\xcd\xe3\xf2\xcd\xcf\xe3\n)M\xe5\nOM\xe1\n\xc9(\xe5r+\xca\xe4\nN,\xe1\x02\x04\x00\x00\xff\xffܹ\x9c\x9e\x1c\x00\x00\x00",
- },
-
- "/data/en/words": {
- local: "data/en/words",
- size: 1685,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffLU\xdbr\xeb0\b|\xe7/\xb1D\x1bft;B\xca\xf4\xf3ς\x9c\x8c_:\xb1\xcdewY(\x17e\xa3ԛɿ\xcdkO\xe2\xbdh\xc8\xfc\x91)-\xab\x91\xe9\xa2w/{,^R\x89S\xda\xc6m鮔{\xe9S\xea\xbf-\xc4HQ\xae$\xecO:\x8c\t\xf5\xf0\xfe\"-\xa5\x93\xb6\xb7\xb4\x85hz#\x10\xa5PY\x96ǘ\x12\xcf\xf4\xd2%iu\xba\x84\x17\xd2\xde\xea\u007f\xb3\xa6\xc5d\xbb-\x92\xbfQ4\xf1Չ\r\xad\xda\x17j\xcf\xc0\xe7?~\xf6/~\x99d\x14U\xfePB.\x02+\xff6\xbd\xe1\xa2o7\x8f\xa1\t\x14\xbdɓ\x9d\xa7(5\xb1\xa4\u07b5\x89\xb3\xb9i:+\x90\x8e\xea\xf1*\xa4\xe1\n\x1a\xd1,-\tPY\x87\"\x1fD\xcb\x13P\xeb\x8dچX\xae\x92n\xa3\n脦\xa3O\x86>I\xb3\xb7\x04\x93\x02\x9a\x10\nuO瀏,\xcc*\xb2]X`\u007f\xe2F\x964EH\xa6\xaa\xf8\xc1\xe8\xde4b!t\xeb\xb6&\xa0˟\xcc\x14\xe2\x836\x92JAD\xea\x13\b\b\xdc\xcf\xc7\x11\xb6Aq\xe8\rV\xbb'4\xc5,\x81$pjF;\xd8\x01\xf5k0}z,Pah(\r\x95H\x80M7\x88N\x19S^\xf0\x9d{$f\xa4\xcdk|\xa1ܢ\x8a\x99Ph\xd1\xf4\xa5\x05R\x16\xb1\xa5\x1c\xa2A[\x18\t-;\f\x84\xb9\x9bi\xc5\xc4\xf3NZ\xf7\x99\xfcU\x18\xde^\n\x14c\xb2\x98\x1c?\x17\xde\xf9\xb6\xf6\xea\v\xd5}\xea\x9f\xde\xeew)\xd0g\xc1\xb0\xcb}\x01\xe5&>)Jz\xfd\x8f\xbb\x8e\xab\xbf\x98\xf0\xe6/\xc9\x00m\x85r\x98pO\x89%a\b\x94\xf6Ь\xc1\xcb\xdd1f\u007fk\x06\x960\xcdYC\x1b\x9a4\xb6eC\x15\xea\x15|H\xcd3\x00\t\xb5\xe7\f#Vu\xd1\xe5,\vDK\xbb\f\x0e\xae\xfd\xe7\xc7K\x00\xbc\xc9\xf4\xaf\x00\x06\r\xf1\x861k(\x8cA\xd9=G\xf7\xc8\xed:\xfc\xc4F\xb1?\xbfx\x1e\xdfgqI\xe2\x13'4\xb4Ȕ\xd8Nq\"\x10\x1c\x94[\x82\xc1\xc8\x1d[\xf4\x92\xd9o\x93C0d\x1a\xe4\\\xbe\r\xd7'\xbd\xe8\xaf_\x1a\xea\xc3\xd3Ҏ{r\xe6\xaa5\xea\xba\xc0\x84\n(\xe5\xce9+d\xc7 \xb0;dP_\xb2\x0e\xf3\xf3\x9fV\xa1Q8\xe1\x908L\x9c1\xa4\xba\a\x10v\xe4\xfb\x1a\x99\r\v\x8d\xde\x1c\xd5\xcedz\xd90\xa2\x14\f;#\xe9\xa0\xd7k\u007f,\x8b\xb6x\xc8\x1cb\xf9\xe9yZ\xdb\xfd\x8c\x8bw\x04\xfb\x9e\x0e9rb\x92\xc1勠\xf9\x0e\xd2`\xdcθ\x1d\xcb\xcfc\x8f\v\xe5\xb5\xe3\xd6\x06\xf0\x18\xa2ÓK\xd7Y\x9e{\x14M\x12\xd6!\xb6\xda!\x1a\x03:\x89\xaf\xbf\xc45\x91ǡ0'\xb6\xb3\xc2\xfdؕp\xa3\xac\xc7\xf6\xb8\v\xa7ā\xf7\x00\x14\xf5YH\xcc\xfft{i\x82 \xed\\:4\x1b\n\xbfJlFr?\xeeuC\x03\xdc\xf3\xff\xe3\xd3<\xd0U\xd6X\x92\xd0\xe5H\xea\xe7\xfc\xbc<\xa2C\x83\xff\x01\x00\x00\xff\xff]\xcec\x0f\x95\x06\x00\x00",
- },
-
- "/data/en/zips_format": {
- local: "data/en/zips_format",
- size: 8,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffR\x86\x00.@\x00\x00\x00\xff\xff\x87\xdd'=\b\x00\x00\x00",
- },
-
- "/data/ru/characters": {
- local: "data/ru/characters",
- size: 119,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\x04\xc0U\x15\xc3\x00\x00\xc5\xd0\xff\xa8\x19\x83\xbb1Ù\x931\xb7\xb5\xf0\xe2\xa87gr!Wr#w\xf2\xc0\x13y\x92\x17y\x93\x0f\xf9\x92\x1f\xf9\x93\x82\x94\xa4\xc2\x11\x8eq\x82S\x9c\xe1\x1c\x17\xb8\xc4\x15\xaeq\x83[\xdc\xe1\x1e\x0fx\xa4A\x93\x16m:t\xe9\xd1g\xc0\x90:\x00\x00\xff\xff\xb7\x8c\"\x8ew\x00\x00\x00",
- },
-
- "/data/ru/cities": {
- local: "data/ru/cities",
- size: 2271,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xfflVir\xf2F\x10\xfd\xcf)\xb8\x00wD\xe0\xd8N\xe1\n\xf1Vv\xe4\x05\x03\x95\xf2\xaf\xc4b\x11\x8c\x85\x90\xaf0s\xa3\xbc\xf7zF\x88\xd4\xf7\x8bަ\x97\u05cb\xf0\u007f\xfa\xad?\xf82\f{ A\xf8*d\xbe\xf0G\xbf\rC\xdf\xf85\xc5G\b~|\x01\x12\xb2=\x98\xda\x17!\x13\x1b~\x93\xf1\x06\x0f\x0f\xe1\x06O\xab$vx\xd2\f\xfc;d\"\xfd\xdaW\xe6#\v#\xf8)\xeci\xb8\xe9\xf9[\xbc\xde!\x87K\xbe&s\x80\xc3F\xf1\xb7\x14\x18\xb96\xef\xb7\xf0>\xc5;1wpq@\x05\x85\xff&×\x0ea\x9c\xff\xee\xfb7\xc5\xec8\xfa\x9f~\xa9D\xfe\xf0\x1bi`T\x86)\xc9\x03\xbcma\xb2\xc6KX\xe0m\xd5\x15\xd7\xde\x11\xac;ȕ\xa6߰\x18\xf3O\x11\x04LH\xac\"\x1fY\x1d\xd80\xf1+\x89\x18\x10%\xec\xc3\r\x81\xec\xf9{\x15\xe1\u0095H\xe4t\x850GӔ\xea\t\xba\x01\x80\x1c\x13\xb9O\xf5\x10\xaf\x96\x05\x96,V\xa2\a\xa58J\xed{\bcĕ\xbbGC\x03q˄\xe6\xa3\xffND\xc5\xd8\x02\x82\xd1Wal\xa9>\xaar\xb0x\\\x18\xab0O0g\xe1\xf1\xfd\x13\xc3\xe3\x9d\xeb\"\xfe\f!ǃ\xb95dw\xa7\xc8Ϙ$\xe1a\xec_ \xaf\x95\xc3\x10CØ=\x9f\xe3\xf1>\rIn()\xc4\xf1\x04\xba\xc4)9c\x00-m\xc4j\xfajC\"G\xf0Z\x05\xc6|r\xea\x90\xc0\xc4H4\n)\xd4\xe6\xc8\t\x87\x83\x1a\xbaN\x82\x96\xccL\xce*-\xfd\xdcr#\xc1ImM\x1b\xe4\xd2Y\x8d<\x8eHm\r\xc9m\xc4dnq\xb5\x18\x19\xb5a\xda\xd7ڰ\x9e㹎\xdd/8\x84\x1dQ\x98&$s\x9b\xbap\x8dn\x02\xa20\xa2h\x9c\xb4/\x86)\xc7\xdd:\x01ےb.i\\\xc1\x17\x98\xdb@\xb9pIt^\x85\xbdb0cMD\x9c\xb6W\xd8\xedNc\xf0*}ž\x83\xd1\f\xd5\xea\xa0i%@\xad$/9/I>A\xb2.\xfc\xee\x9d1\xd7ZR\xc0\xf9\x86\x9f\x9dz\xfe\xab\x8d>\xd3.\x10gÞ\xf5\xa2\xa1mF\xa6\x11\x88\xe9%\x05E+\xb6\xd4\xc4\xef\x18\x03# \xb9\xa5\x87w\xad~\xa1D\xd4ʙJ\x8e]\xef\xb3#}<\xab\x88\xddL\x83\xbfgųxH\x12Dh\xfc\x80\x9b\xa2\xa5Ʉ\x8c\xe3\xa92\xbb\x9asM\xd2֎\x85]D\x81*\xdc\xcbG;c3\xf3B\x82\x13МƊ\x82*\r\xdd,vU\xe4\xf8\x04e\x87\x89\x89\x94\xfdx\x10&\xd4Nق(\x90\u05cf\xf6\x00\xae\xfb\xe7\xc7\xf3L7 \x18\x03\x9c\x1d\x0e\xdd\x18*l\xa3\xc0\xf8\xd0\xc5s\xa9\xc9\x1fZ̸\xcd\xf3\xf8\x15\x19\xd2p\xae#Q\x85Ѡ\x83F{\x80\xe6\xf1\xd0D7\x89\xfdA\x98C\xcbZ*d\xd7\xf2`w\xb8-e\xcei\xe7\xaa\xc8\xce\xd6JY\x18\xee\x8e\xea>a\xd4\xc7o\x9b4?i\x11(\xa8\xb5\xbb\xe5)\x8f&\x02R\xa4\xe9\x99\xc7\xed\xe6\x97Ή\xe5)\a!D\xb6:N\x88j\x83ʂر\x8d\tꄌ1+\x8b\xba`uH\"#L\v\xd564\xa3F&\xed\x04,\"\x83&\xb2\x8d&\xa8[\x1d\"\xed\xecCFf\x94\xbe<\vb\x18\t]\x8bRA\xf1Q\xacU(\"-\x91j\xfc8--\x82\xddss\xbd\f\x17|\xfe\xb7\x92\x1f\x85\xc9@\xa7\xe2\xd8]\xb9OxZi>3\x1531\x11\xcfZg8>mq\xe2\x1f\x05]\x96\u007f\x14Wk\xd8\xf3\xff\xa6\xcf\xd6@\xc3\x1e\xeb\xb6Y\xfc\x02+\xa3\xaf\xb3\xf3D\xac\xff\v\x00\x00\xff\xffL\x92o\xa5\xdf\b\x00\x00",
- },
-
- "/data/ru/colors": {
- local: "data/ru/colors",
- size: 216,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffD\x8e\xbd\x0e\xc20\f\x84\xf7\x8e\xdcF\x0e\x1e\xfa\xa1\xdd\xe6\xfbQc\xa4-6\xea\xbb0MU\x8a>\xba\x16\xb4\xc5Rl\xa1\xe2eJ\xf8\xc0\xf8\x03s\xee\x8d\xcb\xc9\xe2\xfc(\xcd{\x03\xec\xd1|K\xa5\x1e\xbd\x8c\xa4;\x89\xb3\xf1\u007f\xcc\xe2\x94,{\x02\xc1\xccxT\x8d|\xa2OE\x00E\xfb\xd7@t\u007f,\x95\xd5>ז\xe4\xa7&Q\x18\x81\xa9\x99\x03\xbe\xf2H\x96>*G\x06\xb1\x9c\n\xdbVC\x0f(\xdba\xddbO*\xcb \x1a,\xb7\nl[s+1\xb49\xc7f\xb0%Ă\xb9\xb4\xc1\xaa\x9bўk\f\x99\xf2N\xb2\xf8n)O\xc9^\xb1\xcaZ\x9c}c\xc2rk\x11\x94E\xb6t\xe5\xff\x14'\xa2\x92D\x0e5\xc3b\x8e\xf1\xca2ѣ\xd2\x03B\xe7\x98\xd7\xf4\x99K\xad\x93\x932Γw%\xc0ka%\xeb\x15ԕ\x8a2\xe6a\xb9\xd2\xecԿgȆ`\r\u007f\x00\xd7\x15\xea\xa8\xf1}J<٨\xb0P\x19Y\xa9(\\#z|\xc3\bx\v|7\xab\xbf\x9bO\xbeK\xaf\xcaܗ3\x80\xe0E\xdeF\v\xe5\xabw\xf5\x8f\xdd\xefNP\xd6\xe5\x95\xe8P\x1d\xbf\xb2\xbe\xf5\x86\xa5W:N\xea\vE}\xb2\x86\xd2\xe6͚\xb2\xfe'\"\xf5\xd5\xca\xd1x\xc377\x82<\x1b\xf97\x1aȒ\xcb\xcf\xfc\x13\xfb\xa1\x94ۛ\xdc\x1f\xb8\x97\x9f\xfe\x1b\x00\x00\xff\xff\xf3G\xd8e\xc2\v\x00\x00",
- },
-
- "/data/ru/currencies": {
- local: "data/ru/currencies",
- size: 4636,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\x8cX]\x8e\xdcD\x10~\xefS\xf8\x02\xb9\x06\x8a\xe0\x05!x\x80\xd3\xcc\xcf\xeef\xa5\xec2\vBB\n,\xcaF\b\xf1\x12\xe1\xf1\xd8;=\xb6ǾB\xfbF\xd4\xf7U{\xdc\xedm/(\x0f\x99\xb8\xbb\xab\xab\xbe\xfa\xea\xab\xea\xb8\xd2\xd9a5\\\xbbܵ\x99\xfb\xc3=\xb8\xcf\xc6\xe5Õ;ȗ\xf3\xb0v\xb5\xb3\xee\x94M\x9f\x9c\x95u\u05f8}\xbc\u07b8\xca\xd58\xb9r\xed\xb0\vWJ\xf9$\xc6\r\xf7o\xe4[3\xdcM\xab\x87a\x8b\x0f\xe2F\xe5\xce\xdc#\xd7t\x97=\xf9\xb0\xcb䯂\vG\x97\xeb\r\al\xa6-\xbd\xa7sU\xe6zW\xc9?:\xd8(\x86\xf5\xb0\xe1\xb5\rn\t|\x81i\xf9#F\xb0\xef(GV\x8c\xe4$K\xcfqD-\xeḟ\x8d\xd1X\xe5V9\bG\x87ۋo\xe2D\x8e\x9f\xd8\x03\xd3\a\x98\x8eQ)x~\xb8\x96\x9b*\xb9'D\x06\x01\xa8/\xfba+\xe7\xb6\xf2\xcf2\xf2x\xb8b\x18g`\xbb\xf7;\xaaň\xd4\a+pEQ\x87\x9fa\xab\xa3-\xc6\x1fg\x83.\nh\x1a1\xd2\xdd.\xdf$\b\xaf51S\xa6zdSѨ\xe4G\a\x8f%\x17\x93}Y\xdf\xe3J\x83\x13\b^葾\x01Y\xf5\\\x10[\xc7\x14\"í\xdc\x0f4n\"\xd4\xc3\x1d\xef\x10\xe1\x05\x8d\x98'\xb2\x9b\xe9\v\xd0\xfe\x91\xe1\xdc\xe9\xed\x8d8ۊ\xbbK\xa7;\xb0\x8c|\xb4\x1a\xcd\x14\t\x8f#\x00\xd9ǐ\x93L\x15\xefB.\xc9\xd6\x15\x83\xce\xcd\x14B\xe6~\x11bZ\x12d\x83\xda+A\xc9\xd4\x19\xb2\xfd\x99՜`\xd8pOo\xbb0[\xc1\xd9J\x90\xb6tl\x13\xe2\xb8E\x99\xe1\xec\x95|\xe9$\xbd\x13\xa7\x86\xf7Ȓ\xd0\x1bFL\x98\xbb\xcc\xfd){PO\u058c62ގjk\xe8\x12\xf2Zd\xee\t\x80x/\xa5\xa4\xc1M,\x11@:\xc7\x02\xe2\xd9\x02n\x1eȠ\xe3\x05N_d́\x99I\x96\xfc\xa0i\xfd\x1e&\xd2C\x93\xf3\xe4Zw\x14އt\xe9a=G\x00T\x85H\xc0jbv\xa3\x9f\r\x03;\x8f\xe4]\xa0\xb6\xee)Q\xf2p`JH\xc3\vz\xe4\x10$\xb8&\b\xc5<\xe1[MYA\xc4\x0e\x005\xf0\x99G,!\xcf2\xf7sb\x0f\tq\xc3|\x9e\xd5k\xd9\xfd^uB)\x97\xbd\xfd\xee\vC+V\xdd1\xa4l\x87NY{\xc2vZE\xa1\x95\x15\xef\x17,q\xff\xe3\u007fe\xd2}\x88-e\xd9Wo\xbf1\xac\x8c\x82\xd5\xd8\xf9J\xab\x82\x8c\xc8R7R\x8c?2\xf7\x91\x8aիzS\xee,l\xf3$\x12\aR\xaa\x14o\x92ɫ\xd9l\xd0\x04)\x99a\x1a7#E\xff_@\v\x9e\xcc\xccK\x9c?|K\x8c]\x9f\xb9\xdf\xe4S\xe7묃\xb5G\x11Տ\xc6\xf7\xc4ț\x8b\xe4\xdd\x02\xe97\x9eW\xf5\"c\x1b\xf6\x10\x94@ G\x163CC\xc1\x98u\xe2F\xe7\x89D\x8f\x0e\xc0j\xa9g\xc8L\xfd\x82\x95㨆] q\xa9\xd3N8o\x9c\x8c\x8a\x94vp\xe8[x\x8f\xb6+/\x98\xa5R\x19\x92\x9d\xc4\xf5w\x0e7\x95\x97\x01\x06\xdcJi\xcbx\xa7\xd3ф\xdb;\r\xac\x9d\x9av(\x01\x1b1{\xd0>\xa9Ρi\u0600\t\x84u\x8bj\xe0\x1d\xe3\x8eW\x80\x1fC,\xa2\x1d:*\xc2\x1b\xec\xa8(%as\x8e[\xf8h\xe3\x14\xe8ۥ\xc8\x10\xc6AS\x89\xa8\x8e\x97\x1eR\x87#b\xc5)\xb4V!\x8az\xe0#\x0fX\x1e\xb1\x86b@\x1d\x8e\xfd=S\x99\xa0\xf6\xdcQ339\xa7\xe2h\xb0:\xea@\xc1yc7\xb6Gܷף\xda(*\xf7\x9c\xec\xee\x90\xf0>h\\I\x11g\x90U\xa4\xa4/ղ\x9b'\xfe\xa2½\x9f\xe7\xdap\xee\xd4\x1a\x86\xfc䆸\xaf\x82\xc0|3\x1a\xfb\a\xc5\x0fM\x82\xc3F\xc3q\xa4_\x18\xf1{\x12\xd3Fj2\x0f\xaa\x9f\xb1P\xa2#\x82\xb8\x8c\x16\x14i*\xc0)~\x90\xe4\xbe\xf3[*\x97\x0ey\x89\x90\x03\xdfqo+?\xcf\xf3Z\x84\xd6⍑\xec-k\xf9kK\x80\x8bȼTX\xa3*}b\xfb\\ț\x84\xbf\x9du\xae@\xc0ȇtG\\{~\xe7(\xf8x^\x9cr-\xd6\xef\x981\xc1\xe2\r\xa3\xe9\xe6\xe1q80ڵ^<\xb6f\r\x0f\xce\xfa\xc2Z|V\xc0\xb1\xa0B\xe2\x80\xf4\xb1\xc1'\ve\xab\x8c$\xd7\xf3\xf6\xa0}א\x17\xf6%\x99\xf7\xd4)\xaejk\xadg\xcdW\x95.\xca톎\xd7\x14\x94\xe4\xfb\x90\xfav&\x1dSY\xd6\xf3\x954\xb6˘\xa7\x03^,\x18\x9f<:\x96)-\xd1vE\x82?i\x8dCSc\xa7\xa8[ڽ\xee\x16\xd0܌\xaf\xe6\xd7G\x11q\xbe\xf6\x83[\xa08\xaaׅ\x12f\xeb\xdf\xfe\xe5\xab#M\x14Γ\xfb\xdb=\x18\xff\xac\r\xab,~\x02a\x9a\xdf{\xa5\x1e\xf3\x80Z\x1a\xe7ۊ\xbc\xb9\x8f+yz\xd0\xe2*PD\x9e(+\x8c\x12r\x8c\xacݤh\xc6`\x83\x97\xd5\ay\xa8\xb4\xa7\xdaen\x163\x0e\xd4S\x83\xcfT\xb2\xc3\xe7g\xf4\xf8\xa0.\x86\x8enA\x15\x8d\xb6h\xa4\x16\xbf\x94\xf1G>K\x04\xd2)#Mqw\x8e\xee\x15\xaa\xeb\xb8;\x97\xc4\x16\xd0\xfe\x13\xcaCv(\xfe\x86p\x81_\x153W\xd8k\xe8\xc4xt\xaa\x83˰\x9c\xec\xec\a\x04z O\x81=vKż\xc0ℶ\xa6\xe4;\x1a\xfb\xb9\xf2\xd8x-\xfcdrf\b=\xfbÕc.h\xe3\xe7\xd6\xdd\xd2\x19-kw\u007f\xd9\x16]\xf0?D\xfe\x04\x87{\x04@\xc9y\xc3^\x8f\xb6wJ\xc9+\xceHh\xe7\xd8a\xa4\xd0S\xa7>\xb2\xb4\xf8M\xca5\xa6F\xd9I\xbb\xbc\xa0\x04z*\xde\x1d>2,S\xc6R`\x81\f\xe4\xe4,\xb4\x19\x04g\xf5\x115\nE \x01\x1ar\xb08+ȍ\x18-\xa4\xaf\x04I~Y\xb0\x13$\xad2ËF\x03\xbb\xc0\xec9\x06~`\xd1[\x8d^\xa5\xe1d\x1a\xa2ڌ\xf7\xc2\xde\x05\xf7uT\xb9\x06\xa8\xa7d\x1e\xf6\x80\x88\xd9\x19w\x82\x8fQOx\x06\xd5\x062\x1bp\xe4\x1c\xe5}-]\x1e\x94\xab\x95\xbb\x153\xa7\xdd\xc1\x9e\xb0\x85\xf67\x82c\x91\xee\x8f\x00n#Wor\xe9\xc6p\x17\x93\x003\x9c\xd1]\xbb\xe8Κo+\xc0+!\xda\x00d\xed\x10\xc4ܥ\xa5\x82\v\x19J(\xfe\x8a\xac\xd6\xd8X\xda\x16\xea\xc9ߢ`!\f\x8fz\xaf\x99\xceV\xfd\x96\x8b\x97\xcc\v\xf3.\x96\xa9\\\x86\xb9\xb8\xe5%\x9d\xbf\x18\x01\xb0\x9a\x1e\v\xd1\xef\xe2\xea6\xff>8\x85\\\x9a8\xa0\x94LڡV\xa2v\xc2}\xe7\xed\xe7\xb9͒\x98\x80Y\xea\xbb6\xb3\x8f\xd8\x06\xd7f\xb8\xe2ѻO\x81\xec\x83n\x18J\xb3\x16\x90\xa9U;\x152L\x1ax%\x94\xdd\xca#\x968\x1cb\xe3\xc85\a[\u007f\x0e\x04bc|\xa4\xfb\x02D\x0fJ\xceV<\xe2G\f\xa1w\xb4\x87\x00\x90:<\xe03\xeb\xe7\xa37\x96wڒ\x1f7\xb5\x80\b\x84\x82{\xb9DO\x9c\\\v\xf5\x99\xda.\xc7m4\x14\xfct_\xac#\xd6(\x18\xac\xabĒ,1+\x1a\u07bc+\x8f\r\x11\r\x9a\x03z\xa4\xeao\x00\x00\x00\xff\xff\xc0T\xbbH\xbe\x06\x00\x00",
- },
-
- "/data/ru/female_patronymics": {
- local: "data/ru/female_patronymics",
- size: 237,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffT\x8eA\x0e\xc3 \f\x04\xef}5X\xed\x8dC\x9f\xe2V UP\x92/\xac\u007f\x94\x15\t\x91\x11\x17<\f\xeb\xc5\x1b\r\x05\xd5\"\x14\x1d\xd9\x026|y\xd3\a\x9fNPx&\xb2`/\xfc\xb0{k\x06x\x0f݄Nw\x1e\x8dʱYB^\xbe\x13|P\x98,\xde\x0e\xb4\x95\xfb\x93\xdf\xfe\x1c-\xd5\xe2\x82\a\x92+{\xe9*\x1c\xffw\xea\x11\x00\x00\xff\xff\xfc;\xa2\x9c\xed\x00\x00\x00",
- },
-
- "/data/ru/genders": {
- local: "data/ru/genders",
- size: 30,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\xba0\xe7b\xf3\x85m\x17\x1b/캰\xef\xc2N\xae\v\xd3.l\xbd\xb0\x17\xcc\xdd\x01\xe4\x02\x02\x00\x00\xff\xffdgd\x9f\x1e\x00\x00\x00",
- },
-
- "/data/ru/languages": {
- local: "data/ru/languages",
- size: 419,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\\\x90Mn\x830\x10\x85\xf7\x9cڀ`\x85ԟ\x15\xa2TT\xb4]\xe36\xa0\x98\x80\xc9\x15\xde\xdc(o\x90\x90MVx\xbe\x99y|6\x1a8\xc9`1K\x8a\x1b\x1c\xe6\x045\x8fw\"\x1f\xd0+<.X\xb4\b\xf0\x97\x1f\x8f\x11\x8e}1\\\xf8\v\xbd\x0e\x9b\x18\xc9$\xe7\x9a\xc5\"Uh\xbda\xdaӞ\xf0\x97䒆r\xa0\xc2\x16+\f\xf8?;}\xc0J\xc1\xdf{\xd8\x04\x9f\f]1Iyt\x1b\x15 \x8c|\u007fvI/%\xad\xae\x01\xf7\x9cZTT\xf2\x04-C9E\xf3B\xef\xd5S\xcaı=\x13V\x1eO\xea\xefRq&S\x13\xac\x01\u007fsu\xd4\xd0z\u007fa]y\x89/\xd0*}\xc7\x1c\xc3\xd2q\xf1\x80\x8f\x00\x00\x00\xff\xffj\xa6\x1d\x9b\xa3\x01\x00\x00",
- },
-
- "/data/ru/male_first_names": {
- local: "data/ru/male_first_names",
- size: 430,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffLP\xcbJ\xc4@\x10\xbc\xcfW\x9b\x05o\v꺂\x88\xaf\x05\xcf\x126\x19\x98\xcdd\xe2/T\xff\x91U\xdd;\xe8%\xa9\xc7\xf4\xa3\x1a\xf7\xa8\xc8Xl\xc0\x88\x86\xd9n\xd2?)\xe3\"\xda0\xda\x0e\x1b\xe5\xd2\x05>\f\xf7\x01\x1ba\xb1!\xe1\xc0\x16\xac\x14\x95C\xca\x16\xa5W\x1d\xf8[\xd4F#H\b\xc7?\xaf\x92\xcc$+\r\xfa\x8fl\xde4\xd7\xc5K\b\x1a4]\xa9\x0f\x99b\xb6\x84\xa3\x17\xf8\x1aGo\xb2\xeb\xce\x13\xce|\xe8\xae\xe83)\x93\nx\xb9\xed\x05\xab\xed\xed.\xe1\x85!\x9b\r\xbeZ\xe3\xb7\xe8\xe1+\xc9\xe2IV\x91b\xb7\x14\x18+\xe1M\x91\"I'\x9b'\xe1\x9cw?\xe2\x94\xf0A~&\xac\x82Y{%|\xf2\xdd\x1ak\x9c\xfc`S\x1c\xf3\xc4V\x19?\xe1|\x11\xceq\xae\xefk\x98\xdf\x00\x00\x00\xff\xfft5E\xb6\xae\x01\x00\x00",
- },
-
- "/data/ru/male_last_names": {
- local: "data/ru/male_last_names",
- size: 1531,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffdT\xdbn\x1aK\x10|\xf7W\xe3\xc5\a\x1dɖ\xc2\xcd1\"\xd8\x04\a)\xceS\x96\x85\x15xaw\u007f\xa1\xe7\x8fR]==\x03\xc9\x03Zf\xa6/\xd5U5#\v\xa9\xa4\x94V:\xa9\xeed*e\xb8\x97\x93\x9cÓԺ\xb1\x96:\x14a`\xa7\x1b\xb9\xc8\t\x8b\x18\xbc\xc2\xe2?\xe4~\xca\xd96\xb6a\"\a\xe9rx'\r~\xf1\xf47\x17\x15\x96\xb1r'\xbd\x9d\x8cQ\xf1\x80\xac\xdaN\xc6\fi\x00䟍2F2\xed\x1b6w\xf8\x1d,j\x86\xfd\x93쵿\xa3߄\x02\u007f\xfa<\xdf\x06\xcb\vP\xc6\xe5\x1a'\x95\xe3\x9b\xe0\xb3G\xb1\x14\xfc\x8ar\x86\xbf\xb4rs\xce_\xb0\x0f7\x9e\xad\x9ds\xa7\xa1\x8d-\x96a(G\x14\xaa\xc3\xe8\xba\x18\xb2\xf1m\x8d\x1b\xf6\rO\x80\x83\xf3w\xec_P\xec\xc1\x87~C݈l\x8c]E\x05m|\xb2\xad\x8a\x84_\xef\x1cb2$\xec=\xfb\x05\xc1\xd0Ʊ\xad\xf0\xb7\xc0\xa8\xf1t\xaa t\\\x9c\x97*Y\x82\x8c\xfa\x17C\x88\x14RNX<\xc7\xe7\xe8\x90\x16\xb4\b\x03g\xec\\^\x87\xaeع\xf1\xc9U\xf5\x93/W\x91\xb1#\x97w\xf2\x1d\xdfK&\xfd\x8du\xfaT\aii\x8a\x175\x1b\b\xadM\xae\x1a\x18\xbeD\xedUH\xearN\x96\xc2\xc0\x9dW}\x06\x83\t\x9d\xfa\xa6\xd3s's\xce\xecG'b\x16\x86\xf4^P\x14\xa4\x86\x91\xbd\x8c\x83쾭\x99B=2\xd5\xd7\xc4e$\xdd\b\x1dy\x93-_\xb3\xce\xf9x\x05\xeac\x1e\xf3G\xf8?\xab:Gh\x9b\x1dA#\xa9T\xaa\x8d=2\xb7\xfeh\xad?J\x02\xa6Q\xf1'\x00\x00\xff\xff\f\xe6\xecL\xfb\x05\x00\x00",
- },
-
- "/data/ru/male_patronymics": {
- local: "data/ru/male_patronymics",
- size: 1165,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffl\x93\xcfN\xf30\x10\xc4\xef\xdfS\xb7\xfd@\xbdT\x02J+UP\xfe\x14q\x05J\x12K!N\xd2WX\xbf\x11\xb3Cpv\x1b\xd4C\xad\x9f\xc7\xeb\xf1\xecF\xae%J\x90&\xcd\xe5(\x9dTi&\xbd\x14R\xa7\xe5?\xb3\x15\xf0˰\x93cZ@\x15\xd3\xcac=\xec\x95\xd4u\xa6\"\x14\r.\xaa\xdc\xd14\x83.H;\xean\xb0,\xa5\xa2%\vq\xbc\x86\x9d\x8c\xd6P\xa8G\xbd\xa8\xb6\xdaa\x03\x95\xcdE\x808\\{\xe3k\x80F}ڗ\x03\x02\x1dϕQ\xadC\xdf\x028\xf5\xb0\x81\xea\xba*\xccV\xbaJK\xf8\x98lܪk\x8d\x92\x05\x83\xc5\xea\xa4tP\x9f\r\xd4\xfb\xe7l\x18\x0f\x9e3Vݰ\xaa\x8bhC\xb7\v\x96\xc8G\xb7X\x94\xccmea\xe9Sئ\v>6\x83\x1d\x16\xae%\xbb\xe1H\x18\x81F6,{M\x1b5\xb2\xfc\x8e\xb9\xa9\xe3h!F$͙\xf7\xa4\x8f\xf7\x9a\a_Y\x19\x88+L\x94{\x1cl\xd8\xd8\xd6A\xd4*\xec<\xee\xf1w\t헽\xfdAۯÌ\x8d\xac|\xe4P\x95\xa3\xea\x89͋\x16\x04fj@\x1c>\v\xe3\xfe\x19\xcbON\xe1\xc2\xc3\xd6\xc7x\xe0\xf4\x873\xc410\xfe\x0f?\x11\xfd5f\a~@'_\xf5\x05\x86f\x1cy\x83\x18\x12zb\xea\xbebY\xf9\xce+\x8a\xfc0\xe6\x16ք'\xfc2|÷\xfc\x9f\x17\x99\x06\xbd\xfbA\xfd`\xc2\x05C\xfdEz\xdb\xe4\x1d\xdf\x01\x00\x00\xff\xff[hP\x9b\x8d\x04\x00\x00",
- },
-
- "/data/ru/months": {
- local: "data/ru/months",
- size: 148,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffL\x8c1\x0e\x02!\x14\x05{N\xbd\xae\xadQ\n\v\v51\xb1\x171\x14b\xd0+̻\x91\xffC\xa2\xdb1\xc3\xfbÍF&i\xd2&p\xa5\x905\x91x9\x1e\xbb\x9f\x03\x91\x8f\xd9\xf2\xb3<\x03\ami\xce\xfe\xe8\x1f\xd1B\x0f\xad\xb5\xf2\x93\x8b͛f\xed\xb8\x8f\xf6\x99\xba\xc4\x13\xef?\xecm\\-;\xf0\x1b\x00\x00\xff\xff\xe9\xeb\xb4ٔ\x00\x00\x00",
- },
-
- "/data/ru/phones_format": {
- local: "data/ru/phones_format",
- size: 26,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffR\xd6UV\x86a \xe2B\xb0\x00\x01\x00\x00\xff\xff\xb5\xe6\x87^\x1a\x00\x00\x00",
- },
-
- "/data/ru/states": {
- local: "data/ru/states",
- size: 2756,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\x8cVKR\x1bA\f\xdds\n/\x93\x05w4C\bTA\xc5@H\x852`bS\x14\xab\x04c{`\xf0|\xb8\x82\xfa\n9I\xde{\xdd6\xa4\x98\x91Y@yZ\xaf\xf5yRK\xb2c[\x84C\x9b[\x1e\x06[\xf8(CfS{\u07b2\x13\x9b\x86\x03[Z\x13\xfa8j\u008e\x045\x04a\x17G\x03|\x16\xbcr\x86S\xde^\xcbϭ\xb690\a8L\x98!$\x0f\xd0\u05f7\x85\x15\x107\xdbTo%\xd4\xf3p\x8d)\xad\x82/\xcb\xf5\x01dӰ\x0fAn3^\xba\x83\xca>\xe4\xb0\xf6\x16\x93\xe3b\xfal\xac\xb2b\xcb.\xa3^{\xee\xd9o+\xf9\xdd\xc8x\x03=B\x8e\x01سi\xef\x93\xdd\xdb\x12\xce\xca\xd1\xcf<\xa7)Z\xa9\x81\x18\xf4l\x04S)\x8e\xde\xdf\xfeY\x8f\x141Ψf\x02PF[\xaf\xe1O\x10\xc1L\x9a'a\x97\xbf\xa0\xf5\x06\xa6+і\b\xb9\x05\x96\xb1\xa70\x18\u05fe\xd5\xfa\x19/\x81\xbd\x18\x91(x\x9b\x19\xdcY\xc6Ȗ\x941U?#\xbd\xf6L\x9d\xc0\x1d\xb5`HoE.C\xd6&\x95\x99\x1d\xa6\x06\xae*\x1e\x0f\x83\xec\xb7!\xaeE\\\xd5&Q6*\x15\xd3{\xe9X\x91\xcd\xf0\xd9\xd8\v\xfe\xda#\xb8]\x17\x11\xb2\xd8\"\x1fAZ\xd2C\x92L\xc2\"\xe3;\"\x1a\x99l^\xe5\xe1\br\xc8\xf6\x94\xc99\v(\x99lG\xf2G?V\f\xb2ԅ;Q!\xceUj\xa0\xb1\x1b\xc7\xe7\xe3\xe89U\x85-DX\xe1DpJ\xaah\x0fύ\x1ct[\x8c\xc8FX\x17%\xcfk\xc4\xf1؉:gy\xaaPf\xdd\x18\xbeR\xbe\xaaND|\xed\xec\x05\x85څ\xef\xbf\xd0x\x18\xdd^\r\xe1s\xa5\xf2\xf3\xfc\x1a\x92\xcf\r\x88&e\xbbI\x85܊be\x81M\xaf\x1a\x86n\xf5]\xc0ߏ\xc5~\x01\xd4\v\"\xfb\xda!\xbfT\xffe\xbdxް\x01R\xe6\xc5~\xa9\xa8*W\xcf\x15\xbcy\x84\uf6eb\xfcJ\xcd\xf6\xa38zW@\xe0\xd5\xfb\xc8\xc9\xc8Hc\xa0\xb6\x87\x98\x19\x17W\xba,\\K\xcf\x13\xffwc6r\xf9+ML\x17\x83.\xf0\xe4\xb2=f\xd3^\xb7\xe3\x0e\x84:\x93o)M\xbb\xf8\xe2\x1cT\x9c|\x8b\r\f\x8d\xd9\xc8q\xe014\x91\xe7\x0f\xae\x9eI\xb4\xe7Ƚ7\xc8\xe9\xeau\xedI\xf8Ǝ\xe0\xf8x\xa3\xfb\x83\r\xbd\xecN\xd3a\xc0\xdattݳ\xca!-5ȺP\xdfW\xaf\x01\xfbA\xf8\x02\xc5\v\x11\xae\x99-7\xf0\\z\xa8\x89ZkO\xbe\xda2V\x8f\x17\x8d7\xd6D\x8d\xee\x9amk\xdefҐ\xca~\xb5\xbfLS\xed\xa5a\xcaa8\xd3A\xad\x05\xa9nu\xee\x87&p\x9e6\f!\x8em\xf4\xee.֛\x9cw1w\x91\x819]\xba\x92\xab\xb1Ei&\xebޭJ;\v\x87\xdb\xeaQ\xb5^\xf8\x9b\xf5\x05\xa0\xb8Q\xfd\x89=0\xee>\\8\xb3\xff@ WM\xa9\xe4\x06\xd8j\xea_\x00\x00\x00\xff\xff\x9du\x89T\xc4\n\x00\x00",
- },
-
- "/data/ru/streets": {
- local: "data/ru/streets",
- size: 694,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\\\x92\xcbn\xf2@\f\x85\xf7\x1a\x94\xad\xb3\xa5k\xad\xad۹\xc9\xca;8Ee\x1b\xfd\xe3\xfb\x9cR\x0f\xac\x97\x84\x1b\x9c\xe4=Ǫe&w\x1c\x9b66\xc6^/\xabF8\xd1s\xb4^\x1b\xeb\xc71\x98\xf0\xe4=\xf5\xaa:\xe4\xef\xf7\"st\xe3\xa9xu\x1ce\xae\x979\xe7\xdeU\xfa\x01\x1a@\x84\xf8d\xe2\xc6'\x8cf=Q\x96x\u007f\x02\x00\x00\xff\xff#>\x03\x17\xb6\x02\x00\x00",
- },
-
- "/data/ru/weekdays": {
- local: "data/ru/weekdays",
- size: 117,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff4\x8d;\n\x031\fD{\x9d\xdaI U \xe0\v\x18Wi\xb3\x1f\xc1\xe2\xc5>\xc3Ӎv\\,\xc6\xd2<\xcd\bQ\x18t\x9c]\xff\x8c\x8f\xf4A3r<\x19\x91n\xac\x923\xf37~\xb8\xbcU5\xb1\x19%\xbeB\xc5\xe2=\xdd\x1a/\x16\xbd\xa1\xa10K\x98{a#H\xa2\x91\v\x10\x00\x00\xff\xff\xber!\xd8#\x00\x00\x00",
- },
-
- "/data/ru/zips_format": {
- local: "data/ru/zips_format",
- size: 8,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffR\x86\x00.@\x00\x00\x00\xff\xff\x87\xdd'=\b\x00\x00\x00",
- },
-
- "/": {
- isDir: true,
- },
-
- "/data": {
- isDir: true,
- },
-
- "/data/en": {
- isDir: true,
- },
-
- "/data/ru": {
- isDir: true,
- },
-}
diff --git a/vendor/github.com/icrowley/fake/dates.go b/vendor/github.com/icrowley/fake/dates.go
deleted file mode 100644
index a5e1d945a1fc8bfa703d0609323e9caeed25b523..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/dates.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package fake
-
-// Day generates day of the month
-func Day() int {
- return r.Intn(31) + 1
-}
-
-// WeekDay generates name ot the week day
-func WeekDay() string {
- return lookup(lang, "weekdays", true)
-}
-
-// WeekDayShort generates abbreviated name of the week day
-func WeekDayShort() string {
- return lookup(lang, "weekdays_short", true)
-}
-
-// WeekdayNum generates number of the day of the week
-func WeekdayNum() int {
- return r.Intn(7) + 1
-}
-
-// Month generates month name
-func Month() string {
- return lookup(lang, "months", true)
-}
-
-// MonthShort generates abbreviated month name
-func MonthShort() string {
- return lookup(lang, "months_short", true)
-}
-
-// MonthNum generates month number (from 1 to 12)
-func MonthNum() int {
- return r.Intn(12) + 1
-}
-
-// Year generates year using the given boundaries
-func Year(from, to int) int {
- n := r.Intn(to-from) + 1
- return from + n
-}
diff --git a/vendor/github.com/icrowley/fake/fake.go b/vendor/github.com/icrowley/fake/fake.go
deleted file mode 100644
index df3cb77c069dbebaa1ad41d8806c95186af4bd96..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/fake.go
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
-Package fake is the fake data generatror for go (Golang), heavily inspired by forgery and ffaker Ruby gems
-
-Most data and methods are ported from forgery/ffaker Ruby gems.
-
-Currently english and russian languages are available.
-
-For the list of available methods please look at https://godoc.org/github.com/icrowley/fake.
-
-Fake embeds samples data files unless you call UseExternalData(true) in order to be able to work without external files dependencies when compiled, so, if you add new data files or make changes to existing ones don't forget to regenerate data.go file using github.com/mjibson/esc tool and esc -o data.go -pkg fake data command (or you can just use go generate command if you are using Go 1.4 or later).
-
-Examples:
- name := fake.FirstName()
- fullname = := fake.FullName()
- product := fake.Product()
-
-Changing language:
- err := fake.SetLang("ru")
- if err != nil {
- panic(err)
- }
- password := fake.SimplePassword()
-
-Using english fallback:
- err := fake.SetLang("ru")
- if err != nil {
- panic(err)
- }
- fake.EnFallback(true)
- password := fake.Paragraph()
-
-Using external data:
- fake.UseExternalData(true)
- password := fake.Paragraph()
-*/
-package fake
-
-import (
- "fmt"
- "io/ioutil"
- "math/rand"
- "strconv"
- "strings"
- "sync"
- "time"
-)
-
-//go:generate go get github.com/mjibson/esc
-//go:generate esc -o data.go -pkg fake data
-
-// cat/subcat/lang/samples
-type samplesTree map[string]map[string][]string
-
-var samplesLock sync.Mutex
-var samplesCache = make(samplesTree)
-var r = rand.New(&rndSrc{src: rand.NewSource(time.Now().UnixNano())})
-var lang = "en"
-var useExternalData = false
-var enFallback = true
-var availLangs = GetLangs()
-
-var (
- // ErrNoLanguageFn is the error that indicates that given language is not available
- ErrNoLanguageFn = func(lang string) error { return fmt.Errorf("The language passed (%s) is not available", lang) }
- // ErrNoSamplesFn is the error that indicates that there are no samples for the given language
- ErrNoSamplesFn = func(lang string) error { return fmt.Errorf("No samples found for language: %s", lang) }
-)
-
-// Seed uses the provided seed value to initialize the internal PRNG to a
-// deterministic state.
-func Seed(seed int64) {
- r.Seed(seed)
-}
-
-type rndSrc struct {
- mtx sync.Mutex
- src rand.Source
-}
-
-func (s *rndSrc) Int63() int64 {
- s.mtx.Lock()
- n := s.src.Int63()
- s.mtx.Unlock()
- return n
-}
-
-func (s *rndSrc) Seed(n int64) {
- s.mtx.Lock()
- s.src.Seed(n)
- s.mtx.Unlock()
-}
-
-// GetLangs returns a slice of available languages
-func GetLangs() []string {
- var langs []string
- for k, v := range data {
- if v.isDir && k != "/" && k != "/data" {
- langs = append(langs, strings.Replace(k, "/data/", "", 1))
- }
- }
- return langs
-}
-
-// SetLang sets the language in which the data should be generated
-// returns error if passed language is not available
-func SetLang(newLang string) error {
- found := false
- for _, l := range availLangs {
- if newLang == l {
- found = true
- break
- }
- }
- if !found {
- return ErrNoLanguageFn(newLang)
- }
- lang = newLang
- return nil
-}
-
-// UseExternalData sets the flag that allows using of external files as data providers (fake uses embedded ones by default)
-func UseExternalData(flag bool) {
- useExternalData = flag
-}
-
-// EnFallback sets the flag that allows fake to fallback to englsh samples if the ones for the used languaged are not available
-func EnFallback(flag bool) {
- enFallback = flag
-}
-
-func (st samplesTree) hasKeyPath(lang, cat string) bool {
- if _, ok := st[lang]; ok {
- if _, ok = st[lang][cat]; ok {
- return true
- }
- }
- return false
-}
-
-func join(parts ...string) string {
- var filtered []string
- for _, part := range parts {
- if part != "" {
- filtered = append(filtered, part)
- }
- }
- return strings.Join(filtered, " ")
-}
-
-func generate(lang, cat string, fallback bool) string {
- format := lookup(lang, cat+"_format", fallback)
- var result string
- for _, ru := range format {
- if ru != '#' {
- result += string(ru)
- } else {
- result += strconv.Itoa(r.Intn(10))
- }
- }
- return result
-}
-
-func lookup(lang, cat string, fallback bool) string {
- samplesLock.Lock()
- s := _lookup(lang, cat, fallback)
- samplesLock.Unlock()
- return s
-}
-
-func _lookup(lang, cat string, fallback bool) string {
- var samples []string
-
- if samplesCache.hasKeyPath(lang, cat) {
- samples = samplesCache[lang][cat]
- } else {
- var err error
- samples, err = populateSamples(lang, cat)
- if err != nil {
- if lang != "en" && fallback && enFallback && err.Error() == ErrNoSamplesFn(lang).Error() {
- return _lookup("en", cat, false)
- }
- return ""
- }
- }
-
- return samples[r.Intn(len(samples))]
-}
-
-func populateSamples(lang, cat string) ([]string, error) {
- data, err := readFile(lang, cat)
- if err != nil {
- return nil, err
- }
-
- if _, ok := samplesCache[lang]; !ok {
- samplesCache[lang] = make(map[string][]string)
- }
-
- samples := strings.Split(strings.TrimSpace(string(data)), "\n")
-
- samplesCache[lang][cat] = samples
- return samples, nil
-}
-
-func readFile(lang, cat string) ([]byte, error) {
- fullpath := fmt.Sprintf("/data/%s/%s", lang, cat)
- file, err := FS(useExternalData).Open(fullpath)
- if err != nil {
- return nil, ErrNoSamplesFn(lang)
- }
- defer file.Close()
-
- return ioutil.ReadAll(file)
-}
diff --git a/vendor/github.com/icrowley/fake/general.go b/vendor/github.com/icrowley/fake/general.go
deleted file mode 100644
index 8b1ec7cbd4a2b01e192fdf6d2e48405e8892fc2a..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/general.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package fake
-
-var lowerLetters = []rune("abcdefghijklmnopqrstuvwxyz")
-var upperLetters = []rune("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
-var numeric = []rune("0123456789")
-var specialChars = []rune(`!'@#$%^&*()_+-=[]{};:",./?`)
-var hexDigits = []rune("0123456789abcdef")
-
-func text(atLeast, atMost int, allowLower, allowUpper, allowNumeric, allowSpecial bool) string {
- allowedChars := []rune{}
- if allowLower {
- allowedChars = append(allowedChars, lowerLetters...)
- }
- if allowUpper {
- allowedChars = append(allowedChars, upperLetters...)
- }
- if allowNumeric {
- allowedChars = append(allowedChars, numeric...)
- }
- if allowSpecial {
- allowedChars = append(allowedChars, specialChars...)
- }
-
- result := []rune{}
- nTimes := r.Intn(atMost-atLeast+1) + atLeast
- for i := 0; i < nTimes; i++ {
- result = append(result, allowedChars[r.Intn(len(allowedChars))])
- }
- return string(result)
-}
-
-// Password generates password with the length from atLeast to atMOst charachers,
-// allow* parameters specify whether corresponding symbols can be used
-func Password(atLeast, atMost int, allowUpper, allowNumeric, allowSpecial bool) string {
- return text(atLeast, atMost, true, allowUpper, allowNumeric, allowSpecial)
-}
-
-// SimplePassword is a wrapper around Password,
-// it generates password with the length from 6 to 12 symbols, with upper characters and numeric symbols allowed
-func SimplePassword() string {
- return Password(6, 12, true, true, false)
-}
-
-// Color generates color name
-func Color() string {
- return lookup(lang, "colors", true)
-}
-
-// DigitsN returns n digits as a string
-func DigitsN(n int) string {
- digits := make([]rune, n)
- for i := 0; i < n; i++ {
- digits[i] = numeric[r.Intn(len(numeric))]
- }
- return string(digits)
-}
-
-// Digits returns from 1 to 5 digits as a string
-func Digits() string {
- return DigitsN(r.Intn(5) + 1)
-}
-
-func hexDigitsStr(n int) string {
- var num []rune
- for i := 0; i < n; i++ {
- num = append(num, hexDigits[r.Intn(len(hexDigits))])
- }
- return string(num)
-}
-
-// HexColor generates hex color name
-func HexColor() string {
- return hexDigitsStr(6)
-}
-
-// HexColorShort generates short hex color name
-func HexColorShort() string {
- return hexDigitsStr(3)
-}
diff --git a/vendor/github.com/icrowley/fake/geo.go b/vendor/github.com/icrowley/fake/geo.go
deleted file mode 100644
index 12625b936e8f3b73a4f42449fb6cc971a72d5d79..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/geo.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package fake
-
-// Latitude generates latitude (from -90.0 to 90.0)
-func Latitude() float32 {
- return r.Float32()*180 - 90
-}
-
-// LatitudeDegrees generates latitude degrees (from -90 to 90)
-func LatitudeDegrees() int {
- return r.Intn(180) - 90
-}
-
-// LatitudeMinutes generates latitude minutes (from 0 to 60)
-func LatitudeMinutes() int {
- return r.Intn(60)
-}
-
-// LatitudeSeconds generates latitude seconds (from 0 to 60)
-func LatitudeSeconds() int {
- return r.Intn(60)
-}
-
-// LatitudeDirection generates latitude direction (N(orth) o S(outh))
-func LatitudeDirection() string {
- if r.Intn(2) == 0 {
- return "N"
- }
- return "S"
-}
-
-// Longitude generates longitude (from -180 to 180)
-func Longitude() float32 {
- return r.Float32()*360 - 180
-}
-
-// LongitudeDegrees generates longitude degrees (from -180 to 180)
-func LongitudeDegrees() int {
- return r.Intn(360) - 180
-}
-
-// LongitudeMinutes generates (from 0 to 60)
-func LongitudeMinutes() int {
- return r.Intn(60)
-}
-
-// LongitudeSeconds generates (from 0 to 60)
-func LongitudeSeconds() int {
- return r.Intn(60)
-}
-
-// LongitudeDirection generates (W(est) or E(ast))
-func LongitudeDirection() string {
- if r.Intn(2) == 0 {
- return "W"
- }
- return "E"
-}
diff --git a/vendor/github.com/icrowley/fake/glide.lock b/vendor/github.com/icrowley/fake/glide.lock
deleted file mode 100644
index 515144a3881d00f5125a381232472a8a78d1889d..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/glide.lock
+++ /dev/null
@@ -1,6 +0,0 @@
-hash: 9238b15272824ad573d8ef645fb468cb646b72598c63eae8977c3410ebfebe4a
-updated: 2017-07-23T15:10:00.972860398Z
-imports:
-- name: github.com/corpix/uarand
- version: 031be390f409fb4bac8fb299e3bcd101479f89f8
-testImports: []
diff --git a/vendor/github.com/icrowley/fake/glide.yaml b/vendor/github.com/icrowley/fake/glide.yaml
deleted file mode 100644
index 93f9bfae33fb16e5cf43d24ef1f96b6363966a31..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/glide.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-package: github.com/icrowley/fake
-import:
-- package: github.com/corpix/uarand
diff --git a/vendor/github.com/icrowley/fake/internet.go b/vendor/github.com/icrowley/fake/internet.go
deleted file mode 100644
index 8fd1c2736e66f7e61d4a100842271e8f6b02d927..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/internet.go
+++ /dev/null
@@ -1,77 +0,0 @@
-package fake
-
-import (
- "net"
- "strings"
-
- "github.com/corpix/uarand"
-)
-
-// UserName generates user name in one of the following forms
-// first name + last name, letter + last names or concatenation of from 1 to 3 lowercased words
-func UserName() string {
- gender := randGender()
- switch r.Intn(3) {
- case 0:
- return lookup("en", gender+"_first_names", false) + lookup(lang, gender+"_last_names", false)
- case 1:
- return Character() + lookup(lang, gender+"_last_names", false)
- default:
- return strings.Replace(WordsN(r.Intn(3)+1), " ", "_", -1)
- }
-}
-
-// TopLevelDomain generates random top level domain
-func TopLevelDomain() string {
- return lookup(lang, "top_level_domains", true)
-}
-
-// DomainName generates random domain name
-func DomainName() string {
- return Company() + "." + TopLevelDomain()
-}
-
-// EmailAddress generates email address
-func EmailAddress() string {
- return UserName() + "@" + DomainName()
-}
-
-// EmailSubject generates random email subject
-func EmailSubject() string {
- return Sentence()
-}
-
-// EmailBody generates random email body
-func EmailBody() string {
- return Paragraphs()
-}
-
-// DomainZone generates random domain zone
-func DomainZone() string {
- return lookup(lang, "domain_zones", true)
-}
-
-// IPv4 generates IPv4 address
-func IPv4() string {
- size := 4
- ip := make([]byte, size)
- for i := 0; i < size; i++ {
- ip[i] = byte(r.Intn(256))
- }
- return net.IP(ip).To4().String()
-}
-
-// IPv6 generates IPv6 address
-func IPv6() string {
- size := 16
- ip := make([]byte, size)
- for i := 0; i < size; i++ {
- ip[i] = byte(r.Intn(256))
- }
- return net.IP(ip).To16().String()
-}
-
-// UserAgent generates a random user agent.
-func UserAgent() string {
- return uarand.GetRandom()
-}
diff --git a/vendor/github.com/icrowley/fake/jobs.go b/vendor/github.com/icrowley/fake/jobs.go
deleted file mode 100644
index 6895c7c9543502d8d27167a8c9cf355373a65ebc..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/jobs.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package fake
-
-import (
- "strings"
-)
-
-// Company generates company name
-func Company() string {
- return lookup(lang, "companies", true)
-}
-
-// JobTitle generates job title
-func JobTitle() string {
- job := lookup(lang, "jobs", true)
- return strings.Replace(job, "#{N}", jobTitleSuffix(), 1)
-}
-
-func jobTitleSuffix() string {
- return lookup(lang, "jobs_suffixes", false)
-}
-
-// Industry generates industry name
-func Industry() string {
- return lookup(lang, "industries", true)
-}
diff --git a/vendor/github.com/icrowley/fake/lorem_ipsum.go b/vendor/github.com/icrowley/fake/lorem_ipsum.go
deleted file mode 100644
index 8386d5a58e1571100409a2716ca22b52e4e7f850..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/lorem_ipsum.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package fake
-
-import (
- "strings"
-)
-
-// Character generates random character in the given language
-func Character() string {
- return lookup(lang, "characters", true)
-}
-
-// CharactersN generates n random characters in the given language
-func CharactersN(n int) string {
- var chars []string
- for i := 0; i < n; i++ {
- chars = append(chars, Character())
- }
- return strings.Join(chars, "")
-}
-
-// Characters generates from 1 to 5 characters in the given language
-func Characters() string {
- return CharactersN(r.Intn(5) + 1)
-}
-
-// Word generates random word
-func Word() string {
- return lookup(lang, "words", true)
-}
-
-// WordsN generates n random words
-func WordsN(n int) string {
- words := make([]string, n)
- for i := 0; i < n; i++ {
- words[i] = Word()
- }
- return strings.Join(words, " ")
-}
-
-// Words generates from 1 to 5 random words
-func Words() string {
- return WordsN(r.Intn(5) + 1)
-}
-
-// Title generates from 2 to 5 titleized words
-func Title() string {
- return strings.ToTitle(WordsN(2 + r.Intn(4)))
-}
-
-// Sentence generates random sentence
-func Sentence() string {
- var words []string
- for i := 0; i < 3+r.Intn(12); i++ {
- word := Word()
- if r.Intn(5) == 0 {
- word += ","
- }
- words = append(words, Word())
- }
-
- sentence := strings.Join(words, " ")
-
- if r.Intn(8) == 0 {
- sentence += "!"
- } else {
- sentence += "."
- }
-
- return sentence
-}
-
-// SentencesN generates n random sentences
-func SentencesN(n int) string {
- sentences := make([]string, n)
- for i := 0; i < n; i++ {
- sentences[i] = Sentence()
- }
- return strings.Join(sentences, " ")
-}
-
-// Sentences generates from 1 to 5 random sentences
-func Sentences() string {
- return SentencesN(r.Intn(5) + 1)
-}
-
-// Paragraph generates paragraph
-func Paragraph() string {
- return SentencesN(r.Intn(10) + 1)
-}
-
-// ParagraphsN generates n paragraphs
-func ParagraphsN(n int) string {
- var paragraphs []string
- for i := 0; i < n; i++ {
- paragraphs = append(paragraphs, Paragraph())
- }
- return strings.Join(paragraphs, "\t")
-}
-
-// Paragraphs generates from 1 to 5 paragraphs
-func Paragraphs() string {
- return ParagraphsN(r.Intn(5) + 1)
-}
diff --git a/vendor/github.com/icrowley/fake/names.go b/vendor/github.com/icrowley/fake/names.go
deleted file mode 100644
index fde3eaf20450ff9a35d524f0a6c437171666db73..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/names.go
+++ /dev/null
@@ -1,147 +0,0 @@
-package fake
-
-func randGender() string {
- g := "male"
- if r.Intn(2) == 0 {
- g = "female"
- }
- return g
-}
-
-func firstName(gender string) string {
- return lookup(lang, gender+"_first_names", true)
-}
-
-// MaleFirstName generates male first name
-func MaleFirstName() string {
- return firstName("male")
-}
-
-// FemaleFirstName generates female first name
-func FemaleFirstName() string {
- return firstName("female")
-}
-
-// FirstName generates first name
-func FirstName() string {
- return firstName(randGender())
-}
-
-func lastName(gender string) string {
- return lookup(lang, gender+"_last_names", true)
-}
-
-// MaleLastName generates male last name
-func MaleLastName() string {
- return lastName("male")
-}
-
-// FemaleLastName generates female last name
-func FemaleLastName() string {
- return lastName("female")
-}
-
-// LastName generates last name
-func LastName() string {
- return lastName(randGender())
-}
-
-func patronymic(gender string) string {
- return lookup(lang, gender+"_patronymics", false)
-}
-
-// MalePatronymic generates male patronymic
-func MalePatronymic() string {
- return patronymic("male")
-}
-
-// FemalePatronymic generates female patronymic
-func FemalePatronymic() string {
- return patronymic("female")
-}
-
-// Patronymic generates patronymic
-func Patronymic() string {
- return patronymic(randGender())
-}
-
-func prefix(gender string) string {
- return lookup(lang, gender+"_name_prefixes", false)
-}
-
-func suffix(gender string) string {
- return lookup(lang, gender+"_name_suffixes", false)
-}
-
-func fullNameWithPrefix(gender string) string {
- return join(prefix(gender), firstName(gender), lastName(gender))
-}
-
-// MaleFullNameWithPrefix generates prefixed male full name
-// if prefixes for the given language are available
-func MaleFullNameWithPrefix() string {
- return fullNameWithPrefix("male")
-}
-
-// FemaleFullNameWithPrefix generates prefixed female full name
-// if prefixes for the given language are available
-func FemaleFullNameWithPrefix() string {
- return fullNameWithPrefix("female")
-}
-
-// FullNameWithPrefix generates prefixed full name
-// if prefixes for the given language are available
-func FullNameWithPrefix() string {
- return fullNameWithPrefix(randGender())
-}
-
-func fullNameWithSuffix(gender string) string {
- return join(firstName(gender), lastName(gender), suffix(gender))
-}
-
-// MaleFullNameWithSuffix generates suffixed male full name
-// if suffixes for the given language are available
-func MaleFullNameWithSuffix() string {
- return fullNameWithPrefix("male")
-}
-
-// FemaleFullNameWithSuffix generates suffixed female full name
-// if suffixes for the given language are available
-func FemaleFullNameWithSuffix() string {
- return fullNameWithPrefix("female")
-}
-
-// FullNameWithSuffix generates suffixed full name
-// if suffixes for the given language are available
-func FullNameWithSuffix() string {
- return fullNameWithPrefix(randGender())
-}
-
-func fullName(gender string) string {
- switch r.Intn(10) {
- case 0:
- return fullNameWithPrefix(gender)
- case 1:
- return fullNameWithSuffix(gender)
- default:
- return join(firstName(gender), lastName(gender))
- }
-}
-
-// MaleFullName generates male full name
-// it can occasionally include prefix or suffix
-func MaleFullName() string {
- return fullName("male")
-}
-
-// FemaleFullName generates female full name
-// it can occasionally include prefix or suffix
-func FemaleFullName() string {
- return fullName("female")
-}
-
-// FullName generates full name
-// it can occasionally include prefix or suffix
-func FullName() string {
- return fullName(randGender())
-}
diff --git a/vendor/github.com/icrowley/fake/personal.go b/vendor/github.com/icrowley/fake/personal.go
deleted file mode 100644
index 57aa252181e8d0265bd9011b65d1fc79830420ed..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/personal.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package fake
-
-import (
- "strings"
-)
-
-// Gender generates random gender
-func Gender() string {
- return lookup(lang, "genders", true)
-}
-
-// GenderAbbrev returns first downcased letter of the random gender
-func GenderAbbrev() string {
- g := Gender()
- if g != "" {
- return strings.ToLower(string(g[0]))
- }
- return ""
-}
-
-// Language generates random human language
-func Language() string {
- return lookup(lang, "languages", true)
-}
diff --git a/vendor/github.com/icrowley/fake/products.go b/vendor/github.com/icrowley/fake/products.go
deleted file mode 100644
index 9c45fb3aa4656a2dd7044fce581b00bfb37ddf71..0000000000000000000000000000000000000000
--- a/vendor/github.com/icrowley/fake/products.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package fake
-
-// Brand generates brand name
-func Brand() string {
- return Company()
-}
-
-// ProductName generates product name
-func ProductName() string {
- productName := lookup(lang, "adjectives", true) + " " + lookup(lang, "nouns", true)
- if r.Intn(2) == 1 {
- productName = lookup(lang, "adjectives", true) + " " + productName
- }
- return productName
-}
-
-// Product generates product title as brand + product name
-func Product() string {
- return Brand() + " " + ProductName()
-}
-
-// Model generates model name that consists of letters and digits, optionally with a hyphen between them
-func Model() string {
- seps := []string{"", " ", "-"}
- return CharactersN(r.Intn(3)+1) + seps[r.Intn(len(seps))] + Digits()
-}
diff --git a/vendor/github.com/inconshreveable/mousetrap/LICENSE b/vendor/github.com/inconshreveable/mousetrap/LICENSE
deleted file mode 100644
index 5f0d1fb6a7bbfdb5f1af9c717888e59a0d146e26..0000000000000000000000000000000000000000
--- a/vendor/github.com/inconshreveable/mousetrap/LICENSE
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright 2014 Alan Shreve
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/vendor/github.com/inconshreveable/mousetrap/README.md b/vendor/github.com/inconshreveable/mousetrap/README.md
deleted file mode 100644
index 7a950d1774f06972b5641b456e6ce25f8a66259d..0000000000000000000000000000000000000000
--- a/vendor/github.com/inconshreveable/mousetrap/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# mousetrap
-
-mousetrap is a tiny library that answers a single question.
-
-On a Windows machine, was the process invoked by someone double clicking on
-the executable file while browsing in explorer?
-
-### Motivation
-
-Windows developers unfamiliar with command line tools will often "double-click"
-the executable for a tool. Because most CLI tools print the help and then exit
-when invoked without arguments, this is often very frustrating for those users.
-
-mousetrap provides a way to detect these invocations so that you can provide
-more helpful behavior and instructions on how to run the CLI tool. To see what
-this looks like, both from an organizational and a technical perspective, see
-https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/
-
-### The interface
-
-The library exposes a single interface:
-
- func StartedByExplorer() (bool)
diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_others.go b/vendor/github.com/inconshreveable/mousetrap/trap_others.go
deleted file mode 100644
index 9d2d8a4bab92ae5f97a305ca195aa23d8df1d41a..0000000000000000000000000000000000000000
--- a/vendor/github.com/inconshreveable/mousetrap/trap_others.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build !windows
-
-package mousetrap
-
-// StartedByExplorer returns true if the program was invoked by the user
-// double-clicking on the executable from explorer.exe
-//
-// It is conservative and returns false if any of the internal calls fail.
-// It does not guarantee that the program was run from a terminal. It only can tell you
-// whether it was launched from explorer.exe
-//
-// On non-Windows platforms, it always returns false.
-func StartedByExplorer() bool {
- return false
-}
diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_windows.go b/vendor/github.com/inconshreveable/mousetrap/trap_windows.go
deleted file mode 100644
index 336142a5e3ec4c6cd2f5f3fb8706def45c758e88..0000000000000000000000000000000000000000
--- a/vendor/github.com/inconshreveable/mousetrap/trap_windows.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// +build windows
-// +build !go1.4
-
-package mousetrap
-
-import (
- "fmt"
- "os"
- "syscall"
- "unsafe"
-)
-
-const (
- // defined by the Win32 API
- th32cs_snapprocess uintptr = 0x2
-)
-
-var (
- kernel = syscall.MustLoadDLL("kernel32.dll")
- CreateToolhelp32Snapshot = kernel.MustFindProc("CreateToolhelp32Snapshot")
- Process32First = kernel.MustFindProc("Process32FirstW")
- Process32Next = kernel.MustFindProc("Process32NextW")
-)
-
-// ProcessEntry32 structure defined by the Win32 API
-type processEntry32 struct {
- dwSize uint32
- cntUsage uint32
- th32ProcessID uint32
- th32DefaultHeapID int
- th32ModuleID uint32
- cntThreads uint32
- th32ParentProcessID uint32
- pcPriClassBase int32
- dwFlags uint32
- szExeFile [syscall.MAX_PATH]uint16
-}
-
-func getProcessEntry(pid int) (pe *processEntry32, err error) {
- snapshot, _, e1 := CreateToolhelp32Snapshot.Call(th32cs_snapprocess, uintptr(0))
- if snapshot == uintptr(syscall.InvalidHandle) {
- err = fmt.Errorf("CreateToolhelp32Snapshot: %v", e1)
- return
- }
- defer syscall.CloseHandle(syscall.Handle(snapshot))
-
- var processEntry processEntry32
- processEntry.dwSize = uint32(unsafe.Sizeof(processEntry))
- ok, _, e1 := Process32First.Call(snapshot, uintptr(unsafe.Pointer(&processEntry)))
- if ok == 0 {
- err = fmt.Errorf("Process32First: %v", e1)
- return
- }
-
- for {
- if processEntry.th32ProcessID == uint32(pid) {
- pe = &processEntry
- return
- }
-
- ok, _, e1 = Process32Next.Call(snapshot, uintptr(unsafe.Pointer(&processEntry)))
- if ok == 0 {
- err = fmt.Errorf("Process32Next: %v", e1)
- return
- }
- }
-}
-
-func getppid() (pid int, err error) {
- pe, err := getProcessEntry(os.Getpid())
- if err != nil {
- return
- }
-
- pid = int(pe.th32ParentProcessID)
- return
-}
-
-// StartedByExplorer returns true if the program was invoked by the user double-clicking
-// on the executable from explorer.exe
-//
-// It is conservative and returns false if any of the internal calls fail.
-// It does not guarantee that the program was run from a terminal. It only can tell you
-// whether it was launched from explorer.exe
-func StartedByExplorer() bool {
- ppid, err := getppid()
- if err != nil {
- return false
- }
-
- pe, err := getProcessEntry(ppid)
- if err != nil {
- return false
- }
-
- name := syscall.UTF16ToString(pe.szExeFile[:])
- return name == "explorer.exe"
-}
diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go b/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go
deleted file mode 100644
index 9a28e57c3c30bd44ab31b5743cfc5178a6bc3a19..0000000000000000000000000000000000000000
--- a/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// +build windows
-// +build go1.4
-
-package mousetrap
-
-import (
- "os"
- "syscall"
- "unsafe"
-)
-
-func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) {
- snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0)
- if err != nil {
- return nil, err
- }
- defer syscall.CloseHandle(snapshot)
- var procEntry syscall.ProcessEntry32
- procEntry.Size = uint32(unsafe.Sizeof(procEntry))
- if err = syscall.Process32First(snapshot, &procEntry); err != nil {
- return nil, err
- }
- for {
- if procEntry.ProcessID == uint32(pid) {
- return &procEntry, nil
- }
- err = syscall.Process32Next(snapshot, &procEntry)
- if err != nil {
- return nil, err
- }
- }
-}
-
-// StartedByExplorer returns true if the program was invoked by the user double-clicking
-// on the executable from explorer.exe
-//
-// It is conservative and returns false if any of the internal calls fail.
-// It does not guarantee that the program was run from a terminal. It only can tell you
-// whether it was launched from explorer.exe
-func StartedByExplorer() bool {
- pe, err := getProcessEntry(os.Getppid())
- if err != nil {
- return false
- }
- return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:])
-}
diff --git a/vendor/github.com/mattn/go-colorable/.travis.yml b/vendor/github.com/mattn/go-colorable/.travis.yml
deleted file mode 100644
index 98db8f060bdf273cfbe3df64ec7448aa19702ab5..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-colorable/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: go
-go:
- - tip
-
-before_install:
- - go get github.com/mattn/goveralls
- - go get golang.org/x/tools/cmd/cover
-script:
- - $HOME/gopath/bin/goveralls -repotoken xnXqRGwgW3SXIguzxf90ZSK1GPYZPaGrw
diff --git a/vendor/github.com/mattn/go-colorable/LICENSE b/vendor/github.com/mattn/go-colorable/LICENSE
deleted file mode 100644
index 91b5cef30ebdf08cb6efe669497a96f58c66035d..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-colorable/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Yasuhiro Matsumoto
-
-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/mattn/go-colorable/README.md b/vendor/github.com/mattn/go-colorable/README.md
deleted file mode 100644
index 56729a92ca627e3775b1b22d8bac67b1a5eb8aa5..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-colorable/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# go-colorable
-
-[](http://godoc.org/github.com/mattn/go-colorable)
-[](https://travis-ci.org/mattn/go-colorable)
-[](https://coveralls.io/github/mattn/go-colorable?branch=master)
-[](https://goreportcard.com/report/mattn/go-colorable)
-
-Colorable writer for windows.
-
-For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.)
-This package is possible to handle escape sequence for ansi color on windows.
-
-## Too Bad!
-
-
-
-
-## So Good!
-
-
-
-## Usage
-
-```go
-logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true})
-logrus.SetOutput(colorable.NewColorableStdout())
-
-logrus.Info("succeeded")
-logrus.Warn("not correct")
-logrus.Error("something error")
-logrus.Fatal("panic")
-```
-
-You can compile above code on non-windows OSs.
-
-## Installation
-
-```
-$ go get github.com/mattn/go-colorable
-```
-
-# License
-
-MIT
-
-# Author
-
-Yasuhiro Matsumoto (a.k.a mattn)
diff --git a/vendor/github.com/mattn/go-colorable/colorable_appengine.go b/vendor/github.com/mattn/go-colorable/colorable_appengine.go
deleted file mode 100644
index 1f28d773d748ab9451a5a12b07c407be09466a90..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-colorable/colorable_appengine.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// +build appengine
-
-package colorable
-
-import (
- "io"
- "os"
-
- _ "github.com/mattn/go-isatty"
-)
-
-// NewColorable return new instance of Writer which handle escape sequence.
-func NewColorable(file *os.File) io.Writer {
- if file == nil {
- panic("nil passed instead of *os.File to NewColorable()")
- }
-
- return file
-}
-
-// NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
-func NewColorableStdout() io.Writer {
- return os.Stdout
-}
-
-// NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
-func NewColorableStderr() io.Writer {
- return os.Stderr
-}
diff --git a/vendor/github.com/mattn/go-colorable/colorable_others.go b/vendor/github.com/mattn/go-colorable/colorable_others.go
deleted file mode 100644
index 887f203dc7faaad4ab0ca4fb3f383c2a517089ba..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-colorable/colorable_others.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// +build !windows
-// +build !appengine
-
-package colorable
-
-import (
- "io"
- "os"
-
- _ "github.com/mattn/go-isatty"
-)
-
-// NewColorable return new instance of Writer which handle escape sequence.
-func NewColorable(file *os.File) io.Writer {
- if file == nil {
- panic("nil passed instead of *os.File to NewColorable()")
- }
-
- return file
-}
-
-// NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
-func NewColorableStdout() io.Writer {
- return os.Stdout
-}
-
-// NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
-func NewColorableStderr() io.Writer {
- return os.Stderr
-}
diff --git a/vendor/github.com/mattn/go-colorable/colorable_windows.go b/vendor/github.com/mattn/go-colorable/colorable_windows.go
deleted file mode 100644
index e17a5474e987f37416597004e01e23e3d770688f..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-colorable/colorable_windows.go
+++ /dev/null
@@ -1,884 +0,0 @@
-// +build windows
-// +build !appengine
-
-package colorable
-
-import (
- "bytes"
- "io"
- "math"
- "os"
- "strconv"
- "strings"
- "syscall"
- "unsafe"
-
- "github.com/mattn/go-isatty"
-)
-
-const (
- foregroundBlue = 0x1
- foregroundGreen = 0x2
- foregroundRed = 0x4
- foregroundIntensity = 0x8
- foregroundMask = (foregroundRed | foregroundBlue | foregroundGreen | foregroundIntensity)
- backgroundBlue = 0x10
- backgroundGreen = 0x20
- backgroundRed = 0x40
- backgroundIntensity = 0x80
- backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity)
-)
-
-type wchar uint16
-type short int16
-type dword uint32
-type word uint16
-
-type coord struct {
- x short
- y short
-}
-
-type smallRect struct {
- left short
- top short
- right short
- bottom short
-}
-
-type consoleScreenBufferInfo struct {
- size coord
- cursorPosition coord
- attributes word
- window smallRect
- maximumWindowSize coord
-}
-
-type consoleCursorInfo struct {
- size dword
- visible int32
-}
-
-var (
- kernel32 = syscall.NewLazyDLL("kernel32.dll")
- procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
- procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute")
- procSetConsoleCursorPosition = kernel32.NewProc("SetConsoleCursorPosition")
- procFillConsoleOutputCharacter = kernel32.NewProc("FillConsoleOutputCharacterW")
- procFillConsoleOutputAttribute = kernel32.NewProc("FillConsoleOutputAttribute")
- procGetConsoleCursorInfo = kernel32.NewProc("GetConsoleCursorInfo")
- procSetConsoleCursorInfo = kernel32.NewProc("SetConsoleCursorInfo")
- procSetConsoleTitle = kernel32.NewProc("SetConsoleTitleW")
-)
-
-// Writer provide colorable Writer to the console
-type Writer struct {
- out io.Writer
- handle syscall.Handle
- oldattr word
- oldpos coord
-}
-
-// NewColorable return new instance of Writer which handle escape sequence from File.
-func NewColorable(file *os.File) io.Writer {
- if file == nil {
- panic("nil passed instead of *os.File to NewColorable()")
- }
-
- if isatty.IsTerminal(file.Fd()) {
- var csbi consoleScreenBufferInfo
- handle := syscall.Handle(file.Fd())
- procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
- return &Writer{out: file, handle: handle, oldattr: csbi.attributes, oldpos: coord{0, 0}}
- }
- return file
-}
-
-// NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
-func NewColorableStdout() io.Writer {
- return NewColorable(os.Stdout)
-}
-
-// NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
-func NewColorableStderr() io.Writer {
- return NewColorable(os.Stderr)
-}
-
-var color256 = map[int]int{
- 0: 0x000000,
- 1: 0x800000,
- 2: 0x008000,
- 3: 0x808000,
- 4: 0x000080,
- 5: 0x800080,
- 6: 0x008080,
- 7: 0xc0c0c0,
- 8: 0x808080,
- 9: 0xff0000,
- 10: 0x00ff00,
- 11: 0xffff00,
- 12: 0x0000ff,
- 13: 0xff00ff,
- 14: 0x00ffff,
- 15: 0xffffff,
- 16: 0x000000,
- 17: 0x00005f,
- 18: 0x000087,
- 19: 0x0000af,
- 20: 0x0000d7,
- 21: 0x0000ff,
- 22: 0x005f00,
- 23: 0x005f5f,
- 24: 0x005f87,
- 25: 0x005faf,
- 26: 0x005fd7,
- 27: 0x005fff,
- 28: 0x008700,
- 29: 0x00875f,
- 30: 0x008787,
- 31: 0x0087af,
- 32: 0x0087d7,
- 33: 0x0087ff,
- 34: 0x00af00,
- 35: 0x00af5f,
- 36: 0x00af87,
- 37: 0x00afaf,
- 38: 0x00afd7,
- 39: 0x00afff,
- 40: 0x00d700,
- 41: 0x00d75f,
- 42: 0x00d787,
- 43: 0x00d7af,
- 44: 0x00d7d7,
- 45: 0x00d7ff,
- 46: 0x00ff00,
- 47: 0x00ff5f,
- 48: 0x00ff87,
- 49: 0x00ffaf,
- 50: 0x00ffd7,
- 51: 0x00ffff,
- 52: 0x5f0000,
- 53: 0x5f005f,
- 54: 0x5f0087,
- 55: 0x5f00af,
- 56: 0x5f00d7,
- 57: 0x5f00ff,
- 58: 0x5f5f00,
- 59: 0x5f5f5f,
- 60: 0x5f5f87,
- 61: 0x5f5faf,
- 62: 0x5f5fd7,
- 63: 0x5f5fff,
- 64: 0x5f8700,
- 65: 0x5f875f,
- 66: 0x5f8787,
- 67: 0x5f87af,
- 68: 0x5f87d7,
- 69: 0x5f87ff,
- 70: 0x5faf00,
- 71: 0x5faf5f,
- 72: 0x5faf87,
- 73: 0x5fafaf,
- 74: 0x5fafd7,
- 75: 0x5fafff,
- 76: 0x5fd700,
- 77: 0x5fd75f,
- 78: 0x5fd787,
- 79: 0x5fd7af,
- 80: 0x5fd7d7,
- 81: 0x5fd7ff,
- 82: 0x5fff00,
- 83: 0x5fff5f,
- 84: 0x5fff87,
- 85: 0x5fffaf,
- 86: 0x5fffd7,
- 87: 0x5fffff,
- 88: 0x870000,
- 89: 0x87005f,
- 90: 0x870087,
- 91: 0x8700af,
- 92: 0x8700d7,
- 93: 0x8700ff,
- 94: 0x875f00,
- 95: 0x875f5f,
- 96: 0x875f87,
- 97: 0x875faf,
- 98: 0x875fd7,
- 99: 0x875fff,
- 100: 0x878700,
- 101: 0x87875f,
- 102: 0x878787,
- 103: 0x8787af,
- 104: 0x8787d7,
- 105: 0x8787ff,
- 106: 0x87af00,
- 107: 0x87af5f,
- 108: 0x87af87,
- 109: 0x87afaf,
- 110: 0x87afd7,
- 111: 0x87afff,
- 112: 0x87d700,
- 113: 0x87d75f,
- 114: 0x87d787,
- 115: 0x87d7af,
- 116: 0x87d7d7,
- 117: 0x87d7ff,
- 118: 0x87ff00,
- 119: 0x87ff5f,
- 120: 0x87ff87,
- 121: 0x87ffaf,
- 122: 0x87ffd7,
- 123: 0x87ffff,
- 124: 0xaf0000,
- 125: 0xaf005f,
- 126: 0xaf0087,
- 127: 0xaf00af,
- 128: 0xaf00d7,
- 129: 0xaf00ff,
- 130: 0xaf5f00,
- 131: 0xaf5f5f,
- 132: 0xaf5f87,
- 133: 0xaf5faf,
- 134: 0xaf5fd7,
- 135: 0xaf5fff,
- 136: 0xaf8700,
- 137: 0xaf875f,
- 138: 0xaf8787,
- 139: 0xaf87af,
- 140: 0xaf87d7,
- 141: 0xaf87ff,
- 142: 0xafaf00,
- 143: 0xafaf5f,
- 144: 0xafaf87,
- 145: 0xafafaf,
- 146: 0xafafd7,
- 147: 0xafafff,
- 148: 0xafd700,
- 149: 0xafd75f,
- 150: 0xafd787,
- 151: 0xafd7af,
- 152: 0xafd7d7,
- 153: 0xafd7ff,
- 154: 0xafff00,
- 155: 0xafff5f,
- 156: 0xafff87,
- 157: 0xafffaf,
- 158: 0xafffd7,
- 159: 0xafffff,
- 160: 0xd70000,
- 161: 0xd7005f,
- 162: 0xd70087,
- 163: 0xd700af,
- 164: 0xd700d7,
- 165: 0xd700ff,
- 166: 0xd75f00,
- 167: 0xd75f5f,
- 168: 0xd75f87,
- 169: 0xd75faf,
- 170: 0xd75fd7,
- 171: 0xd75fff,
- 172: 0xd78700,
- 173: 0xd7875f,
- 174: 0xd78787,
- 175: 0xd787af,
- 176: 0xd787d7,
- 177: 0xd787ff,
- 178: 0xd7af00,
- 179: 0xd7af5f,
- 180: 0xd7af87,
- 181: 0xd7afaf,
- 182: 0xd7afd7,
- 183: 0xd7afff,
- 184: 0xd7d700,
- 185: 0xd7d75f,
- 186: 0xd7d787,
- 187: 0xd7d7af,
- 188: 0xd7d7d7,
- 189: 0xd7d7ff,
- 190: 0xd7ff00,
- 191: 0xd7ff5f,
- 192: 0xd7ff87,
- 193: 0xd7ffaf,
- 194: 0xd7ffd7,
- 195: 0xd7ffff,
- 196: 0xff0000,
- 197: 0xff005f,
- 198: 0xff0087,
- 199: 0xff00af,
- 200: 0xff00d7,
- 201: 0xff00ff,
- 202: 0xff5f00,
- 203: 0xff5f5f,
- 204: 0xff5f87,
- 205: 0xff5faf,
- 206: 0xff5fd7,
- 207: 0xff5fff,
- 208: 0xff8700,
- 209: 0xff875f,
- 210: 0xff8787,
- 211: 0xff87af,
- 212: 0xff87d7,
- 213: 0xff87ff,
- 214: 0xffaf00,
- 215: 0xffaf5f,
- 216: 0xffaf87,
- 217: 0xffafaf,
- 218: 0xffafd7,
- 219: 0xffafff,
- 220: 0xffd700,
- 221: 0xffd75f,
- 222: 0xffd787,
- 223: 0xffd7af,
- 224: 0xffd7d7,
- 225: 0xffd7ff,
- 226: 0xffff00,
- 227: 0xffff5f,
- 228: 0xffff87,
- 229: 0xffffaf,
- 230: 0xffffd7,
- 231: 0xffffff,
- 232: 0x080808,
- 233: 0x121212,
- 234: 0x1c1c1c,
- 235: 0x262626,
- 236: 0x303030,
- 237: 0x3a3a3a,
- 238: 0x444444,
- 239: 0x4e4e4e,
- 240: 0x585858,
- 241: 0x626262,
- 242: 0x6c6c6c,
- 243: 0x767676,
- 244: 0x808080,
- 245: 0x8a8a8a,
- 246: 0x949494,
- 247: 0x9e9e9e,
- 248: 0xa8a8a8,
- 249: 0xb2b2b2,
- 250: 0xbcbcbc,
- 251: 0xc6c6c6,
- 252: 0xd0d0d0,
- 253: 0xdadada,
- 254: 0xe4e4e4,
- 255: 0xeeeeee,
-}
-
-// `\033]0;TITLESTR\007`
-func doTitleSequence(er *bytes.Reader) error {
- var c byte
- var err error
-
- c, err = er.ReadByte()
- if err != nil {
- return err
- }
- if c != '0' && c != '2' {
- return nil
- }
- c, err = er.ReadByte()
- if err != nil {
- return err
- }
- if c != ';' {
- return nil
- }
- title := make([]byte, 0, 80)
- for {
- c, err = er.ReadByte()
- if err != nil {
- return err
- }
- if c == 0x07 || c == '\n' {
- break
- }
- title = append(title, c)
- }
- if len(title) > 0 {
- title8, err := syscall.UTF16PtrFromString(string(title))
- if err == nil {
- procSetConsoleTitle.Call(uintptr(unsafe.Pointer(title8)))
- }
- }
- return nil
-}
-
-// Write write data on console
-func (w *Writer) Write(data []byte) (n int, err error) {
- var csbi consoleScreenBufferInfo
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
-
- er := bytes.NewReader(data)
- var bw [1]byte
-loop:
- for {
- c1, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if c1 != 0x1b {
- bw[0] = c1
- w.out.Write(bw[:])
- continue
- }
- c2, err := er.ReadByte()
- if err != nil {
- break loop
- }
-
- if c2 == ']' {
- if err := doTitleSequence(er); err != nil {
- break loop
- }
- continue
- }
- if c2 != 0x5b {
- continue
- }
-
- var buf bytes.Buffer
- var m byte
- for {
- c, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' {
- m = c
- break
- }
- buf.Write([]byte(string(c)))
- }
-
- switch m {
- case 'A':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.y -= short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'B':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.y += short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'C':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x += short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'D':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x -= short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'E':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x = 0
- csbi.cursorPosition.y += short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'F':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x = 0
- csbi.cursorPosition.y -= short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'G':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x = short(n - 1)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'H', 'f':
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- if buf.Len() > 0 {
- token := strings.Split(buf.String(), ";")
- switch len(token) {
- case 1:
- n1, err := strconv.Atoi(token[0])
- if err != nil {
- continue
- }
- csbi.cursorPosition.y = short(n1 - 1)
- case 2:
- n1, err := strconv.Atoi(token[0])
- if err != nil {
- continue
- }
- n2, err := strconv.Atoi(token[1])
- if err != nil {
- continue
- }
- csbi.cursorPosition.x = short(n2 - 1)
- csbi.cursorPosition.y = short(n1 - 1)
- }
- } else {
- csbi.cursorPosition.y = 0
- }
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'J':
- n := 0
- if buf.Len() > 0 {
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- }
- var count, written dword
- var cursor coord
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- switch n {
- case 0:
- cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y}
- count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.size.y-csbi.cursorPosition.y)*csbi.size.x)
- case 1:
- cursor = coord{x: csbi.window.left, y: csbi.window.top}
- count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.window.top-csbi.cursorPosition.y)*csbi.size.x)
- case 2:
- cursor = coord{x: csbi.window.left, y: csbi.window.top}
- count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.size.y-csbi.cursorPosition.y)*csbi.size.x)
- }
- procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
- procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
- case 'K':
- n := 0
- if buf.Len() > 0 {
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- var cursor coord
- var count, written dword
- switch n {
- case 0:
- cursor = coord{x: csbi.cursorPosition.x + 1, y: csbi.cursorPosition.y}
- count = dword(csbi.size.x - csbi.cursorPosition.x - 1)
- case 1:
- cursor = coord{x: csbi.window.left, y: csbi.window.top + csbi.cursorPosition.y}
- count = dword(csbi.size.x - csbi.cursorPosition.x)
- case 2:
- cursor = coord{x: csbi.window.left, y: csbi.window.top + csbi.cursorPosition.y}
- count = dword(csbi.size.x)
- }
- procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
- procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
- case 'm':
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- attr := csbi.attributes
- cs := buf.String()
- if cs == "" {
- procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(w.oldattr))
- continue
- }
- token := strings.Split(cs, ";")
- for i := 0; i < len(token); i++ {
- ns := token[i]
- if n, err = strconv.Atoi(ns); err == nil {
- switch {
- case n == 0 || n == 100:
- attr = w.oldattr
- case 1 <= n && n <= 5:
- attr |= foregroundIntensity
- case n == 7:
- attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4)
- case n == 22 || n == 25:
- attr |= foregroundIntensity
- case n == 27:
- attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4)
- case 30 <= n && n <= 37:
- attr &= backgroundMask
- if (n-30)&1 != 0 {
- attr |= foregroundRed
- }
- if (n-30)&2 != 0 {
- attr |= foregroundGreen
- }
- if (n-30)&4 != 0 {
- attr |= foregroundBlue
- }
- case n == 38: // set foreground color.
- if i < len(token)-2 && (token[i+1] == "5" || token[i+1] == "05") {
- if n256, err := strconv.Atoi(token[i+2]); err == nil {
- if n256foreAttr == nil {
- n256setup()
- }
- attr &= backgroundMask
- attr |= n256foreAttr[n256]
- i += 2
- }
- } else {
- attr = attr & (w.oldattr & backgroundMask)
- }
- case n == 39: // reset foreground color.
- attr &= backgroundMask
- attr |= w.oldattr & foregroundMask
- case 40 <= n && n <= 47:
- attr &= foregroundMask
- if (n-40)&1 != 0 {
- attr |= backgroundRed
- }
- if (n-40)&2 != 0 {
- attr |= backgroundGreen
- }
- if (n-40)&4 != 0 {
- attr |= backgroundBlue
- }
- case n == 48: // set background color.
- if i < len(token)-2 && token[i+1] == "5" {
- if n256, err := strconv.Atoi(token[i+2]); err == nil {
- if n256backAttr == nil {
- n256setup()
- }
- attr &= foregroundMask
- attr |= n256backAttr[n256]
- i += 2
- }
- } else {
- attr = attr & (w.oldattr & foregroundMask)
- }
- case n == 49: // reset foreground color.
- attr &= foregroundMask
- attr |= w.oldattr & backgroundMask
- case 90 <= n && n <= 97:
- attr = (attr & backgroundMask)
- attr |= foregroundIntensity
- if (n-90)&1 != 0 {
- attr |= foregroundRed
- }
- if (n-90)&2 != 0 {
- attr |= foregroundGreen
- }
- if (n-90)&4 != 0 {
- attr |= foregroundBlue
- }
- case 100 <= n && n <= 107:
- attr = (attr & foregroundMask)
- attr |= backgroundIntensity
- if (n-100)&1 != 0 {
- attr |= backgroundRed
- }
- if (n-100)&2 != 0 {
- attr |= backgroundGreen
- }
- if (n-100)&4 != 0 {
- attr |= backgroundBlue
- }
- }
- procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(attr))
- }
- }
- case 'h':
- var ci consoleCursorInfo
- cs := buf.String()
- if cs == "5>" {
- procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- ci.visible = 0
- procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- } else if cs == "?25" {
- procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- ci.visible = 1
- procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- }
- case 'l':
- var ci consoleCursorInfo
- cs := buf.String()
- if cs == "5>" {
- procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- ci.visible = 1
- procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- } else if cs == "?25" {
- procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- ci.visible = 0
- procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- }
- case 's':
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- w.oldpos = csbi.cursorPosition
- case 'u':
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&w.oldpos)))
- }
- }
-
- return len(data), nil
-}
-
-type consoleColor struct {
- rgb int
- red bool
- green bool
- blue bool
- intensity bool
-}
-
-func (c consoleColor) foregroundAttr() (attr word) {
- if c.red {
- attr |= foregroundRed
- }
- if c.green {
- attr |= foregroundGreen
- }
- if c.blue {
- attr |= foregroundBlue
- }
- if c.intensity {
- attr |= foregroundIntensity
- }
- return
-}
-
-func (c consoleColor) backgroundAttr() (attr word) {
- if c.red {
- attr |= backgroundRed
- }
- if c.green {
- attr |= backgroundGreen
- }
- if c.blue {
- attr |= backgroundBlue
- }
- if c.intensity {
- attr |= backgroundIntensity
- }
- return
-}
-
-var color16 = []consoleColor{
- {0x000000, false, false, false, false},
- {0x000080, false, false, true, false},
- {0x008000, false, true, false, false},
- {0x008080, false, true, true, false},
- {0x800000, true, false, false, false},
- {0x800080, true, false, true, false},
- {0x808000, true, true, false, false},
- {0xc0c0c0, true, true, true, false},
- {0x808080, false, false, false, true},
- {0x0000ff, false, false, true, true},
- {0x00ff00, false, true, false, true},
- {0x00ffff, false, true, true, true},
- {0xff0000, true, false, false, true},
- {0xff00ff, true, false, true, true},
- {0xffff00, true, true, false, true},
- {0xffffff, true, true, true, true},
-}
-
-type hsv struct {
- h, s, v float32
-}
-
-func (a hsv) dist(b hsv) float32 {
- dh := a.h - b.h
- switch {
- case dh > 0.5:
- dh = 1 - dh
- case dh < -0.5:
- dh = -1 - dh
- }
- ds := a.s - b.s
- dv := a.v - b.v
- return float32(math.Sqrt(float64(dh*dh + ds*ds + dv*dv)))
-}
-
-func toHSV(rgb int) hsv {
- r, g, b := float32((rgb&0xFF0000)>>16)/256.0,
- float32((rgb&0x00FF00)>>8)/256.0,
- float32(rgb&0x0000FF)/256.0
- min, max := minmax3f(r, g, b)
- h := max - min
- if h > 0 {
- if max == r {
- h = (g - b) / h
- if h < 0 {
- h += 6
- }
- } else if max == g {
- h = 2 + (b-r)/h
- } else {
- h = 4 + (r-g)/h
- }
- }
- h /= 6.0
- s := max - min
- if max != 0 {
- s /= max
- }
- v := max
- return hsv{h: h, s: s, v: v}
-}
-
-type hsvTable []hsv
-
-func toHSVTable(rgbTable []consoleColor) hsvTable {
- t := make(hsvTable, len(rgbTable))
- for i, c := range rgbTable {
- t[i] = toHSV(c.rgb)
- }
- return t
-}
-
-func (t hsvTable) find(rgb int) consoleColor {
- hsv := toHSV(rgb)
- n := 7
- l := float32(5.0)
- for i, p := range t {
- d := hsv.dist(p)
- if d < l {
- l, n = d, i
- }
- }
- return color16[n]
-}
-
-func minmax3f(a, b, c float32) (min, max float32) {
- if a < b {
- if b < c {
- return a, c
- } else if a < c {
- return a, b
- } else {
- return c, b
- }
- } else {
- if a < c {
- return b, c
- } else if b < c {
- return b, a
- } else {
- return c, a
- }
- }
-}
-
-var n256foreAttr []word
-var n256backAttr []word
-
-func n256setup() {
- n256foreAttr = make([]word, 256)
- n256backAttr = make([]word, 256)
- t := toHSVTable(color16)
- for i, rgb := range color256 {
- c := t.find(rgb)
- n256foreAttr[i] = c.foregroundAttr()
- n256backAttr[i] = c.backgroundAttr()
- }
-}
diff --git a/vendor/github.com/mattn/go-colorable/noncolorable.go b/vendor/github.com/mattn/go-colorable/noncolorable.go
deleted file mode 100644
index 9721e16f4bf4b6131fdd1050add2e0456304916c..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-colorable/noncolorable.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package colorable
-
-import (
- "bytes"
- "io"
-)
-
-// NonColorable hold writer but remove escape sequence.
-type NonColorable struct {
- out io.Writer
-}
-
-// NewNonColorable return new instance of Writer which remove escape sequence from Writer.
-func NewNonColorable(w io.Writer) io.Writer {
- return &NonColorable{out: w}
-}
-
-// Write write data on console
-func (w *NonColorable) Write(data []byte) (n int, err error) {
- er := bytes.NewReader(data)
- var bw [1]byte
-loop:
- for {
- c1, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if c1 != 0x1b {
- bw[0] = c1
- w.out.Write(bw[:])
- continue
- }
- c2, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if c2 != 0x5b {
- continue
- }
-
- var buf bytes.Buffer
- for {
- c, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' {
- break
- }
- buf.Write([]byte(string(c)))
- }
- }
-
- return len(data), nil
-}
diff --git a/vendor/github.com/mattn/go-isatty/.travis.yml b/vendor/github.com/mattn/go-isatty/.travis.yml
deleted file mode 100644
index b9f8b239c091efffaefa879a273b4809ebb2aedc..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-isatty/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: go
-go:
- - tip
-
-before_install:
- - go get github.com/mattn/goveralls
- - go get golang.org/x/tools/cmd/cover
-script:
- - $HOME/gopath/bin/goveralls -repotoken 3gHdORO5k5ziZcWMBxnd9LrMZaJs8m9x5
diff --git a/vendor/github.com/mattn/go-isatty/LICENSE b/vendor/github.com/mattn/go-isatty/LICENSE
deleted file mode 100644
index 65dc692b6b171e95c7e7698674ebaf8524dcd0d6..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-isatty/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-Copyright (c) Yasuhiro MATSUMOTO
-
-MIT License (Expat)
-
-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/mattn/go-isatty/README.md b/vendor/github.com/mattn/go-isatty/README.md
deleted file mode 100644
index 1e69004bb0391d8bdc8ef722afd3e3e339461400..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-isatty/README.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# go-isatty
-
-[](http://godoc.org/github.com/mattn/go-isatty)
-[](https://travis-ci.org/mattn/go-isatty)
-[](https://coveralls.io/github/mattn/go-isatty?branch=master)
-[](https://goreportcard.com/report/mattn/go-isatty)
-
-isatty for golang
-
-## Usage
-
-```go
-package main
-
-import (
- "fmt"
- "github.com/mattn/go-isatty"
- "os"
-)
-
-func main() {
- if isatty.IsTerminal(os.Stdout.Fd()) {
- fmt.Println("Is Terminal")
- } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) {
- fmt.Println("Is Cygwin/MSYS2 Terminal")
- } else {
- fmt.Println("Is Not Terminal")
- }
-}
-```
-
-## Installation
-
-```
-$ go get github.com/mattn/go-isatty
-```
-
-## License
-
-MIT
-
-## Author
-
-Yasuhiro Matsumoto (a.k.a mattn)
-
-## Thanks
-
-* k-takata: base idea for IsCygwinTerminal
-
- https://github.com/k-takata/go-iscygpty
diff --git a/vendor/github.com/mattn/go-isatty/doc.go b/vendor/github.com/mattn/go-isatty/doc.go
deleted file mode 100644
index 17d4f90ebcc7ee53452303f1c86d41eca5e13fc5..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-isatty/doc.go
+++ /dev/null
@@ -1,2 +0,0 @@
-// Package isatty implements interface to isatty
-package isatty
diff --git a/vendor/github.com/mattn/go-isatty/isatty_appengine.go b/vendor/github.com/mattn/go-isatty/isatty_appengine.go
deleted file mode 100644
index 9584a98842eea7bacb65a94a12a9efa6b1fac692..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-isatty/isatty_appengine.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build appengine
-
-package isatty
-
-// IsTerminal returns true if the file descriptor is terminal which
-// is always false on on appengine classic which is a sandboxed PaaS.
-func IsTerminal(fd uintptr) bool {
- return false
-}
-
-// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
-// terminal. This is also always false on this environment.
-func IsCygwinTerminal(fd uintptr) bool {
- return false
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_bsd.go b/vendor/github.com/mattn/go-isatty/isatty_bsd.go
deleted file mode 100644
index 42f2514d1338e43fef753492e70c99460d8ce7e3..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-isatty/isatty_bsd.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build darwin freebsd openbsd netbsd dragonfly
-// +build !appengine
-
-package isatty
-
-import (
- "syscall"
- "unsafe"
-)
-
-const ioctlReadTermios = syscall.TIOCGETA
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var termios syscall.Termios
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
- return err == 0
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_linux.go b/vendor/github.com/mattn/go-isatty/isatty_linux.go
deleted file mode 100644
index 7384cf99167bf3083722e421dc3d0edc864eb121..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-isatty/isatty_linux.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build linux
-// +build !appengine,!ppc64,!ppc64le
-
-package isatty
-
-import (
- "syscall"
- "unsafe"
-)
-
-const ioctlReadTermios = syscall.TCGETS
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var termios syscall.Termios
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
- return err == 0
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go b/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go
deleted file mode 100644
index 44e5d213021a7f1201e4e6dd0b1ecf1b5ec1f9f9..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build linux
-// +build ppc64 ppc64le
-
-package isatty
-
-import (
- "unsafe"
-
- syscall "golang.org/x/sys/unix"
-)
-
-const ioctlReadTermios = syscall.TCGETS
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var termios syscall.Termios
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
- return err == 0
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_others.go b/vendor/github.com/mattn/go-isatty/isatty_others.go
deleted file mode 100644
index ff4de3d9a534b21b91205b8c38135715788ae3a9..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-isatty/isatty_others.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// +build !windows
-// +build !appengine
-
-package isatty
-
-// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
-// terminal. This is also always false on this environment.
-func IsCygwinTerminal(fd uintptr) bool {
- return false
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_solaris.go b/vendor/github.com/mattn/go-isatty/isatty_solaris.go
deleted file mode 100644
index 1f0c6bf53dceae4332245f746ee401dce78c3edf..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-isatty/isatty_solaris.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build solaris
-// +build !appengine
-
-package isatty
-
-import (
- "golang.org/x/sys/unix"
-)
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-// see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c
-func IsTerminal(fd uintptr) bool {
- var termio unix.Termio
- err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio)
- return err == nil
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_windows.go b/vendor/github.com/mattn/go-isatty/isatty_windows.go
deleted file mode 100644
index af51cbcaa4853196e055d1ca1c2eb34a440b6918..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-isatty/isatty_windows.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// +build windows
-// +build !appengine
-
-package isatty
-
-import (
- "strings"
- "syscall"
- "unicode/utf16"
- "unsafe"
-)
-
-const (
- fileNameInfo uintptr = 2
- fileTypePipe = 3
-)
-
-var (
- kernel32 = syscall.NewLazyDLL("kernel32.dll")
- procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
- procGetFileInformationByHandleEx = kernel32.NewProc("GetFileInformationByHandleEx")
- procGetFileType = kernel32.NewProc("GetFileType")
-)
-
-func init() {
- // Check if GetFileInformationByHandleEx is available.
- if procGetFileInformationByHandleEx.Find() != nil {
- procGetFileInformationByHandleEx = nil
- }
-}
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var st uint32
- r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0)
- return r != 0 && e == 0
-}
-
-// Check pipe name is used for cygwin/msys2 pty.
-// Cygwin/MSYS2 PTY has a name like:
-// \{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master
-func isCygwinPipeName(name string) bool {
- token := strings.Split(name, "-")
- if len(token) < 5 {
- return false
- }
-
- if token[0] != `\msys` && token[0] != `\cygwin` {
- return false
- }
-
- if token[1] == "" {
- return false
- }
-
- if !strings.HasPrefix(token[2], "pty") {
- return false
- }
-
- if token[3] != `from` && token[3] != `to` {
- return false
- }
-
- if token[4] != "master" {
- return false
- }
-
- return true
-}
-
-// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
-// terminal.
-func IsCygwinTerminal(fd uintptr) bool {
- if procGetFileInformationByHandleEx == nil {
- return false
- }
-
- // Cygwin/msys's pty is a pipe.
- ft, _, e := syscall.Syscall(procGetFileType.Addr(), 1, fd, 0, 0)
- if ft != fileTypePipe || e != 0 {
- return false
- }
-
- var buf [2 + syscall.MAX_PATH]uint16
- r, _, e := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(),
- 4, fd, fileNameInfo, uintptr(unsafe.Pointer(&buf)),
- uintptr(len(buf)*2), 0, 0)
- if r == 0 || e != 0 {
- return false
- }
-
- l := *(*uint32)(unsafe.Pointer(&buf))
- return isCygwinPipeName(string(utf16.Decode(buf[2 : 2+l/2])))
-}
diff --git a/vendor/github.com/mattn/go-runewidth/.travis.yml b/vendor/github.com/mattn/go-runewidth/.travis.yml
deleted file mode 100644
index 5c9c2a30f07802ba4e00daca85d1643d7f2be868..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-runewidth/.travis.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-language: go
-go:
- - tip
-before_install:
- - go get github.com/mattn/goveralls
- - go get golang.org/x/tools/cmd/cover
-script:
- - $HOME/gopath/bin/goveralls -repotoken lAKAWPzcGsD3A8yBX3BGGtRUdJ6CaGERL
diff --git a/vendor/github.com/mattn/go-runewidth/LICENSE b/vendor/github.com/mattn/go-runewidth/LICENSE
deleted file mode 100644
index 91b5cef30ebdf08cb6efe669497a96f58c66035d..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-runewidth/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Yasuhiro Matsumoto
-
-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/mattn/go-runewidth/README.mkd b/vendor/github.com/mattn/go-runewidth/README.mkd
deleted file mode 100644
index 66663a94b0b4e080351c2e39e531336bb10b809c..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-runewidth/README.mkd
+++ /dev/null
@@ -1,27 +0,0 @@
-go-runewidth
-============
-
-[](https://travis-ci.org/mattn/go-runewidth)
-[](https://coveralls.io/r/mattn/go-runewidth?branch=HEAD)
-[](http://godoc.org/github.com/mattn/go-runewidth)
-[](https://goreportcard.com/report/github.com/mattn/go-runewidth)
-
-Provides functions to get fixed width of the character or string.
-
-Usage
------
-
-```go
-runewidth.StringWidth("つのだ☆HIRO") == 12
-```
-
-
-Author
-------
-
-Yasuhiro Matsumoto
-
-License
--------
-
-under the MIT License: http://mattn.mit-license.org/2013
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth.go b/vendor/github.com/mattn/go-runewidth/runewidth.go
deleted file mode 100644
index 2164497ad95e6d71bb0c6885bca93218e23238ea..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth.go
+++ /dev/null
@@ -1,1223 +0,0 @@
-package runewidth
-
-var (
- // EastAsianWidth will be set true if the current locale is CJK
- EastAsianWidth = IsEastAsian()
-
- // DefaultCondition is a condition in current locale
- DefaultCondition = &Condition{EastAsianWidth}
-)
-
-type interval struct {
- first rune
- last rune
-}
-
-type table []interval
-
-func inTables(r rune, ts ...table) bool {
- for _, t := range ts {
- if inTable(r, t) {
- return true
- }
- }
- return false
-}
-
-func inTable(r rune, t table) bool {
- // func (t table) IncludesRune(r rune) bool {
- if r < t[0].first {
- return false
- }
-
- bot := 0
- top := len(t) - 1
- for top >= bot {
- mid := (bot + top) / 2
-
- switch {
- case t[mid].last < r:
- bot = mid + 1
- case t[mid].first > r:
- top = mid - 1
- default:
- return true
- }
- }
-
- return false
-}
-
-var private = table{
- {0x00E000, 0x00F8FF}, {0x0F0000, 0x0FFFFD}, {0x100000, 0x10FFFD},
-}
-
-var nonprint = table{
- {0x0000, 0x001F}, {0x007F, 0x009F}, {0x00AD, 0x00AD},
- {0x070F, 0x070F}, {0x180B, 0x180E}, {0x200B, 0x200F},
- {0x202A, 0x202E}, {0x206A, 0x206F}, {0xD800, 0xDFFF},
- {0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFB}, {0xFFFE, 0xFFFF},
-}
-
-var combining = table{
- {0x0300, 0x036F}, {0x0483, 0x0489}, {0x0591, 0x05BD},
- {0x05BF, 0x05BF}, {0x05C1, 0x05C2}, {0x05C4, 0x05C5},
- {0x05C7, 0x05C7}, {0x0610, 0x061A}, {0x064B, 0x065F},
- {0x0670, 0x0670}, {0x06D6, 0x06DC}, {0x06DF, 0x06E4},
- {0x06E7, 0x06E8}, {0x06EA, 0x06ED}, {0x0711, 0x0711},
- {0x0730, 0x074A}, {0x07A6, 0x07B0}, {0x07EB, 0x07F3},
- {0x0816, 0x0819}, {0x081B, 0x0823}, {0x0825, 0x0827},
- {0x0829, 0x082D}, {0x0859, 0x085B}, {0x08D4, 0x08E1},
- {0x08E3, 0x0903}, {0x093A, 0x093C}, {0x093E, 0x094F},
- {0x0951, 0x0957}, {0x0962, 0x0963}, {0x0981, 0x0983},
- {0x09BC, 0x09BC}, {0x09BE, 0x09C4}, {0x09C7, 0x09C8},
- {0x09CB, 0x09CD}, {0x09D7, 0x09D7}, {0x09E2, 0x09E3},
- {0x0A01, 0x0A03}, {0x0A3C, 0x0A3C}, {0x0A3E, 0x0A42},
- {0x0A47, 0x0A48}, {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51},
- {0x0A70, 0x0A71}, {0x0A75, 0x0A75}, {0x0A81, 0x0A83},
- {0x0ABC, 0x0ABC}, {0x0ABE, 0x0AC5}, {0x0AC7, 0x0AC9},
- {0x0ACB, 0x0ACD}, {0x0AE2, 0x0AE3}, {0x0B01, 0x0B03},
- {0x0B3C, 0x0B3C}, {0x0B3E, 0x0B44}, {0x0B47, 0x0B48},
- {0x0B4B, 0x0B4D}, {0x0B56, 0x0B57}, {0x0B62, 0x0B63},
- {0x0B82, 0x0B82}, {0x0BBE, 0x0BC2}, {0x0BC6, 0x0BC8},
- {0x0BCA, 0x0BCD}, {0x0BD7, 0x0BD7}, {0x0C00, 0x0C03},
- {0x0C3E, 0x0C44}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D},
- {0x0C55, 0x0C56}, {0x0C62, 0x0C63}, {0x0C81, 0x0C83},
- {0x0CBC, 0x0CBC}, {0x0CBE, 0x0CC4}, {0x0CC6, 0x0CC8},
- {0x0CCA, 0x0CCD}, {0x0CD5, 0x0CD6}, {0x0CE2, 0x0CE3},
- {0x0D01, 0x0D03}, {0x0D3E, 0x0D44}, {0x0D46, 0x0D48},
- {0x0D4A, 0x0D4D}, {0x0D57, 0x0D57}, {0x0D62, 0x0D63},
- {0x0D82, 0x0D83}, {0x0DCA, 0x0DCA}, {0x0DCF, 0x0DD4},
- {0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF}, {0x0DF2, 0x0DF3},
- {0x0E31, 0x0E31}, {0x0E34, 0x0E3A}, {0x0E47, 0x0E4E},
- {0x0EB1, 0x0EB1}, {0x0EB4, 0x0EB9}, {0x0EBB, 0x0EBC},
- {0x0EC8, 0x0ECD}, {0x0F18, 0x0F19}, {0x0F35, 0x0F35},
- {0x0F37, 0x0F37}, {0x0F39, 0x0F39}, {0x0F3E, 0x0F3F},
- {0x0F71, 0x0F84}, {0x0F86, 0x0F87}, {0x0F8D, 0x0F97},
- {0x0F99, 0x0FBC}, {0x0FC6, 0x0FC6}, {0x102B, 0x103E},
- {0x1056, 0x1059}, {0x105E, 0x1060}, {0x1062, 0x1064},
- {0x1067, 0x106D}, {0x1071, 0x1074}, {0x1082, 0x108D},
- {0x108F, 0x108F}, {0x109A, 0x109D}, {0x135D, 0x135F},
- {0x1712, 0x1714}, {0x1732, 0x1734}, {0x1752, 0x1753},
- {0x1772, 0x1773}, {0x17B4, 0x17D3}, {0x17DD, 0x17DD},
- {0x180B, 0x180D}, {0x1885, 0x1886}, {0x18A9, 0x18A9},
- {0x1920, 0x192B}, {0x1930, 0x193B}, {0x1A17, 0x1A1B},
- {0x1A55, 0x1A5E}, {0x1A60, 0x1A7C}, {0x1A7F, 0x1A7F},
- {0x1AB0, 0x1ABE}, {0x1B00, 0x1B04}, {0x1B34, 0x1B44},
- {0x1B6B, 0x1B73}, {0x1B80, 0x1B82}, {0x1BA1, 0x1BAD},
- {0x1BE6, 0x1BF3}, {0x1C24, 0x1C37}, {0x1CD0, 0x1CD2},
- {0x1CD4, 0x1CE8}, {0x1CED, 0x1CED}, {0x1CF2, 0x1CF4},
- {0x1CF8, 0x1CF9}, {0x1DC0, 0x1DF5}, {0x1DFB, 0x1DFF},
- {0x20D0, 0x20F0}, {0x2CEF, 0x2CF1}, {0x2D7F, 0x2D7F},
- {0x2DE0, 0x2DFF}, {0x302A, 0x302F}, {0x3099, 0x309A},
- {0xA66F, 0xA672}, {0xA674, 0xA67D}, {0xA69E, 0xA69F},
- {0xA6F0, 0xA6F1}, {0xA802, 0xA802}, {0xA806, 0xA806},
- {0xA80B, 0xA80B}, {0xA823, 0xA827}, {0xA880, 0xA881},
- {0xA8B4, 0xA8C5}, {0xA8E0, 0xA8F1}, {0xA926, 0xA92D},
- {0xA947, 0xA953}, {0xA980, 0xA983}, {0xA9B3, 0xA9C0},
- {0xA9E5, 0xA9E5}, {0xAA29, 0xAA36}, {0xAA43, 0xAA43},
- {0xAA4C, 0xAA4D}, {0xAA7B, 0xAA7D}, {0xAAB0, 0xAAB0},
- {0xAAB2, 0xAAB4}, {0xAAB7, 0xAAB8}, {0xAABE, 0xAABF},
- {0xAAC1, 0xAAC1}, {0xAAEB, 0xAAEF}, {0xAAF5, 0xAAF6},
- {0xABE3, 0xABEA}, {0xABEC, 0xABED}, {0xFB1E, 0xFB1E},
- {0xFE00, 0xFE0F}, {0xFE20, 0xFE2F}, {0x101FD, 0x101FD},
- {0x102E0, 0x102E0}, {0x10376, 0x1037A}, {0x10A01, 0x10A03},
- {0x10A05, 0x10A06}, {0x10A0C, 0x10A0F}, {0x10A38, 0x10A3A},
- {0x10A3F, 0x10A3F}, {0x10AE5, 0x10AE6}, {0x11000, 0x11002},
- {0x11038, 0x11046}, {0x1107F, 0x11082}, {0x110B0, 0x110BA},
- {0x11100, 0x11102}, {0x11127, 0x11134}, {0x11173, 0x11173},
- {0x11180, 0x11182}, {0x111B3, 0x111C0}, {0x111CA, 0x111CC},
- {0x1122C, 0x11237}, {0x1123E, 0x1123E}, {0x112DF, 0x112EA},
- {0x11300, 0x11303}, {0x1133C, 0x1133C}, {0x1133E, 0x11344},
- {0x11347, 0x11348}, {0x1134B, 0x1134D}, {0x11357, 0x11357},
- {0x11362, 0x11363}, {0x11366, 0x1136C}, {0x11370, 0x11374},
- {0x11435, 0x11446}, {0x114B0, 0x114C3}, {0x115AF, 0x115B5},
- {0x115B8, 0x115C0}, {0x115DC, 0x115DD}, {0x11630, 0x11640},
- {0x116AB, 0x116B7}, {0x1171D, 0x1172B}, {0x11C2F, 0x11C36},
- {0x11C38, 0x11C3F}, {0x11C92, 0x11CA7}, {0x11CA9, 0x11CB6},
- {0x16AF0, 0x16AF4}, {0x16B30, 0x16B36}, {0x16F51, 0x16F7E},
- {0x16F8F, 0x16F92}, {0x1BC9D, 0x1BC9E}, {0x1D165, 0x1D169},
- {0x1D16D, 0x1D172}, {0x1D17B, 0x1D182}, {0x1D185, 0x1D18B},
- {0x1D1AA, 0x1D1AD}, {0x1D242, 0x1D244}, {0x1DA00, 0x1DA36},
- {0x1DA3B, 0x1DA6C}, {0x1DA75, 0x1DA75}, {0x1DA84, 0x1DA84},
- {0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF}, {0x1E000, 0x1E006},
- {0x1E008, 0x1E018}, {0x1E01B, 0x1E021}, {0x1E023, 0x1E024},
- {0x1E026, 0x1E02A}, {0x1E8D0, 0x1E8D6}, {0x1E944, 0x1E94A},
- {0xE0100, 0xE01EF},
-}
-
-var doublewidth = table{
- {0x1100, 0x115F}, {0x231A, 0x231B}, {0x2329, 0x232A},
- {0x23E9, 0x23EC}, {0x23F0, 0x23F0}, {0x23F3, 0x23F3},
- {0x25FD, 0x25FE}, {0x2614, 0x2615}, {0x2648, 0x2653},
- {0x267F, 0x267F}, {0x2693, 0x2693}, {0x26A1, 0x26A1},
- {0x26AA, 0x26AB}, {0x26BD, 0x26BE}, {0x26C4, 0x26C5},
- {0x26CE, 0x26CE}, {0x26D4, 0x26D4}, {0x26EA, 0x26EA},
- {0x26F2, 0x26F3}, {0x26F5, 0x26F5}, {0x26FA, 0x26FA},
- {0x26FD, 0x26FD}, {0x2705, 0x2705}, {0x270A, 0x270B},
- {0x2728, 0x2728}, {0x274C, 0x274C}, {0x274E, 0x274E},
- {0x2753, 0x2755}, {0x2757, 0x2757}, {0x2795, 0x2797},
- {0x27B0, 0x27B0}, {0x27BF, 0x27BF}, {0x2B1B, 0x2B1C},
- {0x2B50, 0x2B50}, {0x2B55, 0x2B55}, {0x2E80, 0x2E99},
- {0x2E9B, 0x2EF3}, {0x2F00, 0x2FD5}, {0x2FF0, 0x2FFB},
- {0x3000, 0x303E}, {0x3041, 0x3096}, {0x3099, 0x30FF},
- {0x3105, 0x312D}, {0x3131, 0x318E}, {0x3190, 0x31BA},
- {0x31C0, 0x31E3}, {0x31F0, 0x321E}, {0x3220, 0x3247},
- {0x3250, 0x32FE}, {0x3300, 0x4DBF}, {0x4E00, 0xA48C},
- {0xA490, 0xA4C6}, {0xA960, 0xA97C}, {0xAC00, 0xD7A3},
- {0xF900, 0xFAFF}, {0xFE10, 0xFE19}, {0xFE30, 0xFE52},
- {0xFE54, 0xFE66}, {0xFE68, 0xFE6B}, {0xFF01, 0xFF60},
- {0xFFE0, 0xFFE6}, {0x16FE0, 0x16FE0}, {0x17000, 0x187EC},
- {0x18800, 0x18AF2}, {0x1B000, 0x1B001}, {0x1F004, 0x1F004},
- {0x1F0CF, 0x1F0CF}, {0x1F18E, 0x1F18E}, {0x1F191, 0x1F19A},
- {0x1F200, 0x1F202}, {0x1F210, 0x1F23B}, {0x1F240, 0x1F248},
- {0x1F250, 0x1F251}, {0x1F300, 0x1F320}, {0x1F32D, 0x1F335},
- {0x1F337, 0x1F37C}, {0x1F37E, 0x1F393}, {0x1F3A0, 0x1F3CA},
- {0x1F3CF, 0x1F3D3}, {0x1F3E0, 0x1F3F0}, {0x1F3F4, 0x1F3F4},
- {0x1F3F8, 0x1F43E}, {0x1F440, 0x1F440}, {0x1F442, 0x1F4FC},
- {0x1F4FF, 0x1F53D}, {0x1F54B, 0x1F54E}, {0x1F550, 0x1F567},
- {0x1F57A, 0x1F57A}, {0x1F595, 0x1F596}, {0x1F5A4, 0x1F5A4},
- {0x1F5FB, 0x1F64F}, {0x1F680, 0x1F6C5}, {0x1F6CC, 0x1F6CC},
- {0x1F6D0, 0x1F6D2}, {0x1F6EB, 0x1F6EC}, {0x1F6F4, 0x1F6F6},
- {0x1F910, 0x1F91E}, {0x1F920, 0x1F927}, {0x1F930, 0x1F930},
- {0x1F933, 0x1F93E}, {0x1F940, 0x1F94B}, {0x1F950, 0x1F95E},
- {0x1F980, 0x1F991}, {0x1F9C0, 0x1F9C0}, {0x20000, 0x2FFFD},
- {0x30000, 0x3FFFD},
-}
-
-var ambiguous = table{
- {0x00A1, 0x00A1}, {0x00A4, 0x00A4}, {0x00A7, 0x00A8},
- {0x00AA, 0x00AA}, {0x00AD, 0x00AE}, {0x00B0, 0x00B4},
- {0x00B6, 0x00BA}, {0x00BC, 0x00BF}, {0x00C6, 0x00C6},
- {0x00D0, 0x00D0}, {0x00D7, 0x00D8}, {0x00DE, 0x00E1},
- {0x00E6, 0x00E6}, {0x00E8, 0x00EA}, {0x00EC, 0x00ED},
- {0x00F0, 0x00F0}, {0x00F2, 0x00F3}, {0x00F7, 0x00FA},
- {0x00FC, 0x00FC}, {0x00FE, 0x00FE}, {0x0101, 0x0101},
- {0x0111, 0x0111}, {0x0113, 0x0113}, {0x011B, 0x011B},
- {0x0126, 0x0127}, {0x012B, 0x012B}, {0x0131, 0x0133},
- {0x0138, 0x0138}, {0x013F, 0x0142}, {0x0144, 0x0144},
- {0x0148, 0x014B}, {0x014D, 0x014D}, {0x0152, 0x0153},
- {0x0166, 0x0167}, {0x016B, 0x016B}, {0x01CE, 0x01CE},
- {0x01D0, 0x01D0}, {0x01D2, 0x01D2}, {0x01D4, 0x01D4},
- {0x01D6, 0x01D6}, {0x01D8, 0x01D8}, {0x01DA, 0x01DA},
- {0x01DC, 0x01DC}, {0x0251, 0x0251}, {0x0261, 0x0261},
- {0x02C4, 0x02C4}, {0x02C7, 0x02C7}, {0x02C9, 0x02CB},
- {0x02CD, 0x02CD}, {0x02D0, 0x02D0}, {0x02D8, 0x02DB},
- {0x02DD, 0x02DD}, {0x02DF, 0x02DF}, {0x0300, 0x036F},
- {0x0391, 0x03A1}, {0x03A3, 0x03A9}, {0x03B1, 0x03C1},
- {0x03C3, 0x03C9}, {0x0401, 0x0401}, {0x0410, 0x044F},
- {0x0451, 0x0451}, {0x2010, 0x2010}, {0x2013, 0x2016},
- {0x2018, 0x2019}, {0x201C, 0x201D}, {0x2020, 0x2022},
- {0x2024, 0x2027}, {0x2030, 0x2030}, {0x2032, 0x2033},
- {0x2035, 0x2035}, {0x203B, 0x203B}, {0x203E, 0x203E},
- {0x2074, 0x2074}, {0x207F, 0x207F}, {0x2081, 0x2084},
- {0x20AC, 0x20AC}, {0x2103, 0x2103}, {0x2105, 0x2105},
- {0x2109, 0x2109}, {0x2113, 0x2113}, {0x2116, 0x2116},
- {0x2121, 0x2122}, {0x2126, 0x2126}, {0x212B, 0x212B},
- {0x2153, 0x2154}, {0x215B, 0x215E}, {0x2160, 0x216B},
- {0x2170, 0x2179}, {0x2189, 0x2189}, {0x2190, 0x2199},
- {0x21B8, 0x21B9}, {0x21D2, 0x21D2}, {0x21D4, 0x21D4},
- {0x21E7, 0x21E7}, {0x2200, 0x2200}, {0x2202, 0x2203},
- {0x2207, 0x2208}, {0x220B, 0x220B}, {0x220F, 0x220F},
- {0x2211, 0x2211}, {0x2215, 0x2215}, {0x221A, 0x221A},
- {0x221D, 0x2220}, {0x2223, 0x2223}, {0x2225, 0x2225},
- {0x2227, 0x222C}, {0x222E, 0x222E}, {0x2234, 0x2237},
- {0x223C, 0x223D}, {0x2248, 0x2248}, {0x224C, 0x224C},
- {0x2252, 0x2252}, {0x2260, 0x2261}, {0x2264, 0x2267},
- {0x226A, 0x226B}, {0x226E, 0x226F}, {0x2282, 0x2283},
- {0x2286, 0x2287}, {0x2295, 0x2295}, {0x2299, 0x2299},
- {0x22A5, 0x22A5}, {0x22BF, 0x22BF}, {0x2312, 0x2312},
- {0x2460, 0x24E9}, {0x24EB, 0x254B}, {0x2550, 0x2573},
- {0x2580, 0x258F}, {0x2592, 0x2595}, {0x25A0, 0x25A1},
- {0x25A3, 0x25A9}, {0x25B2, 0x25B3}, {0x25B6, 0x25B7},
- {0x25BC, 0x25BD}, {0x25C0, 0x25C1}, {0x25C6, 0x25C8},
- {0x25CB, 0x25CB}, {0x25CE, 0x25D1}, {0x25E2, 0x25E5},
- {0x25EF, 0x25EF}, {0x2605, 0x2606}, {0x2609, 0x2609},
- {0x260E, 0x260F}, {0x261C, 0x261C}, {0x261E, 0x261E},
- {0x2640, 0x2640}, {0x2642, 0x2642}, {0x2660, 0x2661},
- {0x2663, 0x2665}, {0x2667, 0x266A}, {0x266C, 0x266D},
- {0x266F, 0x266F}, {0x269E, 0x269F}, {0x26BF, 0x26BF},
- {0x26C6, 0x26CD}, {0x26CF, 0x26D3}, {0x26D5, 0x26E1},
- {0x26E3, 0x26E3}, {0x26E8, 0x26E9}, {0x26EB, 0x26F1},
- {0x26F4, 0x26F4}, {0x26F6, 0x26F9}, {0x26FB, 0x26FC},
- {0x26FE, 0x26FF}, {0x273D, 0x273D}, {0x2776, 0x277F},
- {0x2B56, 0x2B59}, {0x3248, 0x324F}, {0xE000, 0xF8FF},
- {0xFE00, 0xFE0F}, {0xFFFD, 0xFFFD}, {0x1F100, 0x1F10A},
- {0x1F110, 0x1F12D}, {0x1F130, 0x1F169}, {0x1F170, 0x1F18D},
- {0x1F18F, 0x1F190}, {0x1F19B, 0x1F1AC}, {0xE0100, 0xE01EF},
- {0xF0000, 0xFFFFD}, {0x100000, 0x10FFFD},
-}
-
-var emoji = table{
- {0x1F1E6, 0x1F1FF}, {0x1F321, 0x1F321}, {0x1F324, 0x1F32C},
- {0x1F336, 0x1F336}, {0x1F37D, 0x1F37D}, {0x1F396, 0x1F397},
- {0x1F399, 0x1F39B}, {0x1F39E, 0x1F39F}, {0x1F3CB, 0x1F3CE},
- {0x1F3D4, 0x1F3DF}, {0x1F3F3, 0x1F3F5}, {0x1F3F7, 0x1F3F7},
- {0x1F43F, 0x1F43F}, {0x1F441, 0x1F441}, {0x1F4FD, 0x1F4FD},
- {0x1F549, 0x1F54A}, {0x1F56F, 0x1F570}, {0x1F573, 0x1F579},
- {0x1F587, 0x1F587}, {0x1F58A, 0x1F58D}, {0x1F590, 0x1F590},
- {0x1F5A5, 0x1F5A5}, {0x1F5A8, 0x1F5A8}, {0x1F5B1, 0x1F5B2},
- {0x1F5BC, 0x1F5BC}, {0x1F5C2, 0x1F5C4}, {0x1F5D1, 0x1F5D3},
- {0x1F5DC, 0x1F5DE}, {0x1F5E1, 0x1F5E1}, {0x1F5E3, 0x1F5E3},
- {0x1F5E8, 0x1F5E8}, {0x1F5EF, 0x1F5EF}, {0x1F5F3, 0x1F5F3},
- {0x1F5FA, 0x1F5FA}, {0x1F6CB, 0x1F6CF}, {0x1F6E0, 0x1F6E5},
- {0x1F6E9, 0x1F6E9}, {0x1F6F0, 0x1F6F0}, {0x1F6F3, 0x1F6F3},
-}
-
-var notassigned = table{
- {0x0378, 0x0379}, {0x0380, 0x0383}, {0x038B, 0x038B},
- {0x038D, 0x038D}, {0x03A2, 0x03A2}, {0x0530, 0x0530},
- {0x0557, 0x0558}, {0x0560, 0x0560}, {0x0588, 0x0588},
- {0x058B, 0x058C}, {0x0590, 0x0590}, {0x05C8, 0x05CF},
- {0x05EB, 0x05EF}, {0x05F5, 0x05FF}, {0x061D, 0x061D},
- {0x070E, 0x070E}, {0x074B, 0x074C}, {0x07B2, 0x07BF},
- {0x07FB, 0x07FF}, {0x082E, 0x082F}, {0x083F, 0x083F},
- {0x085C, 0x085D}, {0x085F, 0x089F}, {0x08B5, 0x08B5},
- {0x08BE, 0x08D3}, {0x0984, 0x0984}, {0x098D, 0x098E},
- {0x0991, 0x0992}, {0x09A9, 0x09A9}, {0x09B1, 0x09B1},
- {0x09B3, 0x09B5}, {0x09BA, 0x09BB}, {0x09C5, 0x09C6},
- {0x09C9, 0x09CA}, {0x09CF, 0x09D6}, {0x09D8, 0x09DB},
- {0x09DE, 0x09DE}, {0x09E4, 0x09E5}, {0x09FC, 0x0A00},
- {0x0A04, 0x0A04}, {0x0A0B, 0x0A0E}, {0x0A11, 0x0A12},
- {0x0A29, 0x0A29}, {0x0A31, 0x0A31}, {0x0A34, 0x0A34},
- {0x0A37, 0x0A37}, {0x0A3A, 0x0A3B}, {0x0A3D, 0x0A3D},
- {0x0A43, 0x0A46}, {0x0A49, 0x0A4A}, {0x0A4E, 0x0A50},
- {0x0A52, 0x0A58}, {0x0A5D, 0x0A5D}, {0x0A5F, 0x0A65},
- {0x0A76, 0x0A80}, {0x0A84, 0x0A84}, {0x0A8E, 0x0A8E},
- {0x0A92, 0x0A92}, {0x0AA9, 0x0AA9}, {0x0AB1, 0x0AB1},
- {0x0AB4, 0x0AB4}, {0x0ABA, 0x0ABB}, {0x0AC6, 0x0AC6},
- {0x0ACA, 0x0ACA}, {0x0ACE, 0x0ACF}, {0x0AD1, 0x0ADF},
- {0x0AE4, 0x0AE5}, {0x0AF2, 0x0AF8}, {0x0AFA, 0x0B00},
- {0x0B04, 0x0B04}, {0x0B0D, 0x0B0E}, {0x0B11, 0x0B12},
- {0x0B29, 0x0B29}, {0x0B31, 0x0B31}, {0x0B34, 0x0B34},
- {0x0B3A, 0x0B3B}, {0x0B45, 0x0B46}, {0x0B49, 0x0B4A},
- {0x0B4E, 0x0B55}, {0x0B58, 0x0B5B}, {0x0B5E, 0x0B5E},
- {0x0B64, 0x0B65}, {0x0B78, 0x0B81}, {0x0B84, 0x0B84},
- {0x0B8B, 0x0B8D}, {0x0B91, 0x0B91}, {0x0B96, 0x0B98},
- {0x0B9B, 0x0B9B}, {0x0B9D, 0x0B9D}, {0x0BA0, 0x0BA2},
- {0x0BA5, 0x0BA7}, {0x0BAB, 0x0BAD}, {0x0BBA, 0x0BBD},
- {0x0BC3, 0x0BC5}, {0x0BC9, 0x0BC9}, {0x0BCE, 0x0BCF},
- {0x0BD1, 0x0BD6}, {0x0BD8, 0x0BE5}, {0x0BFB, 0x0BFF},
- {0x0C04, 0x0C04}, {0x0C0D, 0x0C0D}, {0x0C11, 0x0C11},
- {0x0C29, 0x0C29}, {0x0C3A, 0x0C3C}, {0x0C45, 0x0C45},
- {0x0C49, 0x0C49}, {0x0C4E, 0x0C54}, {0x0C57, 0x0C57},
- {0x0C5B, 0x0C5F}, {0x0C64, 0x0C65}, {0x0C70, 0x0C77},
- {0x0C84, 0x0C84}, {0x0C8D, 0x0C8D}, {0x0C91, 0x0C91},
- {0x0CA9, 0x0CA9}, {0x0CB4, 0x0CB4}, {0x0CBA, 0x0CBB},
- {0x0CC5, 0x0CC5}, {0x0CC9, 0x0CC9}, {0x0CCE, 0x0CD4},
- {0x0CD7, 0x0CDD}, {0x0CDF, 0x0CDF}, {0x0CE4, 0x0CE5},
- {0x0CF0, 0x0CF0}, {0x0CF3, 0x0D00}, {0x0D04, 0x0D04},
- {0x0D0D, 0x0D0D}, {0x0D11, 0x0D11}, {0x0D3B, 0x0D3C},
- {0x0D45, 0x0D45}, {0x0D49, 0x0D49}, {0x0D50, 0x0D53},
- {0x0D64, 0x0D65}, {0x0D80, 0x0D81}, {0x0D84, 0x0D84},
- {0x0D97, 0x0D99}, {0x0DB2, 0x0DB2}, {0x0DBC, 0x0DBC},
- {0x0DBE, 0x0DBF}, {0x0DC7, 0x0DC9}, {0x0DCB, 0x0DCE},
- {0x0DD5, 0x0DD5}, {0x0DD7, 0x0DD7}, {0x0DE0, 0x0DE5},
- {0x0DF0, 0x0DF1}, {0x0DF5, 0x0E00}, {0x0E3B, 0x0E3E},
- {0x0E5C, 0x0E80}, {0x0E83, 0x0E83}, {0x0E85, 0x0E86},
- {0x0E89, 0x0E89}, {0x0E8B, 0x0E8C}, {0x0E8E, 0x0E93},
- {0x0E98, 0x0E98}, {0x0EA0, 0x0EA0}, {0x0EA4, 0x0EA4},
- {0x0EA6, 0x0EA6}, {0x0EA8, 0x0EA9}, {0x0EAC, 0x0EAC},
- {0x0EBA, 0x0EBA}, {0x0EBE, 0x0EBF}, {0x0EC5, 0x0EC5},
- {0x0EC7, 0x0EC7}, {0x0ECE, 0x0ECF}, {0x0EDA, 0x0EDB},
- {0x0EE0, 0x0EFF}, {0x0F48, 0x0F48}, {0x0F6D, 0x0F70},
- {0x0F98, 0x0F98}, {0x0FBD, 0x0FBD}, {0x0FCD, 0x0FCD},
- {0x0FDB, 0x0FFF}, {0x10C6, 0x10C6}, {0x10C8, 0x10CC},
- {0x10CE, 0x10CF}, {0x1249, 0x1249}, {0x124E, 0x124F},
- {0x1257, 0x1257}, {0x1259, 0x1259}, {0x125E, 0x125F},
- {0x1289, 0x1289}, {0x128E, 0x128F}, {0x12B1, 0x12B1},
- {0x12B6, 0x12B7}, {0x12BF, 0x12BF}, {0x12C1, 0x12C1},
- {0x12C6, 0x12C7}, {0x12D7, 0x12D7}, {0x1311, 0x1311},
- {0x1316, 0x1317}, {0x135B, 0x135C}, {0x137D, 0x137F},
- {0x139A, 0x139F}, {0x13F6, 0x13F7}, {0x13FE, 0x13FF},
- {0x169D, 0x169F}, {0x16F9, 0x16FF}, {0x170D, 0x170D},
- {0x1715, 0x171F}, {0x1737, 0x173F}, {0x1754, 0x175F},
- {0x176D, 0x176D}, {0x1771, 0x1771}, {0x1774, 0x177F},
- {0x17DE, 0x17DF}, {0x17EA, 0x17EF}, {0x17FA, 0x17FF},
- {0x180F, 0x180F}, {0x181A, 0x181F}, {0x1878, 0x187F},
- {0x18AB, 0x18AF}, {0x18F6, 0x18FF}, {0x191F, 0x191F},
- {0x192C, 0x192F}, {0x193C, 0x193F}, {0x1941, 0x1943},
- {0x196E, 0x196F}, {0x1975, 0x197F}, {0x19AC, 0x19AF},
- {0x19CA, 0x19CF}, {0x19DB, 0x19DD}, {0x1A1C, 0x1A1D},
- {0x1A5F, 0x1A5F}, {0x1A7D, 0x1A7E}, {0x1A8A, 0x1A8F},
- {0x1A9A, 0x1A9F}, {0x1AAE, 0x1AAF}, {0x1ABF, 0x1AFF},
- {0x1B4C, 0x1B4F}, {0x1B7D, 0x1B7F}, {0x1BF4, 0x1BFB},
- {0x1C38, 0x1C3A}, {0x1C4A, 0x1C4C}, {0x1C89, 0x1CBF},
- {0x1CC8, 0x1CCF}, {0x1CF7, 0x1CF7}, {0x1CFA, 0x1CFF},
- {0x1DF6, 0x1DFA}, {0x1F16, 0x1F17}, {0x1F1E, 0x1F1F},
- {0x1F46, 0x1F47}, {0x1F4E, 0x1F4F}, {0x1F58, 0x1F58},
- {0x1F5A, 0x1F5A}, {0x1F5C, 0x1F5C}, {0x1F5E, 0x1F5E},
- {0x1F7E, 0x1F7F}, {0x1FB5, 0x1FB5}, {0x1FC5, 0x1FC5},
- {0x1FD4, 0x1FD5}, {0x1FDC, 0x1FDC}, {0x1FF0, 0x1FF1},
- {0x1FF5, 0x1FF5}, {0x1FFF, 0x1FFF}, {0x2065, 0x2065},
- {0x2072, 0x2073}, {0x208F, 0x208F}, {0x209D, 0x209F},
- {0x20BF, 0x20CF}, {0x20F1, 0x20FF}, {0x218C, 0x218F},
- {0x23FF, 0x23FF}, {0x2427, 0x243F}, {0x244B, 0x245F},
- {0x2B74, 0x2B75}, {0x2B96, 0x2B97}, {0x2BBA, 0x2BBC},
- {0x2BC9, 0x2BC9}, {0x2BD2, 0x2BEB}, {0x2BF0, 0x2BFF},
- {0x2C2F, 0x2C2F}, {0x2C5F, 0x2C5F}, {0x2CF4, 0x2CF8},
- {0x2D26, 0x2D26}, {0x2D28, 0x2D2C}, {0x2D2E, 0x2D2F},
- {0x2D68, 0x2D6E}, {0x2D71, 0x2D7E}, {0x2D97, 0x2D9F},
- {0x2DA7, 0x2DA7}, {0x2DAF, 0x2DAF}, {0x2DB7, 0x2DB7},
- {0x2DBF, 0x2DBF}, {0x2DC7, 0x2DC7}, {0x2DCF, 0x2DCF},
- {0x2DD7, 0x2DD7}, {0x2DDF, 0x2DDF}, {0x2E45, 0x2E7F},
- {0x2E9A, 0x2E9A}, {0x2EF4, 0x2EFF}, {0x2FD6, 0x2FEF},
- {0x2FFC, 0x2FFF}, {0x3040, 0x3040}, {0x3097, 0x3098},
- {0x3100, 0x3104}, {0x312E, 0x3130}, {0x318F, 0x318F},
- {0x31BB, 0x31BF}, {0x31E4, 0x31EF}, {0x321F, 0x321F},
- {0x32FF, 0x32FF}, {0x4DB6, 0x4DBF}, {0x9FD6, 0x9FFF},
- {0xA48D, 0xA48F}, {0xA4C7, 0xA4CF}, {0xA62C, 0xA63F},
- {0xA6F8, 0xA6FF}, {0xA7AF, 0xA7AF}, {0xA7B8, 0xA7F6},
- {0xA82C, 0xA82F}, {0xA83A, 0xA83F}, {0xA878, 0xA87F},
- {0xA8C6, 0xA8CD}, {0xA8DA, 0xA8DF}, {0xA8FE, 0xA8FF},
- {0xA954, 0xA95E}, {0xA97D, 0xA97F}, {0xA9CE, 0xA9CE},
- {0xA9DA, 0xA9DD}, {0xA9FF, 0xA9FF}, {0xAA37, 0xAA3F},
- {0xAA4E, 0xAA4F}, {0xAA5A, 0xAA5B}, {0xAAC3, 0xAADA},
- {0xAAF7, 0xAB00}, {0xAB07, 0xAB08}, {0xAB0F, 0xAB10},
- {0xAB17, 0xAB1F}, {0xAB27, 0xAB27}, {0xAB2F, 0xAB2F},
- {0xAB66, 0xAB6F}, {0xABEE, 0xABEF}, {0xABFA, 0xABFF},
- {0xD7A4, 0xD7AF}, {0xD7C7, 0xD7CA}, {0xD7FC, 0xD7FF},
- {0xFA6E, 0xFA6F}, {0xFADA, 0xFAFF}, {0xFB07, 0xFB12},
- {0xFB18, 0xFB1C}, {0xFB37, 0xFB37}, {0xFB3D, 0xFB3D},
- {0xFB3F, 0xFB3F}, {0xFB42, 0xFB42}, {0xFB45, 0xFB45},
- {0xFBC2, 0xFBD2}, {0xFD40, 0xFD4F}, {0xFD90, 0xFD91},
- {0xFDC8, 0xFDEF}, {0xFDFE, 0xFDFF}, {0xFE1A, 0xFE1F},
- {0xFE53, 0xFE53}, {0xFE67, 0xFE67}, {0xFE6C, 0xFE6F},
- {0xFE75, 0xFE75}, {0xFEFD, 0xFEFE}, {0xFF00, 0xFF00},
- {0xFFBF, 0xFFC1}, {0xFFC8, 0xFFC9}, {0xFFD0, 0xFFD1},
- {0xFFD8, 0xFFD9}, {0xFFDD, 0xFFDF}, {0xFFE7, 0xFFE7},
- {0xFFEF, 0xFFF8}, {0xFFFE, 0xFFFF}, {0x1000C, 0x1000C},
- {0x10027, 0x10027}, {0x1003B, 0x1003B}, {0x1003E, 0x1003E},
- {0x1004E, 0x1004F}, {0x1005E, 0x1007F}, {0x100FB, 0x100FF},
- {0x10103, 0x10106}, {0x10134, 0x10136}, {0x1018F, 0x1018F},
- {0x1019C, 0x1019F}, {0x101A1, 0x101CF}, {0x101FE, 0x1027F},
- {0x1029D, 0x1029F}, {0x102D1, 0x102DF}, {0x102FC, 0x102FF},
- {0x10324, 0x1032F}, {0x1034B, 0x1034F}, {0x1037B, 0x1037F},
- {0x1039E, 0x1039E}, {0x103C4, 0x103C7}, {0x103D6, 0x103FF},
- {0x1049E, 0x1049F}, {0x104AA, 0x104AF}, {0x104D4, 0x104D7},
- {0x104FC, 0x104FF}, {0x10528, 0x1052F}, {0x10564, 0x1056E},
- {0x10570, 0x105FF}, {0x10737, 0x1073F}, {0x10756, 0x1075F},
- {0x10768, 0x107FF}, {0x10806, 0x10807}, {0x10809, 0x10809},
- {0x10836, 0x10836}, {0x10839, 0x1083B}, {0x1083D, 0x1083E},
- {0x10856, 0x10856}, {0x1089F, 0x108A6}, {0x108B0, 0x108DF},
- {0x108F3, 0x108F3}, {0x108F6, 0x108FA}, {0x1091C, 0x1091E},
- {0x1093A, 0x1093E}, {0x10940, 0x1097F}, {0x109B8, 0x109BB},
- {0x109D0, 0x109D1}, {0x10A04, 0x10A04}, {0x10A07, 0x10A0B},
- {0x10A14, 0x10A14}, {0x10A18, 0x10A18}, {0x10A34, 0x10A37},
- {0x10A3B, 0x10A3E}, {0x10A48, 0x10A4F}, {0x10A59, 0x10A5F},
- {0x10AA0, 0x10ABF}, {0x10AE7, 0x10AEA}, {0x10AF7, 0x10AFF},
- {0x10B36, 0x10B38}, {0x10B56, 0x10B57}, {0x10B73, 0x10B77},
- {0x10B92, 0x10B98}, {0x10B9D, 0x10BA8}, {0x10BB0, 0x10BFF},
- {0x10C49, 0x10C7F}, {0x10CB3, 0x10CBF}, {0x10CF3, 0x10CF9},
- {0x10D00, 0x10E5F}, {0x10E7F, 0x10FFF}, {0x1104E, 0x11051},
- {0x11070, 0x1107E}, {0x110C2, 0x110CF}, {0x110E9, 0x110EF},
- {0x110FA, 0x110FF}, {0x11135, 0x11135}, {0x11144, 0x1114F},
- {0x11177, 0x1117F}, {0x111CE, 0x111CF}, {0x111E0, 0x111E0},
- {0x111F5, 0x111FF}, {0x11212, 0x11212}, {0x1123F, 0x1127F},
- {0x11287, 0x11287}, {0x11289, 0x11289}, {0x1128E, 0x1128E},
- {0x1129E, 0x1129E}, {0x112AA, 0x112AF}, {0x112EB, 0x112EF},
- {0x112FA, 0x112FF}, {0x11304, 0x11304}, {0x1130D, 0x1130E},
- {0x11311, 0x11312}, {0x11329, 0x11329}, {0x11331, 0x11331},
- {0x11334, 0x11334}, {0x1133A, 0x1133B}, {0x11345, 0x11346},
- {0x11349, 0x1134A}, {0x1134E, 0x1134F}, {0x11351, 0x11356},
- {0x11358, 0x1135C}, {0x11364, 0x11365}, {0x1136D, 0x1136F},
- {0x11375, 0x113FF}, {0x1145A, 0x1145A}, {0x1145C, 0x1145C},
- {0x1145E, 0x1147F}, {0x114C8, 0x114CF}, {0x114DA, 0x1157F},
- {0x115B6, 0x115B7}, {0x115DE, 0x115FF}, {0x11645, 0x1164F},
- {0x1165A, 0x1165F}, {0x1166D, 0x1167F}, {0x116B8, 0x116BF},
- {0x116CA, 0x116FF}, {0x1171A, 0x1171C}, {0x1172C, 0x1172F},
- {0x11740, 0x1189F}, {0x118F3, 0x118FE}, {0x11900, 0x11ABF},
- {0x11AF9, 0x11BFF}, {0x11C09, 0x11C09}, {0x11C37, 0x11C37},
- {0x11C46, 0x11C4F}, {0x11C6D, 0x11C6F}, {0x11C90, 0x11C91},
- {0x11CA8, 0x11CA8}, {0x11CB7, 0x11FFF}, {0x1239A, 0x123FF},
- {0x1246F, 0x1246F}, {0x12475, 0x1247F}, {0x12544, 0x12FFF},
- {0x1342F, 0x143FF}, {0x14647, 0x167FF}, {0x16A39, 0x16A3F},
- {0x16A5F, 0x16A5F}, {0x16A6A, 0x16A6D}, {0x16A70, 0x16ACF},
- {0x16AEE, 0x16AEF}, {0x16AF6, 0x16AFF}, {0x16B46, 0x16B4F},
- {0x16B5A, 0x16B5A}, {0x16B62, 0x16B62}, {0x16B78, 0x16B7C},
- {0x16B90, 0x16EFF}, {0x16F45, 0x16F4F}, {0x16F7F, 0x16F8E},
- {0x16FA0, 0x16FDF}, {0x16FE1, 0x16FFF}, {0x187ED, 0x187FF},
- {0x18AF3, 0x1AFFF}, {0x1B002, 0x1BBFF}, {0x1BC6B, 0x1BC6F},
- {0x1BC7D, 0x1BC7F}, {0x1BC89, 0x1BC8F}, {0x1BC9A, 0x1BC9B},
- {0x1BCA4, 0x1CFFF}, {0x1D0F6, 0x1D0FF}, {0x1D127, 0x1D128},
- {0x1D1E9, 0x1D1FF}, {0x1D246, 0x1D2FF}, {0x1D357, 0x1D35F},
- {0x1D372, 0x1D3FF}, {0x1D455, 0x1D455}, {0x1D49D, 0x1D49D},
- {0x1D4A0, 0x1D4A1}, {0x1D4A3, 0x1D4A4}, {0x1D4A7, 0x1D4A8},
- {0x1D4AD, 0x1D4AD}, {0x1D4BA, 0x1D4BA}, {0x1D4BC, 0x1D4BC},
- {0x1D4C4, 0x1D4C4}, {0x1D506, 0x1D506}, {0x1D50B, 0x1D50C},
- {0x1D515, 0x1D515}, {0x1D51D, 0x1D51D}, {0x1D53A, 0x1D53A},
- {0x1D53F, 0x1D53F}, {0x1D545, 0x1D545}, {0x1D547, 0x1D549},
- {0x1D551, 0x1D551}, {0x1D6A6, 0x1D6A7}, {0x1D7CC, 0x1D7CD},
- {0x1DA8C, 0x1DA9A}, {0x1DAA0, 0x1DAA0}, {0x1DAB0, 0x1DFFF},
- {0x1E007, 0x1E007}, {0x1E019, 0x1E01A}, {0x1E022, 0x1E022},
- {0x1E025, 0x1E025}, {0x1E02B, 0x1E7FF}, {0x1E8C5, 0x1E8C6},
- {0x1E8D7, 0x1E8FF}, {0x1E94B, 0x1E94F}, {0x1E95A, 0x1E95D},
- {0x1E960, 0x1EDFF}, {0x1EE04, 0x1EE04}, {0x1EE20, 0x1EE20},
- {0x1EE23, 0x1EE23}, {0x1EE25, 0x1EE26}, {0x1EE28, 0x1EE28},
- {0x1EE33, 0x1EE33}, {0x1EE38, 0x1EE38}, {0x1EE3A, 0x1EE3A},
- {0x1EE3C, 0x1EE41}, {0x1EE43, 0x1EE46}, {0x1EE48, 0x1EE48},
- {0x1EE4A, 0x1EE4A}, {0x1EE4C, 0x1EE4C}, {0x1EE50, 0x1EE50},
- {0x1EE53, 0x1EE53}, {0x1EE55, 0x1EE56}, {0x1EE58, 0x1EE58},
- {0x1EE5A, 0x1EE5A}, {0x1EE5C, 0x1EE5C}, {0x1EE5E, 0x1EE5E},
- {0x1EE60, 0x1EE60}, {0x1EE63, 0x1EE63}, {0x1EE65, 0x1EE66},
- {0x1EE6B, 0x1EE6B}, {0x1EE73, 0x1EE73}, {0x1EE78, 0x1EE78},
- {0x1EE7D, 0x1EE7D}, {0x1EE7F, 0x1EE7F}, {0x1EE8A, 0x1EE8A},
- {0x1EE9C, 0x1EEA0}, {0x1EEA4, 0x1EEA4}, {0x1EEAA, 0x1EEAA},
- {0x1EEBC, 0x1EEEF}, {0x1EEF2, 0x1EFFF}, {0x1F02C, 0x1F02F},
- {0x1F094, 0x1F09F}, {0x1F0AF, 0x1F0B0}, {0x1F0C0, 0x1F0C0},
- {0x1F0D0, 0x1F0D0}, {0x1F0F6, 0x1F0FF}, {0x1F10D, 0x1F10F},
- {0x1F12F, 0x1F12F}, {0x1F16C, 0x1F16F}, {0x1F1AD, 0x1F1E5},
- {0x1F203, 0x1F20F}, {0x1F23C, 0x1F23F}, {0x1F249, 0x1F24F},
- {0x1F252, 0x1F2FF}, {0x1F6D3, 0x1F6DF}, {0x1F6ED, 0x1F6EF},
- {0x1F6F7, 0x1F6FF}, {0x1F774, 0x1F77F}, {0x1F7D5, 0x1F7FF},
- {0x1F80C, 0x1F80F}, {0x1F848, 0x1F84F}, {0x1F85A, 0x1F85F},
- {0x1F888, 0x1F88F}, {0x1F8AE, 0x1F90F}, {0x1F91F, 0x1F91F},
- {0x1F928, 0x1F92F}, {0x1F931, 0x1F932}, {0x1F93F, 0x1F93F},
- {0x1F94C, 0x1F94F}, {0x1F95F, 0x1F97F}, {0x1F992, 0x1F9BF},
- {0x1F9C1, 0x1FFFF}, {0x2A6D7, 0x2A6FF}, {0x2B735, 0x2B73F},
- {0x2B81E, 0x2B81F}, {0x2CEA2, 0x2F7FF}, {0x2FA1E, 0xE0000},
- {0xE0002, 0xE001F}, {0xE0080, 0xE00FF}, {0xE01F0, 0xEFFFF},
- {0xFFFFE, 0xFFFFF},
-}
-
-var neutral = table{
- {0x0000, 0x001F}, {0x007F, 0x007F}, {0x0080, 0x009F},
- {0x00A0, 0x00A0}, {0x00A9, 0x00A9}, {0x00AB, 0x00AB},
- {0x00B5, 0x00B5}, {0x00BB, 0x00BB}, {0x00C0, 0x00C5},
- {0x00C7, 0x00CF}, {0x00D1, 0x00D6}, {0x00D9, 0x00DD},
- {0x00E2, 0x00E5}, {0x00E7, 0x00E7}, {0x00EB, 0x00EB},
- {0x00EE, 0x00EF}, {0x00F1, 0x00F1}, {0x00F4, 0x00F6},
- {0x00FB, 0x00FB}, {0x00FD, 0x00FD}, {0x00FF, 0x00FF},
- {0x0100, 0x0100}, {0x0102, 0x0110}, {0x0112, 0x0112},
- {0x0114, 0x011A}, {0x011C, 0x0125}, {0x0128, 0x012A},
- {0x012C, 0x0130}, {0x0134, 0x0137}, {0x0139, 0x013E},
- {0x0143, 0x0143}, {0x0145, 0x0147}, {0x014C, 0x014C},
- {0x014E, 0x0151}, {0x0154, 0x0165}, {0x0168, 0x016A},
- {0x016C, 0x017F}, {0x0180, 0x01BA}, {0x01BB, 0x01BB},
- {0x01BC, 0x01BF}, {0x01C0, 0x01C3}, {0x01C4, 0x01CD},
- {0x01CF, 0x01CF}, {0x01D1, 0x01D1}, {0x01D3, 0x01D3},
- {0x01D5, 0x01D5}, {0x01D7, 0x01D7}, {0x01D9, 0x01D9},
- {0x01DB, 0x01DB}, {0x01DD, 0x024F}, {0x0250, 0x0250},
- {0x0252, 0x0260}, {0x0262, 0x0293}, {0x0294, 0x0294},
- {0x0295, 0x02AF}, {0x02B0, 0x02C1}, {0x02C2, 0x02C3},
- {0x02C5, 0x02C5}, {0x02C6, 0x02C6}, {0x02C8, 0x02C8},
- {0x02CC, 0x02CC}, {0x02CE, 0x02CF}, {0x02D1, 0x02D1},
- {0x02D2, 0x02D7}, {0x02DC, 0x02DC}, {0x02DE, 0x02DE},
- {0x02E0, 0x02E4}, {0x02E5, 0x02EB}, {0x02EC, 0x02EC},
- {0x02ED, 0x02ED}, {0x02EE, 0x02EE}, {0x02EF, 0x02FF},
- {0x0370, 0x0373}, {0x0374, 0x0374}, {0x0375, 0x0375},
- {0x0376, 0x0377}, {0x037A, 0x037A}, {0x037B, 0x037D},
- {0x037E, 0x037E}, {0x037F, 0x037F}, {0x0384, 0x0385},
- {0x0386, 0x0386}, {0x0387, 0x0387}, {0x0388, 0x038A},
- {0x038C, 0x038C}, {0x038E, 0x0390}, {0x03AA, 0x03B0},
- {0x03C2, 0x03C2}, {0x03CA, 0x03F5}, {0x03F6, 0x03F6},
- {0x03F7, 0x03FF}, {0x0400, 0x0400}, {0x0402, 0x040F},
- {0x0450, 0x0450}, {0x0452, 0x0481}, {0x0482, 0x0482},
- {0x0483, 0x0487}, {0x0488, 0x0489}, {0x048A, 0x04FF},
- {0x0500, 0x052F}, {0x0531, 0x0556}, {0x0559, 0x0559},
- {0x055A, 0x055F}, {0x0561, 0x0587}, {0x0589, 0x0589},
- {0x058A, 0x058A}, {0x058D, 0x058E}, {0x058F, 0x058F},
- {0x0591, 0x05BD}, {0x05BE, 0x05BE}, {0x05BF, 0x05BF},
- {0x05C0, 0x05C0}, {0x05C1, 0x05C2}, {0x05C3, 0x05C3},
- {0x05C4, 0x05C5}, {0x05C6, 0x05C6}, {0x05C7, 0x05C7},
- {0x05D0, 0x05EA}, {0x05F0, 0x05F2}, {0x05F3, 0x05F4},
- {0x0600, 0x0605}, {0x0606, 0x0608}, {0x0609, 0x060A},
- {0x060B, 0x060B}, {0x060C, 0x060D}, {0x060E, 0x060F},
- {0x0610, 0x061A}, {0x061B, 0x061B}, {0x061C, 0x061C},
- {0x061E, 0x061F}, {0x0620, 0x063F}, {0x0640, 0x0640},
- {0x0641, 0x064A}, {0x064B, 0x065F}, {0x0660, 0x0669},
- {0x066A, 0x066D}, {0x066E, 0x066F}, {0x0670, 0x0670},
- {0x0671, 0x06D3}, {0x06D4, 0x06D4}, {0x06D5, 0x06D5},
- {0x06D6, 0x06DC}, {0x06DD, 0x06DD}, {0x06DE, 0x06DE},
- {0x06DF, 0x06E4}, {0x06E5, 0x06E6}, {0x06E7, 0x06E8},
- {0x06E9, 0x06E9}, {0x06EA, 0x06ED}, {0x06EE, 0x06EF},
- {0x06F0, 0x06F9}, {0x06FA, 0x06FC}, {0x06FD, 0x06FE},
- {0x06FF, 0x06FF}, {0x0700, 0x070D}, {0x070F, 0x070F},
- {0x0710, 0x0710}, {0x0711, 0x0711}, {0x0712, 0x072F},
- {0x0730, 0x074A}, {0x074D, 0x074F}, {0x0750, 0x077F},
- {0x0780, 0x07A5}, {0x07A6, 0x07B0}, {0x07B1, 0x07B1},
- {0x07C0, 0x07C9}, {0x07CA, 0x07EA}, {0x07EB, 0x07F3},
- {0x07F4, 0x07F5}, {0x07F6, 0x07F6}, {0x07F7, 0x07F9},
- {0x07FA, 0x07FA}, {0x0800, 0x0815}, {0x0816, 0x0819},
- {0x081A, 0x081A}, {0x081B, 0x0823}, {0x0824, 0x0824},
- {0x0825, 0x0827}, {0x0828, 0x0828}, {0x0829, 0x082D},
- {0x0830, 0x083E}, {0x0840, 0x0858}, {0x0859, 0x085B},
- {0x085E, 0x085E}, {0x08A0, 0x08B4}, {0x08B6, 0x08BD},
- {0x08D4, 0x08E1}, {0x08E2, 0x08E2}, {0x08E3, 0x08FF},
- {0x0900, 0x0902}, {0x0903, 0x0903}, {0x0904, 0x0939},
- {0x093A, 0x093A}, {0x093B, 0x093B}, {0x093C, 0x093C},
- {0x093D, 0x093D}, {0x093E, 0x0940}, {0x0941, 0x0948},
- {0x0949, 0x094C}, {0x094D, 0x094D}, {0x094E, 0x094F},
- {0x0950, 0x0950}, {0x0951, 0x0957}, {0x0958, 0x0961},
- {0x0962, 0x0963}, {0x0964, 0x0965}, {0x0966, 0x096F},
- {0x0970, 0x0970}, {0x0971, 0x0971}, {0x0972, 0x097F},
- {0x0980, 0x0980}, {0x0981, 0x0981}, {0x0982, 0x0983},
- {0x0985, 0x098C}, {0x098F, 0x0990}, {0x0993, 0x09A8},
- {0x09AA, 0x09B0}, {0x09B2, 0x09B2}, {0x09B6, 0x09B9},
- {0x09BC, 0x09BC}, {0x09BD, 0x09BD}, {0x09BE, 0x09C0},
- {0x09C1, 0x09C4}, {0x09C7, 0x09C8}, {0x09CB, 0x09CC},
- {0x09CD, 0x09CD}, {0x09CE, 0x09CE}, {0x09D7, 0x09D7},
- {0x09DC, 0x09DD}, {0x09DF, 0x09E1}, {0x09E2, 0x09E3},
- {0x09E6, 0x09EF}, {0x09F0, 0x09F1}, {0x09F2, 0x09F3},
- {0x09F4, 0x09F9}, {0x09FA, 0x09FA}, {0x09FB, 0x09FB},
- {0x0A01, 0x0A02}, {0x0A03, 0x0A03}, {0x0A05, 0x0A0A},
- {0x0A0F, 0x0A10}, {0x0A13, 0x0A28}, {0x0A2A, 0x0A30},
- {0x0A32, 0x0A33}, {0x0A35, 0x0A36}, {0x0A38, 0x0A39},
- {0x0A3C, 0x0A3C}, {0x0A3E, 0x0A40}, {0x0A41, 0x0A42},
- {0x0A47, 0x0A48}, {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51},
- {0x0A59, 0x0A5C}, {0x0A5E, 0x0A5E}, {0x0A66, 0x0A6F},
- {0x0A70, 0x0A71}, {0x0A72, 0x0A74}, {0x0A75, 0x0A75},
- {0x0A81, 0x0A82}, {0x0A83, 0x0A83}, {0x0A85, 0x0A8D},
- {0x0A8F, 0x0A91}, {0x0A93, 0x0AA8}, {0x0AAA, 0x0AB0},
- {0x0AB2, 0x0AB3}, {0x0AB5, 0x0AB9}, {0x0ABC, 0x0ABC},
- {0x0ABD, 0x0ABD}, {0x0ABE, 0x0AC0}, {0x0AC1, 0x0AC5},
- {0x0AC7, 0x0AC8}, {0x0AC9, 0x0AC9}, {0x0ACB, 0x0ACC},
- {0x0ACD, 0x0ACD}, {0x0AD0, 0x0AD0}, {0x0AE0, 0x0AE1},
- {0x0AE2, 0x0AE3}, {0x0AE6, 0x0AEF}, {0x0AF0, 0x0AF0},
- {0x0AF1, 0x0AF1}, {0x0AF9, 0x0AF9}, {0x0B01, 0x0B01},
- {0x0B02, 0x0B03}, {0x0B05, 0x0B0C}, {0x0B0F, 0x0B10},
- {0x0B13, 0x0B28}, {0x0B2A, 0x0B30}, {0x0B32, 0x0B33},
- {0x0B35, 0x0B39}, {0x0B3C, 0x0B3C}, {0x0B3D, 0x0B3D},
- {0x0B3E, 0x0B3E}, {0x0B3F, 0x0B3F}, {0x0B40, 0x0B40},
- {0x0B41, 0x0B44}, {0x0B47, 0x0B48}, {0x0B4B, 0x0B4C},
- {0x0B4D, 0x0B4D}, {0x0B56, 0x0B56}, {0x0B57, 0x0B57},
- {0x0B5C, 0x0B5D}, {0x0B5F, 0x0B61}, {0x0B62, 0x0B63},
- {0x0B66, 0x0B6F}, {0x0B70, 0x0B70}, {0x0B71, 0x0B71},
- {0x0B72, 0x0B77}, {0x0B82, 0x0B82}, {0x0B83, 0x0B83},
- {0x0B85, 0x0B8A}, {0x0B8E, 0x0B90}, {0x0B92, 0x0B95},
- {0x0B99, 0x0B9A}, {0x0B9C, 0x0B9C}, {0x0B9E, 0x0B9F},
- {0x0BA3, 0x0BA4}, {0x0BA8, 0x0BAA}, {0x0BAE, 0x0BB9},
- {0x0BBE, 0x0BBF}, {0x0BC0, 0x0BC0}, {0x0BC1, 0x0BC2},
- {0x0BC6, 0x0BC8}, {0x0BCA, 0x0BCC}, {0x0BCD, 0x0BCD},
- {0x0BD0, 0x0BD0}, {0x0BD7, 0x0BD7}, {0x0BE6, 0x0BEF},
- {0x0BF0, 0x0BF2}, {0x0BF3, 0x0BF8}, {0x0BF9, 0x0BF9},
- {0x0BFA, 0x0BFA}, {0x0C00, 0x0C00}, {0x0C01, 0x0C03},
- {0x0C05, 0x0C0C}, {0x0C0E, 0x0C10}, {0x0C12, 0x0C28},
- {0x0C2A, 0x0C39}, {0x0C3D, 0x0C3D}, {0x0C3E, 0x0C40},
- {0x0C41, 0x0C44}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D},
- {0x0C55, 0x0C56}, {0x0C58, 0x0C5A}, {0x0C60, 0x0C61},
- {0x0C62, 0x0C63}, {0x0C66, 0x0C6F}, {0x0C78, 0x0C7E},
- {0x0C7F, 0x0C7F}, {0x0C80, 0x0C80}, {0x0C81, 0x0C81},
- {0x0C82, 0x0C83}, {0x0C85, 0x0C8C}, {0x0C8E, 0x0C90},
- {0x0C92, 0x0CA8}, {0x0CAA, 0x0CB3}, {0x0CB5, 0x0CB9},
- {0x0CBC, 0x0CBC}, {0x0CBD, 0x0CBD}, {0x0CBE, 0x0CBE},
- {0x0CBF, 0x0CBF}, {0x0CC0, 0x0CC4}, {0x0CC6, 0x0CC6},
- {0x0CC7, 0x0CC8}, {0x0CCA, 0x0CCB}, {0x0CCC, 0x0CCD},
- {0x0CD5, 0x0CD6}, {0x0CDE, 0x0CDE}, {0x0CE0, 0x0CE1},
- {0x0CE2, 0x0CE3}, {0x0CE6, 0x0CEF}, {0x0CF1, 0x0CF2},
- {0x0D01, 0x0D01}, {0x0D02, 0x0D03}, {0x0D05, 0x0D0C},
- {0x0D0E, 0x0D10}, {0x0D12, 0x0D3A}, {0x0D3D, 0x0D3D},
- {0x0D3E, 0x0D40}, {0x0D41, 0x0D44}, {0x0D46, 0x0D48},
- {0x0D4A, 0x0D4C}, {0x0D4D, 0x0D4D}, {0x0D4E, 0x0D4E},
- {0x0D4F, 0x0D4F}, {0x0D54, 0x0D56}, {0x0D57, 0x0D57},
- {0x0D58, 0x0D5E}, {0x0D5F, 0x0D61}, {0x0D62, 0x0D63},
- {0x0D66, 0x0D6F}, {0x0D70, 0x0D78}, {0x0D79, 0x0D79},
- {0x0D7A, 0x0D7F}, {0x0D82, 0x0D83}, {0x0D85, 0x0D96},
- {0x0D9A, 0x0DB1}, {0x0DB3, 0x0DBB}, {0x0DBD, 0x0DBD},
- {0x0DC0, 0x0DC6}, {0x0DCA, 0x0DCA}, {0x0DCF, 0x0DD1},
- {0x0DD2, 0x0DD4}, {0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF},
- {0x0DE6, 0x0DEF}, {0x0DF2, 0x0DF3}, {0x0DF4, 0x0DF4},
- {0x0E01, 0x0E30}, {0x0E31, 0x0E31}, {0x0E32, 0x0E33},
- {0x0E34, 0x0E3A}, {0x0E3F, 0x0E3F}, {0x0E40, 0x0E45},
- {0x0E46, 0x0E46}, {0x0E47, 0x0E4E}, {0x0E4F, 0x0E4F},
- {0x0E50, 0x0E59}, {0x0E5A, 0x0E5B}, {0x0E81, 0x0E82},
- {0x0E84, 0x0E84}, {0x0E87, 0x0E88}, {0x0E8A, 0x0E8A},
- {0x0E8D, 0x0E8D}, {0x0E94, 0x0E97}, {0x0E99, 0x0E9F},
- {0x0EA1, 0x0EA3}, {0x0EA5, 0x0EA5}, {0x0EA7, 0x0EA7},
- {0x0EAA, 0x0EAB}, {0x0EAD, 0x0EB0}, {0x0EB1, 0x0EB1},
- {0x0EB2, 0x0EB3}, {0x0EB4, 0x0EB9}, {0x0EBB, 0x0EBC},
- {0x0EBD, 0x0EBD}, {0x0EC0, 0x0EC4}, {0x0EC6, 0x0EC6},
- {0x0EC8, 0x0ECD}, {0x0ED0, 0x0ED9}, {0x0EDC, 0x0EDF},
- {0x0F00, 0x0F00}, {0x0F01, 0x0F03}, {0x0F04, 0x0F12},
- {0x0F13, 0x0F13}, {0x0F14, 0x0F14}, {0x0F15, 0x0F17},
- {0x0F18, 0x0F19}, {0x0F1A, 0x0F1F}, {0x0F20, 0x0F29},
- {0x0F2A, 0x0F33}, {0x0F34, 0x0F34}, {0x0F35, 0x0F35},
- {0x0F36, 0x0F36}, {0x0F37, 0x0F37}, {0x0F38, 0x0F38},
- {0x0F39, 0x0F39}, {0x0F3A, 0x0F3A}, {0x0F3B, 0x0F3B},
- {0x0F3C, 0x0F3C}, {0x0F3D, 0x0F3D}, {0x0F3E, 0x0F3F},
- {0x0F40, 0x0F47}, {0x0F49, 0x0F6C}, {0x0F71, 0x0F7E},
- {0x0F7F, 0x0F7F}, {0x0F80, 0x0F84}, {0x0F85, 0x0F85},
- {0x0F86, 0x0F87}, {0x0F88, 0x0F8C}, {0x0F8D, 0x0F97},
- {0x0F99, 0x0FBC}, {0x0FBE, 0x0FC5}, {0x0FC6, 0x0FC6},
- {0x0FC7, 0x0FCC}, {0x0FCE, 0x0FCF}, {0x0FD0, 0x0FD4},
- {0x0FD5, 0x0FD8}, {0x0FD9, 0x0FDA}, {0x1000, 0x102A},
- {0x102B, 0x102C}, {0x102D, 0x1030}, {0x1031, 0x1031},
- {0x1032, 0x1037}, {0x1038, 0x1038}, {0x1039, 0x103A},
- {0x103B, 0x103C}, {0x103D, 0x103E}, {0x103F, 0x103F},
- {0x1040, 0x1049}, {0x104A, 0x104F}, {0x1050, 0x1055},
- {0x1056, 0x1057}, {0x1058, 0x1059}, {0x105A, 0x105D},
- {0x105E, 0x1060}, {0x1061, 0x1061}, {0x1062, 0x1064},
- {0x1065, 0x1066}, {0x1067, 0x106D}, {0x106E, 0x1070},
- {0x1071, 0x1074}, {0x1075, 0x1081}, {0x1082, 0x1082},
- {0x1083, 0x1084}, {0x1085, 0x1086}, {0x1087, 0x108C},
- {0x108D, 0x108D}, {0x108E, 0x108E}, {0x108F, 0x108F},
- {0x1090, 0x1099}, {0x109A, 0x109C}, {0x109D, 0x109D},
- {0x109E, 0x109F}, {0x10A0, 0x10C5}, {0x10C7, 0x10C7},
- {0x10CD, 0x10CD}, {0x10D0, 0x10FA}, {0x10FB, 0x10FB},
- {0x10FC, 0x10FC}, {0x10FD, 0x10FF}, {0x1160, 0x11FF},
- {0x1200, 0x1248}, {0x124A, 0x124D}, {0x1250, 0x1256},
- {0x1258, 0x1258}, {0x125A, 0x125D}, {0x1260, 0x1288},
- {0x128A, 0x128D}, {0x1290, 0x12B0}, {0x12B2, 0x12B5},
- {0x12B8, 0x12BE}, {0x12C0, 0x12C0}, {0x12C2, 0x12C5},
- {0x12C8, 0x12D6}, {0x12D8, 0x1310}, {0x1312, 0x1315},
- {0x1318, 0x135A}, {0x135D, 0x135F}, {0x1360, 0x1368},
- {0x1369, 0x137C}, {0x1380, 0x138F}, {0x1390, 0x1399},
- {0x13A0, 0x13F5}, {0x13F8, 0x13FD}, {0x1400, 0x1400},
- {0x1401, 0x166C}, {0x166D, 0x166E}, {0x166F, 0x167F},
- {0x1680, 0x1680}, {0x1681, 0x169A}, {0x169B, 0x169B},
- {0x169C, 0x169C}, {0x16A0, 0x16EA}, {0x16EB, 0x16ED},
- {0x16EE, 0x16F0}, {0x16F1, 0x16F8}, {0x1700, 0x170C},
- {0x170E, 0x1711}, {0x1712, 0x1714}, {0x1720, 0x1731},
- {0x1732, 0x1734}, {0x1735, 0x1736}, {0x1740, 0x1751},
- {0x1752, 0x1753}, {0x1760, 0x176C}, {0x176E, 0x1770},
- {0x1772, 0x1773}, {0x1780, 0x17B3}, {0x17B4, 0x17B5},
- {0x17B6, 0x17B6}, {0x17B7, 0x17BD}, {0x17BE, 0x17C5},
- {0x17C6, 0x17C6}, {0x17C7, 0x17C8}, {0x17C9, 0x17D3},
- {0x17D4, 0x17D6}, {0x17D7, 0x17D7}, {0x17D8, 0x17DA},
- {0x17DB, 0x17DB}, {0x17DC, 0x17DC}, {0x17DD, 0x17DD},
- {0x17E0, 0x17E9}, {0x17F0, 0x17F9}, {0x1800, 0x1805},
- {0x1806, 0x1806}, {0x1807, 0x180A}, {0x180B, 0x180D},
- {0x180E, 0x180E}, {0x1810, 0x1819}, {0x1820, 0x1842},
- {0x1843, 0x1843}, {0x1844, 0x1877}, {0x1880, 0x1884},
- {0x1885, 0x1886}, {0x1887, 0x18A8}, {0x18A9, 0x18A9},
- {0x18AA, 0x18AA}, {0x18B0, 0x18F5}, {0x1900, 0x191E},
- {0x1920, 0x1922}, {0x1923, 0x1926}, {0x1927, 0x1928},
- {0x1929, 0x192B}, {0x1930, 0x1931}, {0x1932, 0x1932},
- {0x1933, 0x1938}, {0x1939, 0x193B}, {0x1940, 0x1940},
- {0x1944, 0x1945}, {0x1946, 0x194F}, {0x1950, 0x196D},
- {0x1970, 0x1974}, {0x1980, 0x19AB}, {0x19B0, 0x19C9},
- {0x19D0, 0x19D9}, {0x19DA, 0x19DA}, {0x19DE, 0x19DF},
- {0x19E0, 0x19FF}, {0x1A00, 0x1A16}, {0x1A17, 0x1A18},
- {0x1A19, 0x1A1A}, {0x1A1B, 0x1A1B}, {0x1A1E, 0x1A1F},
- {0x1A20, 0x1A54}, {0x1A55, 0x1A55}, {0x1A56, 0x1A56},
- {0x1A57, 0x1A57}, {0x1A58, 0x1A5E}, {0x1A60, 0x1A60},
- {0x1A61, 0x1A61}, {0x1A62, 0x1A62}, {0x1A63, 0x1A64},
- {0x1A65, 0x1A6C}, {0x1A6D, 0x1A72}, {0x1A73, 0x1A7C},
- {0x1A7F, 0x1A7F}, {0x1A80, 0x1A89}, {0x1A90, 0x1A99},
- {0x1AA0, 0x1AA6}, {0x1AA7, 0x1AA7}, {0x1AA8, 0x1AAD},
- {0x1AB0, 0x1ABD}, {0x1ABE, 0x1ABE}, {0x1B00, 0x1B03},
- {0x1B04, 0x1B04}, {0x1B05, 0x1B33}, {0x1B34, 0x1B34},
- {0x1B35, 0x1B35}, {0x1B36, 0x1B3A}, {0x1B3B, 0x1B3B},
- {0x1B3C, 0x1B3C}, {0x1B3D, 0x1B41}, {0x1B42, 0x1B42},
- {0x1B43, 0x1B44}, {0x1B45, 0x1B4B}, {0x1B50, 0x1B59},
- {0x1B5A, 0x1B60}, {0x1B61, 0x1B6A}, {0x1B6B, 0x1B73},
- {0x1B74, 0x1B7C}, {0x1B80, 0x1B81}, {0x1B82, 0x1B82},
- {0x1B83, 0x1BA0}, {0x1BA1, 0x1BA1}, {0x1BA2, 0x1BA5},
- {0x1BA6, 0x1BA7}, {0x1BA8, 0x1BA9}, {0x1BAA, 0x1BAA},
- {0x1BAB, 0x1BAD}, {0x1BAE, 0x1BAF}, {0x1BB0, 0x1BB9},
- {0x1BBA, 0x1BBF}, {0x1BC0, 0x1BE5}, {0x1BE6, 0x1BE6},
- {0x1BE7, 0x1BE7}, {0x1BE8, 0x1BE9}, {0x1BEA, 0x1BEC},
- {0x1BED, 0x1BED}, {0x1BEE, 0x1BEE}, {0x1BEF, 0x1BF1},
- {0x1BF2, 0x1BF3}, {0x1BFC, 0x1BFF}, {0x1C00, 0x1C23},
- {0x1C24, 0x1C2B}, {0x1C2C, 0x1C33}, {0x1C34, 0x1C35},
- {0x1C36, 0x1C37}, {0x1C3B, 0x1C3F}, {0x1C40, 0x1C49},
- {0x1C4D, 0x1C4F}, {0x1C50, 0x1C59}, {0x1C5A, 0x1C77},
- {0x1C78, 0x1C7D}, {0x1C7E, 0x1C7F}, {0x1C80, 0x1C88},
- {0x1CC0, 0x1CC7}, {0x1CD0, 0x1CD2}, {0x1CD3, 0x1CD3},
- {0x1CD4, 0x1CE0}, {0x1CE1, 0x1CE1}, {0x1CE2, 0x1CE8},
- {0x1CE9, 0x1CEC}, {0x1CED, 0x1CED}, {0x1CEE, 0x1CF1},
- {0x1CF2, 0x1CF3}, {0x1CF4, 0x1CF4}, {0x1CF5, 0x1CF6},
- {0x1CF8, 0x1CF9}, {0x1D00, 0x1D2B}, {0x1D2C, 0x1D6A},
- {0x1D6B, 0x1D77}, {0x1D78, 0x1D78}, {0x1D79, 0x1D7F},
- {0x1D80, 0x1D9A}, {0x1D9B, 0x1DBF}, {0x1DC0, 0x1DF5},
- {0x1DFB, 0x1DFF}, {0x1E00, 0x1EFF}, {0x1F00, 0x1F15},
- {0x1F18, 0x1F1D}, {0x1F20, 0x1F45}, {0x1F48, 0x1F4D},
- {0x1F50, 0x1F57}, {0x1F59, 0x1F59}, {0x1F5B, 0x1F5B},
- {0x1F5D, 0x1F5D}, {0x1F5F, 0x1F7D}, {0x1F80, 0x1FB4},
- {0x1FB6, 0x1FBC}, {0x1FBD, 0x1FBD}, {0x1FBE, 0x1FBE},
- {0x1FBF, 0x1FC1}, {0x1FC2, 0x1FC4}, {0x1FC6, 0x1FCC},
- {0x1FCD, 0x1FCF}, {0x1FD0, 0x1FD3}, {0x1FD6, 0x1FDB},
- {0x1FDD, 0x1FDF}, {0x1FE0, 0x1FEC}, {0x1FED, 0x1FEF},
- {0x1FF2, 0x1FF4}, {0x1FF6, 0x1FFC}, {0x1FFD, 0x1FFE},
- {0x2000, 0x200A}, {0x200B, 0x200F}, {0x2011, 0x2012},
- {0x2017, 0x2017}, {0x201A, 0x201A}, {0x201B, 0x201B},
- {0x201E, 0x201E}, {0x201F, 0x201F}, {0x2023, 0x2023},
- {0x2028, 0x2028}, {0x2029, 0x2029}, {0x202A, 0x202E},
- {0x202F, 0x202F}, {0x2031, 0x2031}, {0x2034, 0x2034},
- {0x2036, 0x2038}, {0x2039, 0x2039}, {0x203A, 0x203A},
- {0x203C, 0x203D}, {0x203F, 0x2040}, {0x2041, 0x2043},
- {0x2044, 0x2044}, {0x2045, 0x2045}, {0x2046, 0x2046},
- {0x2047, 0x2051}, {0x2052, 0x2052}, {0x2053, 0x2053},
- {0x2054, 0x2054}, {0x2055, 0x205E}, {0x205F, 0x205F},
- {0x2060, 0x2064}, {0x2066, 0x206F}, {0x2070, 0x2070},
- {0x2071, 0x2071}, {0x2075, 0x2079}, {0x207A, 0x207C},
- {0x207D, 0x207D}, {0x207E, 0x207E}, {0x2080, 0x2080},
- {0x2085, 0x2089}, {0x208A, 0x208C}, {0x208D, 0x208D},
- {0x208E, 0x208E}, {0x2090, 0x209C}, {0x20A0, 0x20A8},
- {0x20AA, 0x20AB}, {0x20AD, 0x20BE}, {0x20D0, 0x20DC},
- {0x20DD, 0x20E0}, {0x20E1, 0x20E1}, {0x20E2, 0x20E4},
- {0x20E5, 0x20F0}, {0x2100, 0x2101}, {0x2102, 0x2102},
- {0x2104, 0x2104}, {0x2106, 0x2106}, {0x2107, 0x2107},
- {0x2108, 0x2108}, {0x210A, 0x2112}, {0x2114, 0x2114},
- {0x2115, 0x2115}, {0x2117, 0x2117}, {0x2118, 0x2118},
- {0x2119, 0x211D}, {0x211E, 0x2120}, {0x2123, 0x2123},
- {0x2124, 0x2124}, {0x2125, 0x2125}, {0x2127, 0x2127},
- {0x2128, 0x2128}, {0x2129, 0x2129}, {0x212A, 0x212A},
- {0x212C, 0x212D}, {0x212E, 0x212E}, {0x212F, 0x2134},
- {0x2135, 0x2138}, {0x2139, 0x2139}, {0x213A, 0x213B},
- {0x213C, 0x213F}, {0x2140, 0x2144}, {0x2145, 0x2149},
- {0x214A, 0x214A}, {0x214B, 0x214B}, {0x214C, 0x214D},
- {0x214E, 0x214E}, {0x214F, 0x214F}, {0x2150, 0x2152},
- {0x2155, 0x215A}, {0x215F, 0x215F}, {0x216C, 0x216F},
- {0x217A, 0x2182}, {0x2183, 0x2184}, {0x2185, 0x2188},
- {0x218A, 0x218B}, {0x219A, 0x219B}, {0x219C, 0x219F},
- {0x21A0, 0x21A0}, {0x21A1, 0x21A2}, {0x21A3, 0x21A3},
- {0x21A4, 0x21A5}, {0x21A6, 0x21A6}, {0x21A7, 0x21AD},
- {0x21AE, 0x21AE}, {0x21AF, 0x21B7}, {0x21BA, 0x21CD},
- {0x21CE, 0x21CF}, {0x21D0, 0x21D1}, {0x21D3, 0x21D3},
- {0x21D5, 0x21E6}, {0x21E8, 0x21F3}, {0x21F4, 0x21FF},
- {0x2201, 0x2201}, {0x2204, 0x2206}, {0x2209, 0x220A},
- {0x220C, 0x220E}, {0x2210, 0x2210}, {0x2212, 0x2214},
- {0x2216, 0x2219}, {0x221B, 0x221C}, {0x2221, 0x2222},
- {0x2224, 0x2224}, {0x2226, 0x2226}, {0x222D, 0x222D},
- {0x222F, 0x2233}, {0x2238, 0x223B}, {0x223E, 0x2247},
- {0x2249, 0x224B}, {0x224D, 0x2251}, {0x2253, 0x225F},
- {0x2262, 0x2263}, {0x2268, 0x2269}, {0x226C, 0x226D},
- {0x2270, 0x2281}, {0x2284, 0x2285}, {0x2288, 0x2294},
- {0x2296, 0x2298}, {0x229A, 0x22A4}, {0x22A6, 0x22BE},
- {0x22C0, 0x22FF}, {0x2300, 0x2307}, {0x2308, 0x2308},
- {0x2309, 0x2309}, {0x230A, 0x230A}, {0x230B, 0x230B},
- {0x230C, 0x2311}, {0x2313, 0x2319}, {0x231C, 0x231F},
- {0x2320, 0x2321}, {0x2322, 0x2328}, {0x232B, 0x237B},
- {0x237C, 0x237C}, {0x237D, 0x239A}, {0x239B, 0x23B3},
- {0x23B4, 0x23DB}, {0x23DC, 0x23E1}, {0x23E2, 0x23E8},
- {0x23ED, 0x23EF}, {0x23F1, 0x23F2}, {0x23F4, 0x23FE},
- {0x2400, 0x2426}, {0x2440, 0x244A}, {0x24EA, 0x24EA},
- {0x254C, 0x254F}, {0x2574, 0x257F}, {0x2590, 0x2591},
- {0x2596, 0x259F}, {0x25A2, 0x25A2}, {0x25AA, 0x25B1},
- {0x25B4, 0x25B5}, {0x25B8, 0x25BB}, {0x25BE, 0x25BF},
- {0x25C2, 0x25C5}, {0x25C9, 0x25CA}, {0x25CC, 0x25CD},
- {0x25D2, 0x25E1}, {0x25E6, 0x25EE}, {0x25F0, 0x25F7},
- {0x25F8, 0x25FC}, {0x25FF, 0x25FF}, {0x2600, 0x2604},
- {0x2607, 0x2608}, {0x260A, 0x260D}, {0x2610, 0x2613},
- {0x2616, 0x261B}, {0x261D, 0x261D}, {0x261F, 0x263F},
- {0x2641, 0x2641}, {0x2643, 0x2647}, {0x2654, 0x265F},
- {0x2662, 0x2662}, {0x2666, 0x2666}, {0x266B, 0x266B},
- {0x266E, 0x266E}, {0x2670, 0x267E}, {0x2680, 0x2692},
- {0x2694, 0x269D}, {0x26A0, 0x26A0}, {0x26A2, 0x26A9},
- {0x26AC, 0x26BC}, {0x26C0, 0x26C3}, {0x26E2, 0x26E2},
- {0x26E4, 0x26E7}, {0x2700, 0x2704}, {0x2706, 0x2709},
- {0x270C, 0x2727}, {0x2729, 0x273C}, {0x273E, 0x274B},
- {0x274D, 0x274D}, {0x274F, 0x2752}, {0x2756, 0x2756},
- {0x2758, 0x2767}, {0x2768, 0x2768}, {0x2769, 0x2769},
- {0x276A, 0x276A}, {0x276B, 0x276B}, {0x276C, 0x276C},
- {0x276D, 0x276D}, {0x276E, 0x276E}, {0x276F, 0x276F},
- {0x2770, 0x2770}, {0x2771, 0x2771}, {0x2772, 0x2772},
- {0x2773, 0x2773}, {0x2774, 0x2774}, {0x2775, 0x2775},
- {0x2780, 0x2793}, {0x2794, 0x2794}, {0x2798, 0x27AF},
- {0x27B1, 0x27BE}, {0x27C0, 0x27C4}, {0x27C5, 0x27C5},
- {0x27C6, 0x27C6}, {0x27C7, 0x27E5}, {0x27EE, 0x27EE},
- {0x27EF, 0x27EF}, {0x27F0, 0x27FF}, {0x2800, 0x28FF},
- {0x2900, 0x297F}, {0x2980, 0x2982}, {0x2983, 0x2983},
- {0x2984, 0x2984}, {0x2987, 0x2987}, {0x2988, 0x2988},
- {0x2989, 0x2989}, {0x298A, 0x298A}, {0x298B, 0x298B},
- {0x298C, 0x298C}, {0x298D, 0x298D}, {0x298E, 0x298E},
- {0x298F, 0x298F}, {0x2990, 0x2990}, {0x2991, 0x2991},
- {0x2992, 0x2992}, {0x2993, 0x2993}, {0x2994, 0x2994},
- {0x2995, 0x2995}, {0x2996, 0x2996}, {0x2997, 0x2997},
- {0x2998, 0x2998}, {0x2999, 0x29D7}, {0x29D8, 0x29D8},
- {0x29D9, 0x29D9}, {0x29DA, 0x29DA}, {0x29DB, 0x29DB},
- {0x29DC, 0x29FB}, {0x29FC, 0x29FC}, {0x29FD, 0x29FD},
- {0x29FE, 0x29FF}, {0x2A00, 0x2AFF}, {0x2B00, 0x2B1A},
- {0x2B1D, 0x2B2F}, {0x2B30, 0x2B44}, {0x2B45, 0x2B46},
- {0x2B47, 0x2B4C}, {0x2B4D, 0x2B4F}, {0x2B51, 0x2B54},
- {0x2B5A, 0x2B73}, {0x2B76, 0x2B95}, {0x2B98, 0x2BB9},
- {0x2BBD, 0x2BC8}, {0x2BCA, 0x2BD1}, {0x2BEC, 0x2BEF},
- {0x2C00, 0x2C2E}, {0x2C30, 0x2C5E}, {0x2C60, 0x2C7B},
- {0x2C7C, 0x2C7D}, {0x2C7E, 0x2C7F}, {0x2C80, 0x2CE4},
- {0x2CE5, 0x2CEA}, {0x2CEB, 0x2CEE}, {0x2CEF, 0x2CF1},
- {0x2CF2, 0x2CF3}, {0x2CF9, 0x2CFC}, {0x2CFD, 0x2CFD},
- {0x2CFE, 0x2CFF}, {0x2D00, 0x2D25}, {0x2D27, 0x2D27},
- {0x2D2D, 0x2D2D}, {0x2D30, 0x2D67}, {0x2D6F, 0x2D6F},
- {0x2D70, 0x2D70}, {0x2D7F, 0x2D7F}, {0x2D80, 0x2D96},
- {0x2DA0, 0x2DA6}, {0x2DA8, 0x2DAE}, {0x2DB0, 0x2DB6},
- {0x2DB8, 0x2DBE}, {0x2DC0, 0x2DC6}, {0x2DC8, 0x2DCE},
- {0x2DD0, 0x2DD6}, {0x2DD8, 0x2DDE}, {0x2DE0, 0x2DFF},
- {0x2E00, 0x2E01}, {0x2E02, 0x2E02}, {0x2E03, 0x2E03},
- {0x2E04, 0x2E04}, {0x2E05, 0x2E05}, {0x2E06, 0x2E08},
- {0x2E09, 0x2E09}, {0x2E0A, 0x2E0A}, {0x2E0B, 0x2E0B},
- {0x2E0C, 0x2E0C}, {0x2E0D, 0x2E0D}, {0x2E0E, 0x2E16},
- {0x2E17, 0x2E17}, {0x2E18, 0x2E19}, {0x2E1A, 0x2E1A},
- {0x2E1B, 0x2E1B}, {0x2E1C, 0x2E1C}, {0x2E1D, 0x2E1D},
- {0x2E1E, 0x2E1F}, {0x2E20, 0x2E20}, {0x2E21, 0x2E21},
- {0x2E22, 0x2E22}, {0x2E23, 0x2E23}, {0x2E24, 0x2E24},
- {0x2E25, 0x2E25}, {0x2E26, 0x2E26}, {0x2E27, 0x2E27},
- {0x2E28, 0x2E28}, {0x2E29, 0x2E29}, {0x2E2A, 0x2E2E},
- {0x2E2F, 0x2E2F}, {0x2E30, 0x2E39}, {0x2E3A, 0x2E3B},
- {0x2E3C, 0x2E3F}, {0x2E40, 0x2E40}, {0x2E41, 0x2E41},
- {0x2E42, 0x2E42}, {0x2E43, 0x2E44}, {0x303F, 0x303F},
- {0x4DC0, 0x4DFF}, {0xA4D0, 0xA4F7}, {0xA4F8, 0xA4FD},
- {0xA4FE, 0xA4FF}, {0xA500, 0xA60B}, {0xA60C, 0xA60C},
- {0xA60D, 0xA60F}, {0xA610, 0xA61F}, {0xA620, 0xA629},
- {0xA62A, 0xA62B}, {0xA640, 0xA66D}, {0xA66E, 0xA66E},
- {0xA66F, 0xA66F}, {0xA670, 0xA672}, {0xA673, 0xA673},
- {0xA674, 0xA67D}, {0xA67E, 0xA67E}, {0xA67F, 0xA67F},
- {0xA680, 0xA69B}, {0xA69C, 0xA69D}, {0xA69E, 0xA69F},
- {0xA6A0, 0xA6E5}, {0xA6E6, 0xA6EF}, {0xA6F0, 0xA6F1},
- {0xA6F2, 0xA6F7}, {0xA700, 0xA716}, {0xA717, 0xA71F},
- {0xA720, 0xA721}, {0xA722, 0xA76F}, {0xA770, 0xA770},
- {0xA771, 0xA787}, {0xA788, 0xA788}, {0xA789, 0xA78A},
- {0xA78B, 0xA78E}, {0xA78F, 0xA78F}, {0xA790, 0xA7AE},
- {0xA7B0, 0xA7B7}, {0xA7F7, 0xA7F7}, {0xA7F8, 0xA7F9},
- {0xA7FA, 0xA7FA}, {0xA7FB, 0xA7FF}, {0xA800, 0xA801},
- {0xA802, 0xA802}, {0xA803, 0xA805}, {0xA806, 0xA806},
- {0xA807, 0xA80A}, {0xA80B, 0xA80B}, {0xA80C, 0xA822},
- {0xA823, 0xA824}, {0xA825, 0xA826}, {0xA827, 0xA827},
- {0xA828, 0xA82B}, {0xA830, 0xA835}, {0xA836, 0xA837},
- {0xA838, 0xA838}, {0xA839, 0xA839}, {0xA840, 0xA873},
- {0xA874, 0xA877}, {0xA880, 0xA881}, {0xA882, 0xA8B3},
- {0xA8B4, 0xA8C3}, {0xA8C4, 0xA8C5}, {0xA8CE, 0xA8CF},
- {0xA8D0, 0xA8D9}, {0xA8E0, 0xA8F1}, {0xA8F2, 0xA8F7},
- {0xA8F8, 0xA8FA}, {0xA8FB, 0xA8FB}, {0xA8FC, 0xA8FC},
- {0xA8FD, 0xA8FD}, {0xA900, 0xA909}, {0xA90A, 0xA925},
- {0xA926, 0xA92D}, {0xA92E, 0xA92F}, {0xA930, 0xA946},
- {0xA947, 0xA951}, {0xA952, 0xA953}, {0xA95F, 0xA95F},
- {0xA980, 0xA982}, {0xA983, 0xA983}, {0xA984, 0xA9B2},
- {0xA9B3, 0xA9B3}, {0xA9B4, 0xA9B5}, {0xA9B6, 0xA9B9},
- {0xA9BA, 0xA9BB}, {0xA9BC, 0xA9BC}, {0xA9BD, 0xA9C0},
- {0xA9C1, 0xA9CD}, {0xA9CF, 0xA9CF}, {0xA9D0, 0xA9D9},
- {0xA9DE, 0xA9DF}, {0xA9E0, 0xA9E4}, {0xA9E5, 0xA9E5},
- {0xA9E6, 0xA9E6}, {0xA9E7, 0xA9EF}, {0xA9F0, 0xA9F9},
- {0xA9FA, 0xA9FE}, {0xAA00, 0xAA28}, {0xAA29, 0xAA2E},
- {0xAA2F, 0xAA30}, {0xAA31, 0xAA32}, {0xAA33, 0xAA34},
- {0xAA35, 0xAA36}, {0xAA40, 0xAA42}, {0xAA43, 0xAA43},
- {0xAA44, 0xAA4B}, {0xAA4C, 0xAA4C}, {0xAA4D, 0xAA4D},
- {0xAA50, 0xAA59}, {0xAA5C, 0xAA5F}, {0xAA60, 0xAA6F},
- {0xAA70, 0xAA70}, {0xAA71, 0xAA76}, {0xAA77, 0xAA79},
- {0xAA7A, 0xAA7A}, {0xAA7B, 0xAA7B}, {0xAA7C, 0xAA7C},
- {0xAA7D, 0xAA7D}, {0xAA7E, 0xAA7F}, {0xAA80, 0xAAAF},
- {0xAAB0, 0xAAB0}, {0xAAB1, 0xAAB1}, {0xAAB2, 0xAAB4},
- {0xAAB5, 0xAAB6}, {0xAAB7, 0xAAB8}, {0xAAB9, 0xAABD},
- {0xAABE, 0xAABF}, {0xAAC0, 0xAAC0}, {0xAAC1, 0xAAC1},
- {0xAAC2, 0xAAC2}, {0xAADB, 0xAADC}, {0xAADD, 0xAADD},
- {0xAADE, 0xAADF}, {0xAAE0, 0xAAEA}, {0xAAEB, 0xAAEB},
- {0xAAEC, 0xAAED}, {0xAAEE, 0xAAEF}, {0xAAF0, 0xAAF1},
- {0xAAF2, 0xAAF2}, {0xAAF3, 0xAAF4}, {0xAAF5, 0xAAF5},
- {0xAAF6, 0xAAF6}, {0xAB01, 0xAB06}, {0xAB09, 0xAB0E},
- {0xAB11, 0xAB16}, {0xAB20, 0xAB26}, {0xAB28, 0xAB2E},
- {0xAB30, 0xAB5A}, {0xAB5B, 0xAB5B}, {0xAB5C, 0xAB5F},
- {0xAB60, 0xAB65}, {0xAB70, 0xABBF}, {0xABC0, 0xABE2},
- {0xABE3, 0xABE4}, {0xABE5, 0xABE5}, {0xABE6, 0xABE7},
- {0xABE8, 0xABE8}, {0xABE9, 0xABEA}, {0xABEB, 0xABEB},
- {0xABEC, 0xABEC}, {0xABED, 0xABED}, {0xABF0, 0xABF9},
- {0xD7B0, 0xD7C6}, {0xD7CB, 0xD7FB}, {0xD800, 0xDB7F},
- {0xDB80, 0xDBFF}, {0xDC00, 0xDFFF}, {0xFB00, 0xFB06},
- {0xFB13, 0xFB17}, {0xFB1D, 0xFB1D}, {0xFB1E, 0xFB1E},
- {0xFB1F, 0xFB28}, {0xFB29, 0xFB29}, {0xFB2A, 0xFB36},
- {0xFB38, 0xFB3C}, {0xFB3E, 0xFB3E}, {0xFB40, 0xFB41},
- {0xFB43, 0xFB44}, {0xFB46, 0xFB4F}, {0xFB50, 0xFBB1},
- {0xFBB2, 0xFBC1}, {0xFBD3, 0xFD3D}, {0xFD3E, 0xFD3E},
- {0xFD3F, 0xFD3F}, {0xFD50, 0xFD8F}, {0xFD92, 0xFDC7},
- {0xFDF0, 0xFDFB}, {0xFDFC, 0xFDFC}, {0xFDFD, 0xFDFD},
- {0xFE20, 0xFE2F}, {0xFE70, 0xFE74}, {0xFE76, 0xFEFC},
- {0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFB}, {0xFFFC, 0xFFFC},
- {0x10000, 0x1000B}, {0x1000D, 0x10026}, {0x10028, 0x1003A},
- {0x1003C, 0x1003D}, {0x1003F, 0x1004D}, {0x10050, 0x1005D},
- {0x10080, 0x100FA}, {0x10100, 0x10102}, {0x10107, 0x10133},
- {0x10137, 0x1013F}, {0x10140, 0x10174}, {0x10175, 0x10178},
- {0x10179, 0x10189}, {0x1018A, 0x1018B}, {0x1018C, 0x1018E},
- {0x10190, 0x1019B}, {0x101A0, 0x101A0}, {0x101D0, 0x101FC},
- {0x101FD, 0x101FD}, {0x10280, 0x1029C}, {0x102A0, 0x102D0},
- {0x102E0, 0x102E0}, {0x102E1, 0x102FB}, {0x10300, 0x1031F},
- {0x10320, 0x10323}, {0x10330, 0x10340}, {0x10341, 0x10341},
- {0x10342, 0x10349}, {0x1034A, 0x1034A}, {0x10350, 0x10375},
- {0x10376, 0x1037A}, {0x10380, 0x1039D}, {0x1039F, 0x1039F},
- {0x103A0, 0x103C3}, {0x103C8, 0x103CF}, {0x103D0, 0x103D0},
- {0x103D1, 0x103D5}, {0x10400, 0x1044F}, {0x10450, 0x1047F},
- {0x10480, 0x1049D}, {0x104A0, 0x104A9}, {0x104B0, 0x104D3},
- {0x104D8, 0x104FB}, {0x10500, 0x10527}, {0x10530, 0x10563},
- {0x1056F, 0x1056F}, {0x10600, 0x10736}, {0x10740, 0x10755},
- {0x10760, 0x10767}, {0x10800, 0x10805}, {0x10808, 0x10808},
- {0x1080A, 0x10835}, {0x10837, 0x10838}, {0x1083C, 0x1083C},
- {0x1083F, 0x1083F}, {0x10840, 0x10855}, {0x10857, 0x10857},
- {0x10858, 0x1085F}, {0x10860, 0x10876}, {0x10877, 0x10878},
- {0x10879, 0x1087F}, {0x10880, 0x1089E}, {0x108A7, 0x108AF},
- {0x108E0, 0x108F2}, {0x108F4, 0x108F5}, {0x108FB, 0x108FF},
- {0x10900, 0x10915}, {0x10916, 0x1091B}, {0x1091F, 0x1091F},
- {0x10920, 0x10939}, {0x1093F, 0x1093F}, {0x10980, 0x1099F},
- {0x109A0, 0x109B7}, {0x109BC, 0x109BD}, {0x109BE, 0x109BF},
- {0x109C0, 0x109CF}, {0x109D2, 0x109FF}, {0x10A00, 0x10A00},
- {0x10A01, 0x10A03}, {0x10A05, 0x10A06}, {0x10A0C, 0x10A0F},
- {0x10A10, 0x10A13}, {0x10A15, 0x10A17}, {0x10A19, 0x10A33},
- {0x10A38, 0x10A3A}, {0x10A3F, 0x10A3F}, {0x10A40, 0x10A47},
- {0x10A50, 0x10A58}, {0x10A60, 0x10A7C}, {0x10A7D, 0x10A7E},
- {0x10A7F, 0x10A7F}, {0x10A80, 0x10A9C}, {0x10A9D, 0x10A9F},
- {0x10AC0, 0x10AC7}, {0x10AC8, 0x10AC8}, {0x10AC9, 0x10AE4},
- {0x10AE5, 0x10AE6}, {0x10AEB, 0x10AEF}, {0x10AF0, 0x10AF6},
- {0x10B00, 0x10B35}, {0x10B39, 0x10B3F}, {0x10B40, 0x10B55},
- {0x10B58, 0x10B5F}, {0x10B60, 0x10B72}, {0x10B78, 0x10B7F},
- {0x10B80, 0x10B91}, {0x10B99, 0x10B9C}, {0x10BA9, 0x10BAF},
- {0x10C00, 0x10C48}, {0x10C80, 0x10CB2}, {0x10CC0, 0x10CF2},
- {0x10CFA, 0x10CFF}, {0x10E60, 0x10E7E}, {0x11000, 0x11000},
- {0x11001, 0x11001}, {0x11002, 0x11002}, {0x11003, 0x11037},
- {0x11038, 0x11046}, {0x11047, 0x1104D}, {0x11052, 0x11065},
- {0x11066, 0x1106F}, {0x1107F, 0x1107F}, {0x11080, 0x11081},
- {0x11082, 0x11082}, {0x11083, 0x110AF}, {0x110B0, 0x110B2},
- {0x110B3, 0x110B6}, {0x110B7, 0x110B8}, {0x110B9, 0x110BA},
- {0x110BB, 0x110BC}, {0x110BD, 0x110BD}, {0x110BE, 0x110C1},
- {0x110D0, 0x110E8}, {0x110F0, 0x110F9}, {0x11100, 0x11102},
- {0x11103, 0x11126}, {0x11127, 0x1112B}, {0x1112C, 0x1112C},
- {0x1112D, 0x11134}, {0x11136, 0x1113F}, {0x11140, 0x11143},
- {0x11150, 0x11172}, {0x11173, 0x11173}, {0x11174, 0x11175},
- {0x11176, 0x11176}, {0x11180, 0x11181}, {0x11182, 0x11182},
- {0x11183, 0x111B2}, {0x111B3, 0x111B5}, {0x111B6, 0x111BE},
- {0x111BF, 0x111C0}, {0x111C1, 0x111C4}, {0x111C5, 0x111C9},
- {0x111CA, 0x111CC}, {0x111CD, 0x111CD}, {0x111D0, 0x111D9},
- {0x111DA, 0x111DA}, {0x111DB, 0x111DB}, {0x111DC, 0x111DC},
- {0x111DD, 0x111DF}, {0x111E1, 0x111F4}, {0x11200, 0x11211},
- {0x11213, 0x1122B}, {0x1122C, 0x1122E}, {0x1122F, 0x11231},
- {0x11232, 0x11233}, {0x11234, 0x11234}, {0x11235, 0x11235},
- {0x11236, 0x11237}, {0x11238, 0x1123D}, {0x1123E, 0x1123E},
- {0x11280, 0x11286}, {0x11288, 0x11288}, {0x1128A, 0x1128D},
- {0x1128F, 0x1129D}, {0x1129F, 0x112A8}, {0x112A9, 0x112A9},
- {0x112B0, 0x112DE}, {0x112DF, 0x112DF}, {0x112E0, 0x112E2},
- {0x112E3, 0x112EA}, {0x112F0, 0x112F9}, {0x11300, 0x11301},
- {0x11302, 0x11303}, {0x11305, 0x1130C}, {0x1130F, 0x11310},
- {0x11313, 0x11328}, {0x1132A, 0x11330}, {0x11332, 0x11333},
- {0x11335, 0x11339}, {0x1133C, 0x1133C}, {0x1133D, 0x1133D},
- {0x1133E, 0x1133F}, {0x11340, 0x11340}, {0x11341, 0x11344},
- {0x11347, 0x11348}, {0x1134B, 0x1134D}, {0x11350, 0x11350},
- {0x11357, 0x11357}, {0x1135D, 0x11361}, {0x11362, 0x11363},
- {0x11366, 0x1136C}, {0x11370, 0x11374}, {0x11400, 0x11434},
- {0x11435, 0x11437}, {0x11438, 0x1143F}, {0x11440, 0x11441},
- {0x11442, 0x11444}, {0x11445, 0x11445}, {0x11446, 0x11446},
- {0x11447, 0x1144A}, {0x1144B, 0x1144F}, {0x11450, 0x11459},
- {0x1145B, 0x1145B}, {0x1145D, 0x1145D}, {0x11480, 0x114AF},
- {0x114B0, 0x114B2}, {0x114B3, 0x114B8}, {0x114B9, 0x114B9},
- {0x114BA, 0x114BA}, {0x114BB, 0x114BE}, {0x114BF, 0x114C0},
- {0x114C1, 0x114C1}, {0x114C2, 0x114C3}, {0x114C4, 0x114C5},
- {0x114C6, 0x114C6}, {0x114C7, 0x114C7}, {0x114D0, 0x114D9},
- {0x11580, 0x115AE}, {0x115AF, 0x115B1}, {0x115B2, 0x115B5},
- {0x115B8, 0x115BB}, {0x115BC, 0x115BD}, {0x115BE, 0x115BE},
- {0x115BF, 0x115C0}, {0x115C1, 0x115D7}, {0x115D8, 0x115DB},
- {0x115DC, 0x115DD}, {0x11600, 0x1162F}, {0x11630, 0x11632},
- {0x11633, 0x1163A}, {0x1163B, 0x1163C}, {0x1163D, 0x1163D},
- {0x1163E, 0x1163E}, {0x1163F, 0x11640}, {0x11641, 0x11643},
- {0x11644, 0x11644}, {0x11650, 0x11659}, {0x11660, 0x1166C},
- {0x11680, 0x116AA}, {0x116AB, 0x116AB}, {0x116AC, 0x116AC},
- {0x116AD, 0x116AD}, {0x116AE, 0x116AF}, {0x116B0, 0x116B5},
- {0x116B6, 0x116B6}, {0x116B7, 0x116B7}, {0x116C0, 0x116C9},
- {0x11700, 0x11719}, {0x1171D, 0x1171F}, {0x11720, 0x11721},
- {0x11722, 0x11725}, {0x11726, 0x11726}, {0x11727, 0x1172B},
- {0x11730, 0x11739}, {0x1173A, 0x1173B}, {0x1173C, 0x1173E},
- {0x1173F, 0x1173F}, {0x118A0, 0x118DF}, {0x118E0, 0x118E9},
- {0x118EA, 0x118F2}, {0x118FF, 0x118FF}, {0x11AC0, 0x11AF8},
- {0x11C00, 0x11C08}, {0x11C0A, 0x11C2E}, {0x11C2F, 0x11C2F},
- {0x11C30, 0x11C36}, {0x11C38, 0x11C3D}, {0x11C3E, 0x11C3E},
- {0x11C3F, 0x11C3F}, {0x11C40, 0x11C40}, {0x11C41, 0x11C45},
- {0x11C50, 0x11C59}, {0x11C5A, 0x11C6C}, {0x11C70, 0x11C71},
- {0x11C72, 0x11C8F}, {0x11C92, 0x11CA7}, {0x11CA9, 0x11CA9},
- {0x11CAA, 0x11CB0}, {0x11CB1, 0x11CB1}, {0x11CB2, 0x11CB3},
- {0x11CB4, 0x11CB4}, {0x11CB5, 0x11CB6}, {0x12000, 0x12399},
- {0x12400, 0x1246E}, {0x12470, 0x12474}, {0x12480, 0x12543},
- {0x13000, 0x1342E}, {0x14400, 0x14646}, {0x16800, 0x16A38},
- {0x16A40, 0x16A5E}, {0x16A60, 0x16A69}, {0x16A6E, 0x16A6F},
- {0x16AD0, 0x16AED}, {0x16AF0, 0x16AF4}, {0x16AF5, 0x16AF5},
- {0x16B00, 0x16B2F}, {0x16B30, 0x16B36}, {0x16B37, 0x16B3B},
- {0x16B3C, 0x16B3F}, {0x16B40, 0x16B43}, {0x16B44, 0x16B44},
- {0x16B45, 0x16B45}, {0x16B50, 0x16B59}, {0x16B5B, 0x16B61},
- {0x16B63, 0x16B77}, {0x16B7D, 0x16B8F}, {0x16F00, 0x16F44},
- {0x16F50, 0x16F50}, {0x16F51, 0x16F7E}, {0x16F8F, 0x16F92},
- {0x16F93, 0x16F9F}, {0x1BC00, 0x1BC6A}, {0x1BC70, 0x1BC7C},
- {0x1BC80, 0x1BC88}, {0x1BC90, 0x1BC99}, {0x1BC9C, 0x1BC9C},
- {0x1BC9D, 0x1BC9E}, {0x1BC9F, 0x1BC9F}, {0x1BCA0, 0x1BCA3},
- {0x1D000, 0x1D0F5}, {0x1D100, 0x1D126}, {0x1D129, 0x1D164},
- {0x1D165, 0x1D166}, {0x1D167, 0x1D169}, {0x1D16A, 0x1D16C},
- {0x1D16D, 0x1D172}, {0x1D173, 0x1D17A}, {0x1D17B, 0x1D182},
- {0x1D183, 0x1D184}, {0x1D185, 0x1D18B}, {0x1D18C, 0x1D1A9},
- {0x1D1AA, 0x1D1AD}, {0x1D1AE, 0x1D1E8}, {0x1D200, 0x1D241},
- {0x1D242, 0x1D244}, {0x1D245, 0x1D245}, {0x1D300, 0x1D356},
- {0x1D360, 0x1D371}, {0x1D400, 0x1D454}, {0x1D456, 0x1D49C},
- {0x1D49E, 0x1D49F}, {0x1D4A2, 0x1D4A2}, {0x1D4A5, 0x1D4A6},
- {0x1D4A9, 0x1D4AC}, {0x1D4AE, 0x1D4B9}, {0x1D4BB, 0x1D4BB},
- {0x1D4BD, 0x1D4C3}, {0x1D4C5, 0x1D505}, {0x1D507, 0x1D50A},
- {0x1D50D, 0x1D514}, {0x1D516, 0x1D51C}, {0x1D51E, 0x1D539},
- {0x1D53B, 0x1D53E}, {0x1D540, 0x1D544}, {0x1D546, 0x1D546},
- {0x1D54A, 0x1D550}, {0x1D552, 0x1D6A5}, {0x1D6A8, 0x1D6C0},
- {0x1D6C1, 0x1D6C1}, {0x1D6C2, 0x1D6DA}, {0x1D6DB, 0x1D6DB},
- {0x1D6DC, 0x1D6FA}, {0x1D6FB, 0x1D6FB}, {0x1D6FC, 0x1D714},
- {0x1D715, 0x1D715}, {0x1D716, 0x1D734}, {0x1D735, 0x1D735},
- {0x1D736, 0x1D74E}, {0x1D74F, 0x1D74F}, {0x1D750, 0x1D76E},
- {0x1D76F, 0x1D76F}, {0x1D770, 0x1D788}, {0x1D789, 0x1D789},
- {0x1D78A, 0x1D7A8}, {0x1D7A9, 0x1D7A9}, {0x1D7AA, 0x1D7C2},
- {0x1D7C3, 0x1D7C3}, {0x1D7C4, 0x1D7CB}, {0x1D7CE, 0x1D7FF},
- {0x1D800, 0x1D9FF}, {0x1DA00, 0x1DA36}, {0x1DA37, 0x1DA3A},
- {0x1DA3B, 0x1DA6C}, {0x1DA6D, 0x1DA74}, {0x1DA75, 0x1DA75},
- {0x1DA76, 0x1DA83}, {0x1DA84, 0x1DA84}, {0x1DA85, 0x1DA86},
- {0x1DA87, 0x1DA8B}, {0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF},
- {0x1E000, 0x1E006}, {0x1E008, 0x1E018}, {0x1E01B, 0x1E021},
- {0x1E023, 0x1E024}, {0x1E026, 0x1E02A}, {0x1E800, 0x1E8C4},
- {0x1E8C7, 0x1E8CF}, {0x1E8D0, 0x1E8D6}, {0x1E900, 0x1E943},
- {0x1E944, 0x1E94A}, {0x1E950, 0x1E959}, {0x1E95E, 0x1E95F},
- {0x1EE00, 0x1EE03}, {0x1EE05, 0x1EE1F}, {0x1EE21, 0x1EE22},
- {0x1EE24, 0x1EE24}, {0x1EE27, 0x1EE27}, {0x1EE29, 0x1EE32},
- {0x1EE34, 0x1EE37}, {0x1EE39, 0x1EE39}, {0x1EE3B, 0x1EE3B},
- {0x1EE42, 0x1EE42}, {0x1EE47, 0x1EE47}, {0x1EE49, 0x1EE49},
- {0x1EE4B, 0x1EE4B}, {0x1EE4D, 0x1EE4F}, {0x1EE51, 0x1EE52},
- {0x1EE54, 0x1EE54}, {0x1EE57, 0x1EE57}, {0x1EE59, 0x1EE59},
- {0x1EE5B, 0x1EE5B}, {0x1EE5D, 0x1EE5D}, {0x1EE5F, 0x1EE5F},
- {0x1EE61, 0x1EE62}, {0x1EE64, 0x1EE64}, {0x1EE67, 0x1EE6A},
- {0x1EE6C, 0x1EE72}, {0x1EE74, 0x1EE77}, {0x1EE79, 0x1EE7C},
- {0x1EE7E, 0x1EE7E}, {0x1EE80, 0x1EE89}, {0x1EE8B, 0x1EE9B},
- {0x1EEA1, 0x1EEA3}, {0x1EEA5, 0x1EEA9}, {0x1EEAB, 0x1EEBB},
- {0x1EEF0, 0x1EEF1}, {0x1F000, 0x1F003}, {0x1F005, 0x1F02B},
- {0x1F030, 0x1F093}, {0x1F0A0, 0x1F0AE}, {0x1F0B1, 0x1F0BF},
- {0x1F0C1, 0x1F0CE}, {0x1F0D1, 0x1F0F5}, {0x1F10B, 0x1F10C},
- {0x1F12E, 0x1F12E}, {0x1F16A, 0x1F16B}, {0x1F1E6, 0x1F1FF},
- {0x1F321, 0x1F32C}, {0x1F336, 0x1F336}, {0x1F37D, 0x1F37D},
- {0x1F394, 0x1F39F}, {0x1F3CB, 0x1F3CE}, {0x1F3D4, 0x1F3DF},
- {0x1F3F1, 0x1F3F3}, {0x1F3F5, 0x1F3F7}, {0x1F43F, 0x1F43F},
- {0x1F441, 0x1F441}, {0x1F4FD, 0x1F4FE}, {0x1F53E, 0x1F54A},
- {0x1F54F, 0x1F54F}, {0x1F568, 0x1F579}, {0x1F57B, 0x1F594},
- {0x1F597, 0x1F5A3}, {0x1F5A5, 0x1F5FA}, {0x1F650, 0x1F67F},
- {0x1F6C6, 0x1F6CB}, {0x1F6CD, 0x1F6CF}, {0x1F6E0, 0x1F6EA},
- {0x1F6F0, 0x1F6F3}, {0x1F700, 0x1F773}, {0x1F780, 0x1F7D4},
- {0x1F800, 0x1F80B}, {0x1F810, 0x1F847}, {0x1F850, 0x1F859},
- {0x1F860, 0x1F887}, {0x1F890, 0x1F8AD}, {0xE0001, 0xE0001},
- {0xE0020, 0xE007F},
-}
-
-// Condition have flag EastAsianWidth whether the current locale is CJK or not.
-type Condition struct {
- EastAsianWidth bool
-}
-
-// NewCondition return new instance of Condition which is current locale.
-func NewCondition() *Condition {
- return &Condition{EastAsianWidth}
-}
-
-// RuneWidth returns the number of cells in r.
-// See http://www.unicode.org/reports/tr11/
-func (c *Condition) RuneWidth(r rune) int {
- switch {
- case r < 0 || r > 0x10FFFF ||
- inTables(r, nonprint, combining, notassigned):
- return 0
- case (c.EastAsianWidth && IsAmbiguousWidth(r)) ||
- inTables(r, doublewidth, emoji):
- return 2
- default:
- return 1
- }
-}
-
-// StringWidth return width as you can see
-func (c *Condition) StringWidth(s string) (width int) {
- for _, r := range []rune(s) {
- width += c.RuneWidth(r)
- }
- return width
-}
-
-// Truncate return string truncated with w cells
-func (c *Condition) Truncate(s string, w int, tail string) string {
- if c.StringWidth(s) <= w {
- return s
- }
- r := []rune(s)
- tw := c.StringWidth(tail)
- w -= tw
- width := 0
- i := 0
- for ; i < len(r); i++ {
- cw := c.RuneWidth(r[i])
- if width+cw > w {
- break
- }
- width += cw
- }
- return string(r[0:i]) + tail
-}
-
-// Wrap return string wrapped with w cells
-func (c *Condition) Wrap(s string, w int) string {
- width := 0
- out := ""
- for _, r := range []rune(s) {
- cw := RuneWidth(r)
- if r == '\n' {
- out += string(r)
- width = 0
- continue
- } else if width+cw > w {
- out += "\n"
- width = 0
- out += string(r)
- width += cw
- continue
- }
- out += string(r)
- width += cw
- }
- return out
-}
-
-// FillLeft return string filled in left by spaces in w cells
-func (c *Condition) FillLeft(s string, w int) string {
- width := c.StringWidth(s)
- count := w - width
- if count > 0 {
- b := make([]byte, count)
- for i := range b {
- b[i] = ' '
- }
- return string(b) + s
- }
- return s
-}
-
-// FillRight return string filled in left by spaces in w cells
-func (c *Condition) FillRight(s string, w int) string {
- width := c.StringWidth(s)
- count := w - width
- if count > 0 {
- b := make([]byte, count)
- for i := range b {
- b[i] = ' '
- }
- return s + string(b)
- }
- return s
-}
-
-// RuneWidth returns the number of cells in r.
-// See http://www.unicode.org/reports/tr11/
-func RuneWidth(r rune) int {
- return DefaultCondition.RuneWidth(r)
-}
-
-// IsAmbiguousWidth returns whether is ambiguous width or not.
-func IsAmbiguousWidth(r rune) bool {
- return inTables(r, private, ambiguous)
-}
-
-// IsNeutralWidth returns whether is neutral width or not.
-func IsNeutralWidth(r rune) bool {
- return inTable(r, neutral)
-}
-
-// StringWidth return width as you can see
-func StringWidth(s string) (width int) {
- return DefaultCondition.StringWidth(s)
-}
-
-// Truncate return string truncated with w cells
-func Truncate(s string, w int, tail string) string {
- return DefaultCondition.Truncate(s, w, tail)
-}
-
-// Wrap return string wrapped with w cells
-func Wrap(s string, w int) string {
- return DefaultCondition.Wrap(s, w)
-}
-
-// FillLeft return string filled in left by spaces in w cells
-func FillLeft(s string, w int) string {
- return DefaultCondition.FillLeft(s, w)
-}
-
-// FillRight return string filled in left by spaces in w cells
-func FillRight(s string, w int) string {
- return DefaultCondition.FillRight(s, w)
-}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_js.go b/vendor/github.com/mattn/go-runewidth/runewidth_js.go
deleted file mode 100644
index 0ce32c5e7b71b9cb5326226e8d6ecc85057f3ea9..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth_js.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// +build js
-
-package runewidth
-
-func IsEastAsian() bool {
- // TODO: Implement this for the web. Detect east asian in a compatible way, and return true.
- return false
-}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_posix.go b/vendor/github.com/mattn/go-runewidth/runewidth_posix.go
deleted file mode 100644
index c579e9a31443dafcb7f9e64e139afa962ca8e8a8..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth_posix.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// +build !windows,!js
-
-package runewidth
-
-import (
- "os"
- "regexp"
- "strings"
-)
-
-var reLoc = regexp.MustCompile(`^[a-z][a-z][a-z]?(?:_[A-Z][A-Z])?\.(.+)`)
-
-var mblenTable = map[string]int{
- "utf-8": 6,
- "utf8": 6,
- "jis": 8,
- "eucjp": 3,
- "euckr": 2,
- "euccn": 2,
- "sjis": 2,
- "cp932": 2,
- "cp51932": 2,
- "cp936": 2,
- "cp949": 2,
- "cp950": 2,
- "big5": 2,
- "gbk": 2,
- "gb2312": 2,
-}
-
-func isEastAsian(locale string) bool {
- charset := strings.ToLower(locale)
- r := reLoc.FindStringSubmatch(locale)
- if len(r) == 2 {
- charset = strings.ToLower(r[1])
- }
-
- if strings.HasSuffix(charset, "@cjk_narrow") {
- return false
- }
-
- for pos, b := range []byte(charset) {
- if b == '@' {
- charset = charset[:pos]
- break
- }
- }
- max := 1
- if m, ok := mblenTable[charset]; ok {
- max = m
- }
- if max > 1 && (charset[0] != 'u' ||
- strings.HasPrefix(locale, "ja") ||
- strings.HasPrefix(locale, "ko") ||
- strings.HasPrefix(locale, "zh")) {
- return true
- }
- return false
-}
-
-// IsEastAsian return true if the current locale is CJK
-func IsEastAsian() bool {
- locale := os.Getenv("LC_CTYPE")
- if locale == "" {
- locale = os.Getenv("LANG")
- }
-
- // ignore C locale
- if locale == "POSIX" || locale == "C" {
- return false
- }
- if len(locale) > 1 && locale[0] == 'C' && (locale[1] == '.' || locale[1] == '-') {
- return false
- }
-
- return isEastAsian(locale)
-}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_windows.go b/vendor/github.com/mattn/go-runewidth/runewidth_windows.go
deleted file mode 100644
index 0258876b99dd024c5986b2c3de23ff20a3ad8db3..0000000000000000000000000000000000000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth_windows.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package runewidth
-
-import (
- "syscall"
-)
-
-var (
- kernel32 = syscall.NewLazyDLL("kernel32")
- procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP")
-)
-
-// IsEastAsian return true if the current locale is CJK
-func IsEastAsian() bool {
- r1, _, _ := procGetConsoleOutputCP.Call()
- if r1 == 0 {
- return false
- }
-
- switch int(r1) {
- case 932, 51932, 936, 949, 950:
- return true
- }
-
- return false
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/.travis.yml b/vendor/github.com/mitchellh/mapstructure/.travis.yml
deleted file mode 100644
index d9deadb86d13ad46e7deb5a5d4fcbfcea5c1b2b6..0000000000000000000000000000000000000000
--- a/vendor/github.com/mitchellh/mapstructure/.travis.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-language: go
-
-go:
- - 1.9.x
- - tip
-
-script:
- - go test
diff --git a/vendor/github.com/mitchellh/mapstructure/LICENSE b/vendor/github.com/mitchellh/mapstructure/LICENSE
deleted file mode 100644
index f9c841a51e0d11ec20c19ff7600e88da826867fa..0000000000000000000000000000000000000000
--- a/vendor/github.com/mitchellh/mapstructure/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Mitchell Hashimoto
-
-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/mitchellh/mapstructure/README.md b/vendor/github.com/mitchellh/mapstructure/README.md
deleted file mode 100644
index 0018dc7d9f947b11a11bf33ee6eda3e67decf1a2..0000000000000000000000000000000000000000
--- a/vendor/github.com/mitchellh/mapstructure/README.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# mapstructure [](https://godoc.org/github.com/mitchellh/mapstructure)
-
-mapstructure is a Go library for decoding generic map values to structures
-and vice versa, while providing helpful error handling.
-
-This library is most useful when decoding values from some data stream (JSON,
-Gob, etc.) where you don't _quite_ know the structure of the underlying data
-until you read a part of it. You can therefore read a `map[string]interface{}`
-and use this library to decode it into the proper underlying native Go
-structure.
-
-## Installation
-
-Standard `go get`:
-
-```
-$ go get github.com/mitchellh/mapstructure
-```
-
-## Usage & Example
-
-For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/mapstructure).
-
-The `Decode` function has examples associated with it there.
-
-## But Why?!
-
-Go offers fantastic standard libraries for decoding formats such as JSON.
-The standard method is to have a struct pre-created, and populate that struct
-from the bytes of the encoded format. This is great, but the problem is if
-you have configuration or an encoding that changes slightly depending on
-specific fields. For example, consider this JSON:
-
-```json
-{
- "type": "person",
- "name": "Mitchell"
-}
-```
-
-Perhaps we can't populate a specific structure without first reading
-the "type" field from the JSON. We could always do two passes over the
-decoding of the JSON (reading the "type" first, and the rest later).
-However, it is much simpler to just decode this into a `map[string]interface{}`
-structure, read the "type" key, then use something like this library
-to decode it into the proper structure.
diff --git a/vendor/github.com/mitchellh/mapstructure/decode_hooks.go b/vendor/github.com/mitchellh/mapstructure/decode_hooks.go
deleted file mode 100644
index 2a727575a3557769cc6441375d8e4992a535df74..0000000000000000000000000000000000000000
--- a/vendor/github.com/mitchellh/mapstructure/decode_hooks.go
+++ /dev/null
@@ -1,171 +0,0 @@
-package mapstructure
-
-import (
- "errors"
- "reflect"
- "strconv"
- "strings"
- "time"
-)
-
-// typedDecodeHook takes a raw DecodeHookFunc (an interface{}) and turns
-// it into the proper DecodeHookFunc type, such as DecodeHookFuncType.
-func typedDecodeHook(h DecodeHookFunc) DecodeHookFunc {
- // Create variables here so we can reference them with the reflect pkg
- var f1 DecodeHookFuncType
- var f2 DecodeHookFuncKind
-
- // Fill in the variables into this interface and the rest is done
- // automatically using the reflect package.
- potential := []interface{}{f1, f2}
-
- v := reflect.ValueOf(h)
- vt := v.Type()
- for _, raw := range potential {
- pt := reflect.ValueOf(raw).Type()
- if vt.ConvertibleTo(pt) {
- return v.Convert(pt).Interface()
- }
- }
-
- return nil
-}
-
-// DecodeHookExec executes the given decode hook. This should be used
-// since it'll naturally degrade to the older backwards compatible DecodeHookFunc
-// that took reflect.Kind instead of reflect.Type.
-func DecodeHookExec(
- raw DecodeHookFunc,
- from reflect.Type, to reflect.Type,
- data interface{}) (interface{}, error) {
- switch f := typedDecodeHook(raw).(type) {
- case DecodeHookFuncType:
- return f(from, to, data)
- case DecodeHookFuncKind:
- return f(from.Kind(), to.Kind(), data)
- default:
- return nil, errors.New("invalid decode hook signature")
- }
-}
-
-// ComposeDecodeHookFunc creates a single DecodeHookFunc that
-// automatically composes multiple DecodeHookFuncs.
-//
-// The composed funcs are called in order, with the result of the
-// previous transformation.
-func ComposeDecodeHookFunc(fs ...DecodeHookFunc) DecodeHookFunc {
- return func(
- f reflect.Type,
- t reflect.Type,
- data interface{}) (interface{}, error) {
- var err error
- for _, f1 := range fs {
- data, err = DecodeHookExec(f1, f, t, data)
- if err != nil {
- return nil, err
- }
-
- // Modify the from kind to be correct with the new data
- f = nil
- if val := reflect.ValueOf(data); val.IsValid() {
- f = val.Type()
- }
- }
-
- return data, nil
- }
-}
-
-// StringToSliceHookFunc returns a DecodeHookFunc that converts
-// string to []string by splitting on the given sep.
-func StringToSliceHookFunc(sep string) DecodeHookFunc {
- return func(
- f reflect.Kind,
- t reflect.Kind,
- data interface{}) (interface{}, error) {
- if f != reflect.String || t != reflect.Slice {
- return data, nil
- }
-
- raw := data.(string)
- if raw == "" {
- return []string{}, nil
- }
-
- return strings.Split(raw, sep), nil
- }
-}
-
-// StringToTimeDurationHookFunc returns a DecodeHookFunc that converts
-// strings to time.Duration.
-func StringToTimeDurationHookFunc() DecodeHookFunc {
- return func(
- f reflect.Type,
- t reflect.Type,
- data interface{}) (interface{}, error) {
- if f.Kind() != reflect.String {
- return data, nil
- }
- if t != reflect.TypeOf(time.Duration(5)) {
- return data, nil
- }
-
- // Convert it by parsing
- return time.ParseDuration(data.(string))
- }
-}
-
-// StringToTimeHookFunc returns a DecodeHookFunc that converts
-// strings to time.Time.
-func StringToTimeHookFunc(layout string) DecodeHookFunc {
- return func(
- f reflect.Type,
- t reflect.Type,
- data interface{}) (interface{}, error) {
- if f.Kind() != reflect.String {
- return data, nil
- }
- if t != reflect.TypeOf(time.Time{}) {
- return data, nil
- }
-
- // Convert it by parsing
- return time.Parse(layout, data.(string))
- }
-}
-
-// WeaklyTypedHook is a DecodeHookFunc which adds support for weak typing to
-// the decoder.
-//
-// Note that this is significantly different from the WeaklyTypedInput option
-// of the DecoderConfig.
-func WeaklyTypedHook(
- f reflect.Kind,
- t reflect.Kind,
- data interface{}) (interface{}, error) {
- dataVal := reflect.ValueOf(data)
- switch t {
- case reflect.String:
- switch f {
- case reflect.Bool:
- if dataVal.Bool() {
- return "1", nil
- }
- return "0", nil
- case reflect.Float32:
- return strconv.FormatFloat(dataVal.Float(), 'f', -1, 64), nil
- case reflect.Int:
- return strconv.FormatInt(dataVal.Int(), 10), nil
- case reflect.Slice:
- dataType := dataVal.Type()
- elemKind := dataType.Elem().Kind()
- if elemKind == reflect.Uint8 {
- return string(dataVal.Interface().([]uint8)), nil
- }
- case reflect.Uint:
- return strconv.FormatUint(dataVal.Uint(), 10), nil
- }
- }
-
- return data, nil
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/error.go b/vendor/github.com/mitchellh/mapstructure/error.go
deleted file mode 100644
index 47a99e5af3f1b700db374eca24b48d9d8fc21647..0000000000000000000000000000000000000000
--- a/vendor/github.com/mitchellh/mapstructure/error.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package mapstructure
-
-import (
- "errors"
- "fmt"
- "sort"
- "strings"
-)
-
-// Error implements the error interface and can represents multiple
-// errors that occur in the course of a single decode.
-type Error struct {
- Errors []string
-}
-
-func (e *Error) Error() string {
- points := make([]string, len(e.Errors))
- for i, err := range e.Errors {
- points[i] = fmt.Sprintf("* %s", err)
- }
-
- sort.Strings(points)
- return fmt.Sprintf(
- "%d error(s) decoding:\n\n%s",
- len(e.Errors), strings.Join(points, "\n"))
-}
-
-// WrappedErrors implements the errwrap.Wrapper interface to make this
-// return value more useful with the errwrap and go-multierror libraries.
-func (e *Error) WrappedErrors() []error {
- if e == nil {
- return nil
- }
-
- result := make([]error, len(e.Errors))
- for i, e := range e.Errors {
- result[i] = errors.New(e)
- }
-
- return result
-}
-
-func appendErrors(errors []string, err error) []string {
- switch e := err.(type) {
- case *Error:
- return append(errors, e.Errors...)
- default:
- return append(errors, e.Error())
- }
-}
diff --git a/vendor/github.com/mitchellh/mapstructure/go.mod b/vendor/github.com/mitchellh/mapstructure/go.mod
deleted file mode 100644
index d2a712562082b024b65990deee0d27c643f8073b..0000000000000000000000000000000000000000
--- a/vendor/github.com/mitchellh/mapstructure/go.mod
+++ /dev/null
@@ -1 +0,0 @@
-module github.com/mitchellh/mapstructure
diff --git a/vendor/github.com/mitchellh/mapstructure/mapstructure.go b/vendor/github.com/mitchellh/mapstructure/mapstructure.go
deleted file mode 100644
index d3222b8f4d386b19c651f85dd4567bdc247d0d85..0000000000000000000000000000000000000000
--- a/vendor/github.com/mitchellh/mapstructure/mapstructure.go
+++ /dev/null
@@ -1,1064 +0,0 @@
-// Package mapstructure exposes functionality to convert an arbitrary
-// map[string]interface{} into a native Go structure.
-//
-// The Go structure can be arbitrarily complex, containing slices,
-// other structs, etc. and the decoder will properly decode nested
-// maps and so on into the proper structures in the native Go struct.
-// See the examples to see what the decoder is capable of.
-package mapstructure
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "reflect"
- "sort"
- "strconv"
- "strings"
-)
-
-// DecodeHookFunc is the callback function that can be used for
-// data transformations. See "DecodeHook" in the DecoderConfig
-// struct.
-//
-// The type should be DecodeHookFuncType or DecodeHookFuncKind.
-// Either is accepted. Types are a superset of Kinds (Types can return
-// Kinds) and are generally a richer thing to use, but Kinds are simpler
-// if you only need those.
-//
-// The reason DecodeHookFunc is multi-typed is for backwards compatibility:
-// we started with Kinds and then realized Types were the better solution,
-// but have a promise to not break backwards compat so we now support
-// both.
-type DecodeHookFunc interface{}
-
-// DecodeHookFuncType is a DecodeHookFunc which has complete information about
-// the source and target types.
-type DecodeHookFuncType func(reflect.Type, reflect.Type, interface{}) (interface{}, error)
-
-// DecodeHookFuncKind is a DecodeHookFunc which knows only the Kinds of the
-// source and target types.
-type DecodeHookFuncKind func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error)
-
-// DecoderConfig is the configuration that is used to create a new decoder
-// and allows customization of various aspects of decoding.
-type DecoderConfig struct {
- // DecodeHook, if set, will be called before any decoding and any
- // type conversion (if WeaklyTypedInput is on). This lets you modify
- // the values before they're set down onto the resulting struct.
- //
- // If an error is returned, the entire decode will fail with that
- // error.
- DecodeHook DecodeHookFunc
-
- // If ErrorUnused is true, then it is an error for there to exist
- // keys in the original map that were unused in the decoding process
- // (extra keys).
- ErrorUnused bool
-
- // ZeroFields, if set to true, will zero fields before writing them.
- // For example, a map will be emptied before decoded values are put in
- // it. If this is false, a map will be merged.
- ZeroFields bool
-
- // If WeaklyTypedInput is true, the decoder will make the following
- // "weak" conversions:
- //
- // - bools to string (true = "1", false = "0")
- // - numbers to string (base 10)
- // - bools to int/uint (true = 1, false = 0)
- // - strings to int/uint (base implied by prefix)
- // - int to bool (true if value != 0)
- // - string to bool (accepts: 1, t, T, TRUE, true, True, 0, f, F,
- // FALSE, false, False. Anything else is an error)
- // - empty array = empty map and vice versa
- // - negative numbers to overflowed uint values (base 10)
- // - slice of maps to a merged map
- // - single values are converted to slices if required. Each
- // element is weakly decoded. For example: "4" can become []int{4}
- // if the target type is an int slice.
- //
- WeaklyTypedInput bool
-
- // Metadata is the struct that will contain extra metadata about
- // the decoding. If this is nil, then no metadata will be tracked.
- Metadata *Metadata
-
- // Result is a pointer to the struct that will contain the decoded
- // value.
- Result interface{}
-
- // The tag name that mapstructure reads for field names. This
- // defaults to "mapstructure"
- TagName string
-}
-
-// A Decoder takes a raw interface value and turns it into structured
-// data, keeping track of rich error information along the way in case
-// anything goes wrong. Unlike the basic top-level Decode method, you can
-// more finely control how the Decoder behaves using the DecoderConfig
-// structure. The top-level Decode method is just a convenience that sets
-// up the most basic Decoder.
-type Decoder struct {
- config *DecoderConfig
-}
-
-// Metadata contains information about decoding a structure that
-// is tedious or difficult to get otherwise.
-type Metadata struct {
- // Keys are the keys of the structure which were successfully decoded
- Keys []string
-
- // Unused is a slice of keys that were found in the raw value but
- // weren't decoded since there was no matching field in the result interface
- Unused []string
-}
-
-// Decode takes an input structure and uses reflection to translate it to
-// the output structure. output must be a pointer to a map or struct.
-func Decode(input interface{}, output interface{}) error {
- config := &DecoderConfig{
- Metadata: nil,
- Result: output,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- return err
- }
-
- return decoder.Decode(input)
-}
-
-// WeakDecode is the same as Decode but is shorthand to enable
-// WeaklyTypedInput. See DecoderConfig for more info.
-func WeakDecode(input, output interface{}) error {
- config := &DecoderConfig{
- Metadata: nil,
- Result: output,
- WeaklyTypedInput: true,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- return err
- }
-
- return decoder.Decode(input)
-}
-
-// DecodeMetadata is the same as Decode, but is shorthand to
-// enable metadata collection. See DecoderConfig for more info.
-func DecodeMetadata(input interface{}, output interface{}, metadata *Metadata) error {
- config := &DecoderConfig{
- Metadata: metadata,
- Result: output,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- return err
- }
-
- return decoder.Decode(input)
-}
-
-// WeakDecodeMetadata is the same as Decode, but is shorthand to
-// enable both WeaklyTypedInput and metadata collection. See
-// DecoderConfig for more info.
-func WeakDecodeMetadata(input interface{}, output interface{}, metadata *Metadata) error {
- config := &DecoderConfig{
- Metadata: metadata,
- Result: output,
- WeaklyTypedInput: true,
- }
-
- decoder, err := NewDecoder(config)
- if err != nil {
- return err
- }
-
- return decoder.Decode(input)
-}
-
-// NewDecoder returns a new decoder for the given configuration. Once
-// a decoder has been returned, the same configuration must not be used
-// again.
-func NewDecoder(config *DecoderConfig) (*Decoder, error) {
- val := reflect.ValueOf(config.Result)
- if val.Kind() != reflect.Ptr {
- return nil, errors.New("result must be a pointer")
- }
-
- val = val.Elem()
- if !val.CanAddr() {
- return nil, errors.New("result must be addressable (a pointer)")
- }
-
- if config.Metadata != nil {
- if config.Metadata.Keys == nil {
- config.Metadata.Keys = make([]string, 0)
- }
-
- if config.Metadata.Unused == nil {
- config.Metadata.Unused = make([]string, 0)
- }
- }
-
- if config.TagName == "" {
- config.TagName = "mapstructure"
- }
-
- result := &Decoder{
- config: config,
- }
-
- return result, nil
-}
-
-// Decode decodes the given raw interface to the target pointer specified
-// by the configuration.
-func (d *Decoder) Decode(input interface{}) error {
- return d.decode("", input, reflect.ValueOf(d.config.Result).Elem())
-}
-
-// Decodes an unknown data type into a specific reflection value.
-func (d *Decoder) decode(name string, input interface{}, outVal reflect.Value) error {
- if input == nil {
- // If the data is nil, then we don't set anything, unless ZeroFields is set
- // to true.
- if d.config.ZeroFields {
- outVal.Set(reflect.Zero(outVal.Type()))
-
- if d.config.Metadata != nil && name != "" {
- d.config.Metadata.Keys = append(d.config.Metadata.Keys, name)
- }
- }
- return nil
- }
-
- inputVal := reflect.ValueOf(input)
- if !inputVal.IsValid() {
- // If the input value is invalid, then we just set the value
- // to be the zero value.
- outVal.Set(reflect.Zero(outVal.Type()))
- if d.config.Metadata != nil && name != "" {
- d.config.Metadata.Keys = append(d.config.Metadata.Keys, name)
- }
- return nil
- }
-
- if d.config.DecodeHook != nil {
- // We have a DecodeHook, so let's pre-process the input.
- var err error
- input, err = DecodeHookExec(
- d.config.DecodeHook,
- inputVal.Type(), outVal.Type(), input)
- if err != nil {
- return fmt.Errorf("error decoding '%s': %s", name, err)
- }
- }
-
- var err error
- inputKind := getKind(outVal)
- switch inputKind {
- case reflect.Bool:
- err = d.decodeBool(name, input, outVal)
- case reflect.Interface:
- err = d.decodeBasic(name, input, outVal)
- case reflect.String:
- err = d.decodeString(name, input, outVal)
- case reflect.Int:
- err = d.decodeInt(name, input, outVal)
- case reflect.Uint:
- err = d.decodeUint(name, input, outVal)
- case reflect.Float32:
- err = d.decodeFloat(name, input, outVal)
- case reflect.Struct:
- err = d.decodeStruct(name, input, outVal)
- case reflect.Map:
- err = d.decodeMap(name, input, outVal)
- case reflect.Ptr:
- err = d.decodePtr(name, input, outVal)
- case reflect.Slice:
- err = d.decodeSlice(name, input, outVal)
- case reflect.Array:
- err = d.decodeArray(name, input, outVal)
- case reflect.Func:
- err = d.decodeFunc(name, input, outVal)
- default:
- // If we reached this point then we weren't able to decode it
- return fmt.Errorf("%s: unsupported type: %s", name, inputKind)
- }
-
- // If we reached here, then we successfully decoded SOMETHING, so
- // mark the key as used if we're tracking metainput.
- if d.config.Metadata != nil && name != "" {
- d.config.Metadata.Keys = append(d.config.Metadata.Keys, name)
- }
-
- return err
-}
-
-// This decodes a basic type (bool, int, string, etc.) and sets the
-// value to "data" of that type.
-func (d *Decoder) decodeBasic(name string, data interface{}, val reflect.Value) error {
- if val.IsValid() && val.Elem().IsValid() {
- return d.decode(name, data, val.Elem())
- }
- dataVal := reflect.ValueOf(data)
- if !dataVal.IsValid() {
- dataVal = reflect.Zero(val.Type())
- }
-
- dataValType := dataVal.Type()
- if !dataValType.AssignableTo(val.Type()) {
- return fmt.Errorf(
- "'%s' expected type '%s', got '%s'",
- name, val.Type(), dataValType)
- }
-
- val.Set(dataVal)
- return nil
-}
-
-func (d *Decoder) decodeString(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
-
- converted := true
- switch {
- case dataKind == reflect.String:
- val.SetString(dataVal.String())
- case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
- if dataVal.Bool() {
- val.SetString("1")
- } else {
- val.SetString("0")
- }
- case dataKind == reflect.Int && d.config.WeaklyTypedInput:
- val.SetString(strconv.FormatInt(dataVal.Int(), 10))
- case dataKind == reflect.Uint && d.config.WeaklyTypedInput:
- val.SetString(strconv.FormatUint(dataVal.Uint(), 10))
- case dataKind == reflect.Float32 && d.config.WeaklyTypedInput:
- val.SetString(strconv.FormatFloat(dataVal.Float(), 'f', -1, 64))
- case dataKind == reflect.Slice && d.config.WeaklyTypedInput,
- dataKind == reflect.Array && d.config.WeaklyTypedInput:
- dataType := dataVal.Type()
- elemKind := dataType.Elem().Kind()
- switch elemKind {
- case reflect.Uint8:
- var uints []uint8
- if dataKind == reflect.Array {
- uints = make([]uint8, dataVal.Len(), dataVal.Len())
- for i := range uints {
- uints[i] = dataVal.Index(i).Interface().(uint8)
- }
- } else {
- uints = dataVal.Interface().([]uint8)
- }
- val.SetString(string(uints))
- default:
- converted = false
- }
- default:
- converted = false
- }
-
- if !converted {
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeInt(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
- dataType := dataVal.Type()
-
- switch {
- case dataKind == reflect.Int:
- val.SetInt(dataVal.Int())
- case dataKind == reflect.Uint:
- val.SetInt(int64(dataVal.Uint()))
- case dataKind == reflect.Float32:
- val.SetInt(int64(dataVal.Float()))
- case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
- if dataVal.Bool() {
- val.SetInt(1)
- } else {
- val.SetInt(0)
- }
- case dataKind == reflect.String && d.config.WeaklyTypedInput:
- i, err := strconv.ParseInt(dataVal.String(), 0, val.Type().Bits())
- if err == nil {
- val.SetInt(i)
- } else {
- return fmt.Errorf("cannot parse '%s' as int: %s", name, err)
- }
- case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number":
- jn := data.(json.Number)
- i, err := jn.Int64()
- if err != nil {
- return fmt.Errorf(
- "error decoding json.Number into %s: %s", name, err)
- }
- val.SetInt(i)
- default:
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeUint(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
-
- switch {
- case dataKind == reflect.Int:
- i := dataVal.Int()
- if i < 0 && !d.config.WeaklyTypedInput {
- return fmt.Errorf("cannot parse '%s', %d overflows uint",
- name, i)
- }
- val.SetUint(uint64(i))
- case dataKind == reflect.Uint:
- val.SetUint(dataVal.Uint())
- case dataKind == reflect.Float32:
- f := dataVal.Float()
- if f < 0 && !d.config.WeaklyTypedInput {
- return fmt.Errorf("cannot parse '%s', %f overflows uint",
- name, f)
- }
- val.SetUint(uint64(f))
- case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
- if dataVal.Bool() {
- val.SetUint(1)
- } else {
- val.SetUint(0)
- }
- case dataKind == reflect.String && d.config.WeaklyTypedInput:
- i, err := strconv.ParseUint(dataVal.String(), 0, val.Type().Bits())
- if err == nil {
- val.SetUint(i)
- } else {
- return fmt.Errorf("cannot parse '%s' as uint: %s", name, err)
- }
- default:
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeBool(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
-
- switch {
- case dataKind == reflect.Bool:
- val.SetBool(dataVal.Bool())
- case dataKind == reflect.Int && d.config.WeaklyTypedInput:
- val.SetBool(dataVal.Int() != 0)
- case dataKind == reflect.Uint && d.config.WeaklyTypedInput:
- val.SetBool(dataVal.Uint() != 0)
- case dataKind == reflect.Float32 && d.config.WeaklyTypedInput:
- val.SetBool(dataVal.Float() != 0)
- case dataKind == reflect.String && d.config.WeaklyTypedInput:
- b, err := strconv.ParseBool(dataVal.String())
- if err == nil {
- val.SetBool(b)
- } else if dataVal.String() == "" {
- val.SetBool(false)
- } else {
- return fmt.Errorf("cannot parse '%s' as bool: %s", name, err)
- }
- default:
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeFloat(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.ValueOf(data)
- dataKind := getKind(dataVal)
- dataType := dataVal.Type()
-
- switch {
- case dataKind == reflect.Int:
- val.SetFloat(float64(dataVal.Int()))
- case dataKind == reflect.Uint:
- val.SetFloat(float64(dataVal.Uint()))
- case dataKind == reflect.Float32:
- val.SetFloat(dataVal.Float())
- case dataKind == reflect.Bool && d.config.WeaklyTypedInput:
- if dataVal.Bool() {
- val.SetFloat(1)
- } else {
- val.SetFloat(0)
- }
- case dataKind == reflect.String && d.config.WeaklyTypedInput:
- f, err := strconv.ParseFloat(dataVal.String(), val.Type().Bits())
- if err == nil {
- val.SetFloat(f)
- } else {
- return fmt.Errorf("cannot parse '%s' as float: %s", name, err)
- }
- case dataType.PkgPath() == "encoding/json" && dataType.Name() == "Number":
- jn := data.(json.Number)
- i, err := jn.Float64()
- if err != nil {
- return fmt.Errorf(
- "error decoding json.Number into %s: %s", name, err)
- }
- val.SetFloat(i)
- default:
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
-
- return nil
-}
-
-func (d *Decoder) decodeMap(name string, data interface{}, val reflect.Value) error {
- valType := val.Type()
- valKeyType := valType.Key()
- valElemType := valType.Elem()
-
- // By default we overwrite keys in the current map
- valMap := val
-
- // If the map is nil or we're purposely zeroing fields, make a new map
- if valMap.IsNil() || d.config.ZeroFields {
- // Make a new map to hold our result
- mapType := reflect.MapOf(valKeyType, valElemType)
- valMap = reflect.MakeMap(mapType)
- }
-
- // Check input type and based on the input type jump to the proper func
- dataVal := reflect.Indirect(reflect.ValueOf(data))
- switch dataVal.Kind() {
- case reflect.Map:
- return d.decodeMapFromMap(name, dataVal, val, valMap)
-
- case reflect.Struct:
- return d.decodeMapFromStruct(name, dataVal, val, valMap)
-
- case reflect.Array, reflect.Slice:
- if d.config.WeaklyTypedInput {
- return d.decodeMapFromSlice(name, dataVal, val, valMap)
- }
-
- fallthrough
-
- default:
- return fmt.Errorf("'%s' expected a map, got '%s'", name, dataVal.Kind())
- }
-}
-
-func (d *Decoder) decodeMapFromSlice(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error {
- // Special case for BC reasons (covered by tests)
- if dataVal.Len() == 0 {
- val.Set(valMap)
- return nil
- }
-
- for i := 0; i < dataVal.Len(); i++ {
- err := d.decode(
- fmt.Sprintf("%s[%d]", name, i),
- dataVal.Index(i).Interface(), val)
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func (d *Decoder) decodeMapFromMap(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error {
- valType := val.Type()
- valKeyType := valType.Key()
- valElemType := valType.Elem()
-
- // Accumulate errors
- errors := make([]string, 0)
-
- for _, k := range dataVal.MapKeys() {
- fieldName := fmt.Sprintf("%s[%s]", name, k)
-
- // First decode the key into the proper type
- currentKey := reflect.Indirect(reflect.New(valKeyType))
- if err := d.decode(fieldName, k.Interface(), currentKey); err != nil {
- errors = appendErrors(errors, err)
- continue
- }
-
- // Next decode the data into the proper type
- v := dataVal.MapIndex(k).Interface()
- currentVal := reflect.Indirect(reflect.New(valElemType))
- if err := d.decode(fieldName, v, currentVal); err != nil {
- errors = appendErrors(errors, err)
- continue
- }
-
- valMap.SetMapIndex(currentKey, currentVal)
- }
-
- // Set the built up map to the value
- val.Set(valMap)
-
- // If we had errors, return those
- if len(errors) > 0 {
- return &Error{errors}
- }
-
- return nil
-}
-
-func (d *Decoder) decodeMapFromStruct(name string, dataVal reflect.Value, val reflect.Value, valMap reflect.Value) error {
- typ := dataVal.Type()
- for i := 0; i < typ.NumField(); i++ {
- // Get the StructField first since this is a cheap operation. If the
- // field is unexported, then ignore it.
- f := typ.Field(i)
- if f.PkgPath != "" {
- continue
- }
-
- // Next get the actual value of this field and verify it is assignable
- // to the map value.
- v := dataVal.Field(i)
- if !v.Type().AssignableTo(valMap.Type().Elem()) {
- return fmt.Errorf("cannot assign type '%s' to map value field of type '%s'", v.Type(), valMap.Type().Elem())
- }
-
- tagValue := f.Tag.Get(d.config.TagName)
- tagParts := strings.Split(tagValue, ",")
-
- // Determine the name of the key in the map
- keyName := f.Name
- if tagParts[0] != "" {
- if tagParts[0] == "-" {
- continue
- }
- keyName = tagParts[0]
- }
-
- // If "squash" is specified in the tag, we squash the field down.
- squash := false
- for _, tag := range tagParts[1:] {
- if tag == "squash" {
- squash = true
- break
- }
- }
- if squash && v.Kind() != reflect.Struct {
- return fmt.Errorf("cannot squash non-struct type '%s'", v.Type())
- }
-
- switch v.Kind() {
- // this is an embedded struct, so handle it differently
- case reflect.Struct:
- x := reflect.New(v.Type())
- x.Elem().Set(v)
-
- vType := valMap.Type()
- vKeyType := vType.Key()
- vElemType := vType.Elem()
- mType := reflect.MapOf(vKeyType, vElemType)
- vMap := reflect.MakeMap(mType)
-
- err := d.decode(keyName, x.Interface(), vMap)
- if err != nil {
- return err
- }
-
- if squash {
- for _, k := range vMap.MapKeys() {
- valMap.SetMapIndex(k, vMap.MapIndex(k))
- }
- } else {
- valMap.SetMapIndex(reflect.ValueOf(keyName), vMap)
- }
-
- default:
- valMap.SetMapIndex(reflect.ValueOf(keyName), v)
- }
- }
-
- if val.CanAddr() {
- val.Set(valMap)
- }
-
- return nil
-}
-
-func (d *Decoder) decodePtr(name string, data interface{}, val reflect.Value) error {
- // Create an element of the concrete (non pointer) type and decode
- // into that. Then set the value of the pointer to this type.
- valType := val.Type()
- valElemType := valType.Elem()
-
- if val.CanSet() {
- realVal := val
- if realVal.IsNil() || d.config.ZeroFields {
- realVal = reflect.New(valElemType)
- }
-
- if err := d.decode(name, data, reflect.Indirect(realVal)); err != nil {
- return err
- }
-
- val.Set(realVal)
- } else {
- if err := d.decode(name, data, reflect.Indirect(val)); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (d *Decoder) decodeFunc(name string, data interface{}, val reflect.Value) error {
- // Create an element of the concrete (non pointer) type and decode
- // into that. Then set the value of the pointer to this type.
- dataVal := reflect.Indirect(reflect.ValueOf(data))
- if val.Type() != dataVal.Type() {
- return fmt.Errorf(
- "'%s' expected type '%s', got unconvertible type '%s'",
- name, val.Type(), dataVal.Type())
- }
- val.Set(dataVal)
- return nil
-}
-
-func (d *Decoder) decodeSlice(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.Indirect(reflect.ValueOf(data))
- dataValKind := dataVal.Kind()
- valType := val.Type()
- valElemType := valType.Elem()
- sliceType := reflect.SliceOf(valElemType)
-
- valSlice := val
- if valSlice.IsNil() || d.config.ZeroFields {
- // Check input type
- if dataValKind != reflect.Array && dataValKind != reflect.Slice {
- if d.config.WeaklyTypedInput {
- switch {
- // Empty maps turn into empty slices
- case dataValKind == reflect.Map:
- if dataVal.Len() == 0 {
- val.Set(reflect.MakeSlice(sliceType, 0, 0))
- return nil
- }
- // Create slice of maps of other sizes
- return d.decodeSlice(name, []interface{}{data}, val)
-
- case dataValKind == reflect.String && valElemType.Kind() == reflect.Uint8:
- return d.decodeSlice(name, []byte(dataVal.String()), val)
- // All other types we try to convert to the slice type
- // and "lift" it into it. i.e. a string becomes a string slice.
- default:
- // Just re-try this function with data as a slice.
- return d.decodeSlice(name, []interface{}{data}, val)
- }
- }
- return fmt.Errorf(
- "'%s': source data must be an array or slice, got %s", name, dataValKind)
-
- }
-
- // Make a new slice to hold our result, same size as the original data.
- valSlice = reflect.MakeSlice(sliceType, dataVal.Len(), dataVal.Len())
- }
-
- // Accumulate any errors
- errors := make([]string, 0)
-
- for i := 0; i < dataVal.Len(); i++ {
- currentData := dataVal.Index(i).Interface()
- for valSlice.Len() <= i {
- valSlice = reflect.Append(valSlice, reflect.Zero(valElemType))
- }
- currentField := valSlice.Index(i)
-
- fieldName := fmt.Sprintf("%s[%d]", name, i)
- if err := d.decode(fieldName, currentData, currentField); err != nil {
- errors = appendErrors(errors, err)
- }
- }
-
- // Finally, set the value to the slice we built up
- val.Set(valSlice)
-
- // If there were errors, we return those
- if len(errors) > 0 {
- return &Error{errors}
- }
-
- return nil
-}
-
-func (d *Decoder) decodeArray(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.Indirect(reflect.ValueOf(data))
- dataValKind := dataVal.Kind()
- valType := val.Type()
- valElemType := valType.Elem()
- arrayType := reflect.ArrayOf(valType.Len(), valElemType)
-
- valArray := val
-
- if valArray.Interface() == reflect.Zero(valArray.Type()).Interface() || d.config.ZeroFields {
- // Check input type
- if dataValKind != reflect.Array && dataValKind != reflect.Slice {
- if d.config.WeaklyTypedInput {
- switch {
- // Empty maps turn into empty arrays
- case dataValKind == reflect.Map:
- if dataVal.Len() == 0 {
- val.Set(reflect.Zero(arrayType))
- return nil
- }
-
- // All other types we try to convert to the array type
- // and "lift" it into it. i.e. a string becomes a string array.
- default:
- // Just re-try this function with data as a slice.
- return d.decodeArray(name, []interface{}{data}, val)
- }
- }
-
- return fmt.Errorf(
- "'%s': source data must be an array or slice, got %s", name, dataValKind)
-
- }
- if dataVal.Len() > arrayType.Len() {
- return fmt.Errorf(
- "'%s': expected source data to have length less or equal to %d, got %d", name, arrayType.Len(), dataVal.Len())
-
- }
-
- // Make a new array to hold our result, same size as the original data.
- valArray = reflect.New(arrayType).Elem()
- }
-
- // Accumulate any errors
- errors := make([]string, 0)
-
- for i := 0; i < dataVal.Len(); i++ {
- currentData := dataVal.Index(i).Interface()
- currentField := valArray.Index(i)
-
- fieldName := fmt.Sprintf("%s[%d]", name, i)
- if err := d.decode(fieldName, currentData, currentField); err != nil {
- errors = appendErrors(errors, err)
- }
- }
-
- // Finally, set the value to the array we built up
- val.Set(valArray)
-
- // If there were errors, we return those
- if len(errors) > 0 {
- return &Error{errors}
- }
-
- return nil
-}
-
-func (d *Decoder) decodeStruct(name string, data interface{}, val reflect.Value) error {
- dataVal := reflect.Indirect(reflect.ValueOf(data))
-
- // If the type of the value to write to and the data match directly,
- // then we just set it directly instead of recursing into the structure.
- if dataVal.Type() == val.Type() {
- val.Set(dataVal)
- return nil
- }
-
- dataValKind := dataVal.Kind()
- if dataValKind != reflect.Map {
- return fmt.Errorf("'%s' expected a map, got '%s'", name, dataValKind)
- }
-
- dataValType := dataVal.Type()
- if kind := dataValType.Key().Kind(); kind != reflect.String && kind != reflect.Interface {
- return fmt.Errorf(
- "'%s' needs a map with string keys, has '%s' keys",
- name, dataValType.Key().Kind())
- }
-
- dataValKeys := make(map[reflect.Value]struct{})
- dataValKeysUnused := make(map[interface{}]struct{})
- for _, dataValKey := range dataVal.MapKeys() {
- dataValKeys[dataValKey] = struct{}{}
- dataValKeysUnused[dataValKey.Interface()] = struct{}{}
- }
-
- errors := make([]string, 0)
-
- // This slice will keep track of all the structs we'll be decoding.
- // There can be more than one struct if there are embedded structs
- // that are squashed.
- structs := make([]reflect.Value, 1, 5)
- structs[0] = val
-
- // Compile the list of all the fields that we're going to be decoding
- // from all the structs.
- type field struct {
- field reflect.StructField
- val reflect.Value
- }
- fields := []field{}
- for len(structs) > 0 {
- structVal := structs[0]
- structs = structs[1:]
-
- structType := structVal.Type()
-
- for i := 0; i < structType.NumField(); i++ {
- fieldType := structType.Field(i)
- fieldKind := fieldType.Type.Kind()
-
- // If "squash" is specified in the tag, we squash the field down.
- squash := false
- tagParts := strings.Split(fieldType.Tag.Get(d.config.TagName), ",")
- for _, tag := range tagParts[1:] {
- if tag == "squash" {
- squash = true
- break
- }
- }
-
- if squash {
- if fieldKind != reflect.Struct {
- errors = appendErrors(errors,
- fmt.Errorf("%s: unsupported type for squash: %s", fieldType.Name, fieldKind))
- } else {
- structs = append(structs, structVal.FieldByName(fieldType.Name))
- }
- continue
- }
-
- // Normal struct field, store it away
- fields = append(fields, field{fieldType, structVal.Field(i)})
- }
- }
-
- // for fieldType, field := range fields {
- for _, f := range fields {
- field, fieldValue := f.field, f.val
- fieldName := field.Name
-
- tagValue := field.Tag.Get(d.config.TagName)
- tagValue = strings.SplitN(tagValue, ",", 2)[0]
- if tagValue != "" {
- fieldName = tagValue
- }
-
- rawMapKey := reflect.ValueOf(fieldName)
- rawMapVal := dataVal.MapIndex(rawMapKey)
- if !rawMapVal.IsValid() {
- // Do a slower search by iterating over each key and
- // doing case-insensitive search.
- for dataValKey := range dataValKeys {
- mK, ok := dataValKey.Interface().(string)
- if !ok {
- // Not a string key
- continue
- }
-
- if strings.EqualFold(mK, fieldName) {
- rawMapKey = dataValKey
- rawMapVal = dataVal.MapIndex(dataValKey)
- break
- }
- }
-
- if !rawMapVal.IsValid() {
- // There was no matching key in the map for the value in
- // the struct. Just ignore.
- continue
- }
- }
-
- // Delete the key we're using from the unused map so we stop tracking
- delete(dataValKeysUnused, rawMapKey.Interface())
-
- if !fieldValue.IsValid() {
- // This should never happen
- panic("field is not valid")
- }
-
- // If we can't set the field, then it is unexported or something,
- // and we just continue onwards.
- if !fieldValue.CanSet() {
- continue
- }
-
- // If the name is empty string, then we're at the root, and we
- // don't dot-join the fields.
- if name != "" {
- fieldName = fmt.Sprintf("%s.%s", name, fieldName)
- }
-
- if err := d.decode(fieldName, rawMapVal.Interface(), fieldValue); err != nil {
- errors = appendErrors(errors, err)
- }
- }
-
- if d.config.ErrorUnused && len(dataValKeysUnused) > 0 {
- keys := make([]string, 0, len(dataValKeysUnused))
- for rawKey := range dataValKeysUnused {
- keys = append(keys, rawKey.(string))
- }
- sort.Strings(keys)
-
- err := fmt.Errorf("'%s' has invalid keys: %s", name, strings.Join(keys, ", "))
- errors = appendErrors(errors, err)
- }
-
- if len(errors) > 0 {
- return &Error{errors}
- }
-
- // Add the unused keys to the list of unused keys if we're tracking metadata
- if d.config.Metadata != nil {
- for rawKey := range dataValKeysUnused {
- key := rawKey.(string)
- if name != "" {
- key = fmt.Sprintf("%s.%s", name, key)
- }
-
- d.config.Metadata.Unused = append(d.config.Metadata.Unused, key)
- }
- }
-
- return nil
-}
-
-func getKind(val reflect.Value) reflect.Kind {
- kind := val.Kind()
-
- switch {
- case kind >= reflect.Int && kind <= reflect.Int64:
- return reflect.Int
- case kind >= reflect.Uint && kind <= reflect.Uint64:
- return reflect.Uint
- case kind >= reflect.Float32 && kind <= reflect.Float64:
- return reflect.Float32
- default:
- return kind
- }
-}
diff --git a/vendor/github.com/phayes/freeport/.gitignore b/vendor/github.com/phayes/freeport/.gitignore
deleted file mode 100644
index 1521c8b7652b1eec8ed4fe50877aae880c758ee3..0000000000000000000000000000000000000000
--- a/vendor/github.com/phayes/freeport/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-dist
diff --git a/vendor/github.com/phayes/freeport/.goreleaser.yml b/vendor/github.com/phayes/freeport/.goreleaser.yml
deleted file mode 100644
index ab1043dfa9e297eb930a6ffa4a699c730432d718..0000000000000000000000000000000000000000
--- a/vendor/github.com/phayes/freeport/.goreleaser.yml
+++ /dev/null
@@ -1,134 +0,0 @@
-project_name: freeport
-
-release:
- github:
- owner: phayes
- name: freeport
-
-builds:
- - binary: freeport
- goos:
- - linux
- - darwin
- goarch:
- - amd64
- - "386"
- goarm:
- - "6"
- main: ./cmd/freeport
- ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
-
-archive:
- format: tar.gz
- name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{
- .Arm }}{{ end }}'
- files:
- - licence*
- - LICENCE*
- - license*
- - LICENSE*
- - readme*
- - README*
- - changelog*
- - CHANGELOG*
-
-snapshot:
- name_template: SNAPSHOT-{{ .Commit }}
-
-checksum:
- name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt'
-
-# Create RPM and .DEB files
-fpm:
- vendor: Patrick Hayes
-
- # Your app's homepage.
- #homepage: https://example.com/
-
- # Your app's maintainer
- maintainer: Patrick Hayes
-
- # Your app's description.
- description: Get a free open TCP port that is ready to use.
-
- # Your app's license.
- # Default is empty.
- license: BSD
-
- # Formats to be generated.
- formats:
- - deb
- - rpm
-
- # Packages your package depends on.
- #dependencies:
- # - git
- # - zsh
-
- # Packages that conflict with your package.
- #conflicts:
- # - svn
- # - bash
-
- # Files or directories to add to your package (beyond the binary).
- # Keys are source paths to get the files from.
- # Values are the destination locations of the files in the package.
- #files:
- # "scripts/etc/init.d/": "/etc/init.d"
-
-# Homebrew repos
-brew:
- # Reporitory to push the tap to.
- github:
- owner: phayes
- name: homebrew-repo
-
- # Git author used to commit to the repository.
- # Defaults are shown.
- commit_author:
- name: goreleaserbot
- email: goreleaser@carlosbecker.com
-
- # Folder inside the repository to put the formula.
- # Default is the root folder.
- folder: freeport
-
- # Caveats for the user of your binary.
- # Default is empty.
- # caveats: "How to use this binary"
-
- # Your app's homepage.
- # Default is empty.
- # homepage: "https://example.com/"
-
- # Your app's description.
- # Default is empty.
- description: "Get a free open TCP port that is ready to use."
-
- # Packages your package depends on.
- #dependencies:
- # - git
- # - zsh
-
- # Packages that conflict with your package.
- #conflicts:
- # - svn
- # - bash
-
- # Specify for packages that run as a service.
- # Default is empty.
- #plist: |
- #
- # ...
-
- # So you can `brew test` your formula.
- # Default is empty.
- #test: |
- # system "#{bin}/program --version"
- # ...
-
- # Custom install script for brew.
- # Default is 'bin.install "program"'.
- #install: |
- # bin.install "program"
- # ...
\ No newline at end of file
diff --git a/vendor/github.com/phayes/freeport/LICENSE.md b/vendor/github.com/phayes/freeport/LICENSE.md
deleted file mode 100644
index d9882e595e4d17827ee1bc1937b329549ab261b5..0000000000000000000000000000000000000000
--- a/vendor/github.com/phayes/freeport/LICENSE.md
+++ /dev/null
@@ -1,15 +0,0 @@
-Open Source License (BSD 3-Clause)
-----------------------------------
-
-Copyright (c) 2014, Patrick Hayes / HighWire Press
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/phayes/freeport/README.md b/vendor/github.com/phayes/freeport/README.md
deleted file mode 100644
index 4f9245d9d3e38f4c1549205a058d2b11a31d5f5b..0000000000000000000000000000000000000000
--- a/vendor/github.com/phayes/freeport/README.md
+++ /dev/null
@@ -1,54 +0,0 @@
-FreePort
-========
-
-Get a free open TCP port that is ready to use.
-
-## Command Line Example:
-```bash
-# Ask the kernel to give us an open port.
-export port=$(freeport)
-
-# Start standalone httpd server for testing
-httpd -X -c "Listen $port" &
-
-# Curl local server on the selected port
-curl localhost:$port
-```
-
-## Golang example:
-```go
-package main
-
-import "github.com/phayes/freeport"
-
-func main() {
- port, err := freeport.GetFreePort()
- if err != nil {
- log.Fatal(err)
- }
- // port is ready to listen on
-}
-
-```
-
-## Installation
-
-#### CentOS and other RPM based systems
-```bash
-wget https://github.com/phayes/freeport/releases/download/0.1.2/freeport_0.1.2_linux_386.rpm
-rpm -Uvh freeport_0.1.2_linux_386.rpm
-```
-
-#### Ubuntu and other DEB based systems
-```bash
-wget wget https://github.com/phayes/freeport/releases/download/0.1.2/freeport_0.1.2_linux_amd64.deb
-dpkg -i freeport_0.1.2_linux_amd64.deb
-```
-
-## Building From Source
-```bash
-sudo apt-get install golang # Download go. Alternativly build from source: https://golang.org/doc/install/source
-mkdir ~/.gopath && export GOPATH=~/.gopath # Replace with desired GOPATH
-export PATH=$PATH:$GOPATH/bin # For convenience, add go's bin dir to your PATH
-go get github.com/phayes/freeport/cmd/freeport
-```
diff --git a/vendor/github.com/phayes/freeport/freeport.go b/vendor/github.com/phayes/freeport/freeport.go
deleted file mode 100644
index c44b60df27813db540a7dbc520474101cb1adf01..0000000000000000000000000000000000000000
--- a/vendor/github.com/phayes/freeport/freeport.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package freeport
-
-import (
- "net"
-)
-
-// GetFreePort asks the kernel for a free open port that is ready to use.
-func GetFreePort() (int, error) {
- addr, err := net.ResolveTCPAddr("tcp", "localhost:0")
- if err != nil {
- return 0, err
- }
-
- l, err := net.ListenTCP("tcp", addr)
- if err != nil {
- return 0, err
- }
- defer l.Close()
- return l.Addr().(*net.TCPAddr).Port, nil
-}
-
-// GetPort is deprecated, use GetFreePort instead
-// Ask the kernel for a free open port that is ready to use
-func GetPort() int {
- port, err := GetFreePort()
- if err != nil {
- panic(err)
- }
- return port
-}
diff --git a/vendor/github.com/pkg/errors/.gitignore b/vendor/github.com/pkg/errors/.gitignore
deleted file mode 100644
index daf913b1b347aae6de6f48d599bc89ef8c8693d6..0000000000000000000000000000000000000000
--- a/vendor/github.com/pkg/errors/.gitignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
diff --git a/vendor/github.com/pkg/errors/.travis.yml b/vendor/github.com/pkg/errors/.travis.yml
deleted file mode 100644
index 588ceca183f487062bd4ba357c7aa961e3889329..0000000000000000000000000000000000000000
--- a/vendor/github.com/pkg/errors/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-language: go
-go_import_path: github.com/pkg/errors
-go:
- - 1.4.3
- - 1.5.4
- - 1.6.2
- - 1.7.1
- - tip
-
-script:
- - go test -v ./...
diff --git a/vendor/github.com/pkg/errors/LICENSE b/vendor/github.com/pkg/errors/LICENSE
deleted file mode 100644
index 835ba3e755cef8c0dde475f1ebfd41e4ba0c79bf..0000000000000000000000000000000000000000
--- a/vendor/github.com/pkg/errors/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright (c) 2015, Dave Cheney
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/pkg/errors/README.md b/vendor/github.com/pkg/errors/README.md
deleted file mode 100644
index 273db3c98aea7206b43a84eede97d5fd515792e1..0000000000000000000000000000000000000000
--- a/vendor/github.com/pkg/errors/README.md
+++ /dev/null
@@ -1,52 +0,0 @@
-# errors [](https://travis-ci.org/pkg/errors) [](https://ci.appveyor.com/project/davecheney/errors/branch/master) [](http://godoc.org/github.com/pkg/errors) [](https://goreportcard.com/report/github.com/pkg/errors)
-
-Package errors provides simple error handling primitives.
-
-`go get github.com/pkg/errors`
-
-The traditional error handling idiom in Go is roughly akin to
-```go
-if err != nil {
- return err
-}
-```
-which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error.
-
-## Adding context to an error
-
-The errors.Wrap function returns a new error that adds context to the original error. For example
-```go
-_, err := ioutil.ReadAll(r)
-if err != nil {
- return errors.Wrap(err, "read failed")
-}
-```
-## Retrieving the cause of an error
-
-Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`.
-```go
-type causer interface {
- Cause() error
-}
-```
-`errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example:
-```go
-switch err := errors.Cause(err).(type) {
-case *MyError:
- // handle specifically
-default:
- // unknown error
-}
-```
-
-[Read the package documentation for more information](https://godoc.org/github.com/pkg/errors).
-
-## Contributing
-
-We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high.
-
-Before proposing a change, please discuss your change by raising an issue.
-
-## Licence
-
-BSD-2-Clause
diff --git a/vendor/github.com/pkg/errors/appveyor.yml b/vendor/github.com/pkg/errors/appveyor.yml
deleted file mode 100644
index a932eade0240aa2b5f9f5347b695ab173da0236a..0000000000000000000000000000000000000000
--- a/vendor/github.com/pkg/errors/appveyor.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-version: build-{build}.{branch}
-
-clone_folder: C:\gopath\src\github.com\pkg\errors
-shallow_clone: true # for startup speed
-
-environment:
- GOPATH: C:\gopath
-
-platform:
- - x64
-
-# http://www.appveyor.com/docs/installed-software
-install:
- # some helpful output for debugging builds
- - go version
- - go env
- # pre-installed MinGW at C:\MinGW is 32bit only
- # but MSYS2 at C:\msys64 has mingw64
- - set PATH=C:\msys64\mingw64\bin;%PATH%
- - gcc --version
- - g++ --version
-
-build_script:
- - go install -v ./...
-
-test_script:
- - set PATH=C:\gopath\bin;%PATH%
- - go test -v ./...
-
-#artifacts:
-# - path: '%GOPATH%\bin\*.exe'
-deploy: off
diff --git a/vendor/github.com/pkg/errors/errors.go b/vendor/github.com/pkg/errors/errors.go
deleted file mode 100644
index 842ee80456dbaab024d2a0f1ca524f7b7c5f241a..0000000000000000000000000000000000000000
--- a/vendor/github.com/pkg/errors/errors.go
+++ /dev/null
@@ -1,269 +0,0 @@
-// Package errors provides simple error handling primitives.
-//
-// The traditional error handling idiom in Go is roughly akin to
-//
-// if err != nil {
-// return err
-// }
-//
-// which applied recursively up the call stack results in error reports
-// without context or debugging information. The errors package allows
-// programmers to add context to the failure path in their code in a way
-// that does not destroy the original value of the error.
-//
-// Adding context to an error
-//
-// The errors.Wrap function returns a new error that adds context to the
-// original error by recording a stack trace at the point Wrap is called,
-// and the supplied message. For example
-//
-// _, err := ioutil.ReadAll(r)
-// if err != nil {
-// return errors.Wrap(err, "read failed")
-// }
-//
-// If additional control is required the errors.WithStack and errors.WithMessage
-// functions destructure errors.Wrap into its component operations of annotating
-// an error with a stack trace and an a message, respectively.
-//
-// Retrieving the cause of an error
-//
-// Using errors.Wrap constructs a stack of errors, adding context to the
-// preceding error. Depending on the nature of the error it may be necessary
-// to reverse the operation of errors.Wrap to retrieve the original error
-// for inspection. Any error value which implements this interface
-//
-// type causer interface {
-// Cause() error
-// }
-//
-// can be inspected by errors.Cause. errors.Cause will recursively retrieve
-// the topmost error which does not implement causer, which is assumed to be
-// the original cause. For example:
-//
-// switch err := errors.Cause(err).(type) {
-// case *MyError:
-// // handle specifically
-// default:
-// // unknown error
-// }
-//
-// causer interface is not exported by this package, but is considered a part
-// of stable public API.
-//
-// Formatted printing of errors
-//
-// All error values returned from this package implement fmt.Formatter and can
-// be formatted by the fmt package. The following verbs are supported
-//
-// %s print the error. If the error has a Cause it will be
-// printed recursively
-// %v see %s
-// %+v extended format. Each Frame of the error's StackTrace will
-// be printed in detail.
-//
-// Retrieving the stack trace of an error or wrapper
-//
-// New, Errorf, Wrap, and Wrapf record a stack trace at the point they are
-// invoked. This information can be retrieved with the following interface.
-//
-// type stackTracer interface {
-// StackTrace() errors.StackTrace
-// }
-//
-// Where errors.StackTrace is defined as
-//
-// type StackTrace []Frame
-//
-// The Frame type represents a call site in the stack trace. Frame supports
-// the fmt.Formatter interface that can be used for printing information about
-// the stack trace of this error. For example:
-//
-// if err, ok := err.(stackTracer); ok {
-// for _, f := range err.StackTrace() {
-// fmt.Printf("%+s:%d", f)
-// }
-// }
-//
-// stackTracer interface is not exported by this package, but is considered a part
-// of stable public API.
-//
-// See the documentation for Frame.Format for more details.
-package errors
-
-import (
- "fmt"
- "io"
-)
-
-// New returns an error with the supplied message.
-// New also records the stack trace at the point it was called.
-func New(message string) error {
- return &fundamental{
- msg: message,
- stack: callers(),
- }
-}
-
-// Errorf formats according to a format specifier and returns the string
-// as a value that satisfies error.
-// Errorf also records the stack trace at the point it was called.
-func Errorf(format string, args ...interface{}) error {
- return &fundamental{
- msg: fmt.Sprintf(format, args...),
- stack: callers(),
- }
-}
-
-// fundamental is an error that has a message and a stack, but no caller.
-type fundamental struct {
- msg string
- *stack
-}
-
-func (f *fundamental) Error() string { return f.msg }
-
-func (f *fundamental) Format(s fmt.State, verb rune) {
- switch verb {
- case 'v':
- if s.Flag('+') {
- io.WriteString(s, f.msg)
- f.stack.Format(s, verb)
- return
- }
- fallthrough
- case 's':
- io.WriteString(s, f.msg)
- case 'q':
- fmt.Fprintf(s, "%q", f.msg)
- }
-}
-
-// WithStack annotates err with a stack trace at the point WithStack was called.
-// If err is nil, WithStack returns nil.
-func WithStack(err error) error {
- if err == nil {
- return nil
- }
- return &withStack{
- err,
- callers(),
- }
-}
-
-type withStack struct {
- error
- *stack
-}
-
-func (w *withStack) Cause() error { return w.error }
-
-func (w *withStack) Format(s fmt.State, verb rune) {
- switch verb {
- case 'v':
- if s.Flag('+') {
- fmt.Fprintf(s, "%+v", w.Cause())
- w.stack.Format(s, verb)
- return
- }
- fallthrough
- case 's':
- io.WriteString(s, w.Error())
- case 'q':
- fmt.Fprintf(s, "%q", w.Error())
- }
-}
-
-// Wrap returns an error annotating err with a stack trace
-// at the point Wrap is called, and the supplied message.
-// If err is nil, Wrap returns nil.
-func Wrap(err error, message string) error {
- if err == nil {
- return nil
- }
- err = &withMessage{
- cause: err,
- msg: message,
- }
- return &withStack{
- err,
- callers(),
- }
-}
-
-// Wrapf returns an error annotating err with a stack trace
-// at the point Wrapf is call, and the format specifier.
-// If err is nil, Wrapf returns nil.
-func Wrapf(err error, format string, args ...interface{}) error {
- if err == nil {
- return nil
- }
- err = &withMessage{
- cause: err,
- msg: fmt.Sprintf(format, args...),
- }
- return &withStack{
- err,
- callers(),
- }
-}
-
-// WithMessage annotates err with a new message.
-// If err is nil, WithMessage returns nil.
-func WithMessage(err error, message string) error {
- if err == nil {
- return nil
- }
- return &withMessage{
- cause: err,
- msg: message,
- }
-}
-
-type withMessage struct {
- cause error
- msg string
-}
-
-func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() }
-func (w *withMessage) Cause() error { return w.cause }
-
-func (w *withMessage) Format(s fmt.State, verb rune) {
- switch verb {
- case 'v':
- if s.Flag('+') {
- fmt.Fprintf(s, "%+v\n", w.Cause())
- io.WriteString(s, w.msg)
- return
- }
- fallthrough
- case 's', 'q':
- io.WriteString(s, w.Error())
- }
-}
-
-// Cause returns the underlying cause of the error, if possible.
-// An error value has a cause if it implements the following
-// interface:
-//
-// type causer interface {
-// Cause() error
-// }
-//
-// If the error does not implement Cause, the original error will
-// be returned. If the error is nil, nil will be returned without further
-// investigation.
-func Cause(err error) error {
- type causer interface {
- Cause() error
- }
-
- for err != nil {
- cause, ok := err.(causer)
- if !ok {
- break
- }
- err = cause.Cause()
- }
- return err
-}
diff --git a/vendor/github.com/pkg/errors/stack.go b/vendor/github.com/pkg/errors/stack.go
deleted file mode 100644
index 6b1f2891a5ac09218a5b7de82f3e479a16f44298..0000000000000000000000000000000000000000
--- a/vendor/github.com/pkg/errors/stack.go
+++ /dev/null
@@ -1,178 +0,0 @@
-package errors
-
-import (
- "fmt"
- "io"
- "path"
- "runtime"
- "strings"
-)
-
-// Frame represents a program counter inside a stack frame.
-type Frame uintptr
-
-// pc returns the program counter for this frame;
-// multiple frames may have the same PC value.
-func (f Frame) pc() uintptr { return uintptr(f) - 1 }
-
-// file returns the full path to the file that contains the
-// function for this Frame's pc.
-func (f Frame) file() string {
- fn := runtime.FuncForPC(f.pc())
- if fn == nil {
- return "unknown"
- }
- file, _ := fn.FileLine(f.pc())
- return file
-}
-
-// line returns the line number of source code of the
-// function for this Frame's pc.
-func (f Frame) line() int {
- fn := runtime.FuncForPC(f.pc())
- if fn == nil {
- return 0
- }
- _, line := fn.FileLine(f.pc())
- return line
-}
-
-// Format formats the frame according to the fmt.Formatter interface.
-//
-// %s source file
-// %d source line
-// %n function name
-// %v equivalent to %s:%d
-//
-// Format accepts flags that alter the printing of some verbs, as follows:
-//
-// %+s path of source file relative to the compile time GOPATH
-// %+v equivalent to %+s:%d
-func (f Frame) Format(s fmt.State, verb rune) {
- switch verb {
- case 's':
- switch {
- case s.Flag('+'):
- pc := f.pc()
- fn := runtime.FuncForPC(pc)
- if fn == nil {
- io.WriteString(s, "unknown")
- } else {
- file, _ := fn.FileLine(pc)
- fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file)
- }
- default:
- io.WriteString(s, path.Base(f.file()))
- }
- case 'd':
- fmt.Fprintf(s, "%d", f.line())
- case 'n':
- name := runtime.FuncForPC(f.pc()).Name()
- io.WriteString(s, funcname(name))
- case 'v':
- f.Format(s, 's')
- io.WriteString(s, ":")
- f.Format(s, 'd')
- }
-}
-
-// StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
-type StackTrace []Frame
-
-func (st StackTrace) Format(s fmt.State, verb rune) {
- switch verb {
- case 'v':
- switch {
- case s.Flag('+'):
- for _, f := range st {
- fmt.Fprintf(s, "\n%+v", f)
- }
- case s.Flag('#'):
- fmt.Fprintf(s, "%#v", []Frame(st))
- default:
- fmt.Fprintf(s, "%v", []Frame(st))
- }
- case 's':
- fmt.Fprintf(s, "%s", []Frame(st))
- }
-}
-
-// stack represents a stack of program counters.
-type stack []uintptr
-
-func (s *stack) Format(st fmt.State, verb rune) {
- switch verb {
- case 'v':
- switch {
- case st.Flag('+'):
- for _, pc := range *s {
- f := Frame(pc)
- fmt.Fprintf(st, "\n%+v", f)
- }
- }
- }
-}
-
-func (s *stack) StackTrace() StackTrace {
- f := make([]Frame, len(*s))
- for i := 0; i < len(f); i++ {
- f[i] = Frame((*s)[i])
- }
- return f
-}
-
-func callers() *stack {
- const depth = 32
- var pcs [depth]uintptr
- n := runtime.Callers(3, pcs[:])
- var st stack = pcs[0:n]
- return &st
-}
-
-// funcname removes the path prefix component of a function's name reported by func.Name().
-func funcname(name string) string {
- i := strings.LastIndex(name, "/")
- name = name[i+1:]
- i = strings.Index(name, ".")
- return name[i+1:]
-}
-
-func trimGOPATH(name, file string) string {
- // Here we want to get the source file path relative to the compile time
- // GOPATH. As of Go 1.6.x there is no direct way to know the compiled
- // GOPATH at runtime, but we can infer the number of path segments in the
- // GOPATH. We note that fn.Name() returns the function name qualified by
- // the import path, which does not include the GOPATH. Thus we can trim
- // segments from the beginning of the file path until the number of path
- // separators remaining is one more than the number of path separators in
- // the function name. For example, given:
- //
- // GOPATH /home/user
- // file /home/user/src/pkg/sub/file.go
- // fn.Name() pkg/sub.Type.Method
- //
- // We want to produce:
- //
- // pkg/sub/file.go
- //
- // From this we can easily see that fn.Name() has one less path separator
- // than our desired output. We count separators from the end of the file
- // path until it finds two more than in the function name and then move
- // one character forward to preserve the initial path segment without a
- // leading separator.
- const sep = "/"
- goal := strings.Count(name, sep) + 2
- i := len(file)
- for n := 0; n < goal; n++ {
- i = strings.LastIndex(file[:i], sep)
- if i == -1 {
- // not enough separators found, set i so that the slice expression
- // below leaves file unmodified
- i = -len(sep)
- break
- }
- }
- // get back to 0 or trim the leading separator
- file = file[i+len(sep):]
- return file
-}
diff --git a/vendor/github.com/pmezard/go-difflib/LICENSE b/vendor/github.com/pmezard/go-difflib/LICENSE
deleted file mode 100644
index c67dad612a3dfca2b84599c640798d7be7d46728..0000000000000000000000000000000000000000
--- a/vendor/github.com/pmezard/go-difflib/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2013, Patrick Mezard
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
- The names of its contributors may not be used to endorse or promote
-products derived from this software without specific prior written
-permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go
deleted file mode 100644
index 003e99fadb4f189565b409b9509ecf30b752d25a..0000000000000000000000000000000000000000
--- a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go
+++ /dev/null
@@ -1,772 +0,0 @@
-// Package difflib is a partial port of Python difflib module.
-//
-// It provides tools to compare sequences of strings and generate textual diffs.
-//
-// The following class and functions have been ported:
-//
-// - SequenceMatcher
-//
-// - unified_diff
-//
-// - context_diff
-//
-// Getting unified diffs was the main goal of the port. Keep in mind this code
-// is mostly suitable to output text differences in a human friendly way, there
-// are no guarantees generated diffs are consumable by patch(1).
-package difflib
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strings"
-)
-
-func min(a, b int) int {
- if a < b {
- return a
- }
- return b
-}
-
-func max(a, b int) int {
- if a > b {
- return a
- }
- return b
-}
-
-func calculateRatio(matches, length int) float64 {
- if length > 0 {
- return 2.0 * float64(matches) / float64(length)
- }
- return 1.0
-}
-
-type Match struct {
- A int
- B int
- Size int
-}
-
-type OpCode struct {
- Tag byte
- I1 int
- I2 int
- J1 int
- J2 int
-}
-
-// SequenceMatcher compares sequence of strings. The basic
-// algorithm predates, and is a little fancier than, an algorithm
-// published in the late 1980's by Ratcliff and Obershelp under the
-// hyperbolic name "gestalt pattern matching". The basic idea is to find
-// the longest contiguous matching subsequence that contains no "junk"
-// elements (R-O doesn't address junk). The same idea is then applied
-// recursively to the pieces of the sequences to the left and to the right
-// of the matching subsequence. This does not yield minimal edit
-// sequences, but does tend to yield matches that "look right" to people.
-//
-// SequenceMatcher tries to compute a "human-friendly diff" between two
-// sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the
-// longest *contiguous* & junk-free matching subsequence. That's what
-// catches peoples' eyes. The Windows(tm) windiff has another interesting
-// notion, pairing up elements that appear uniquely in each sequence.
-// That, and the method here, appear to yield more intuitive difference
-// reports than does diff. This method appears to be the least vulnerable
-// to synching up on blocks of "junk lines", though (like blank lines in
-// ordinary text files, or maybe "" lines in HTML files). That may be
-// because this is the only method of the 3 that has a *concept* of
-// "junk" .
-//
-// Timing: Basic R-O is cubic time worst case and quadratic time expected
-// case. SequenceMatcher is quadratic time for the worst case and has
-// expected-case behavior dependent in a complicated way on how many
-// elements the sequences have in common; best case time is linear.
-type SequenceMatcher struct {
- a []string
- b []string
- b2j map[string][]int
- IsJunk func(string) bool
- autoJunk bool
- bJunk map[string]struct{}
- matchingBlocks []Match
- fullBCount map[string]int
- bPopular map[string]struct{}
- opCodes []OpCode
-}
-
-func NewMatcher(a, b []string) *SequenceMatcher {
- m := SequenceMatcher{autoJunk: true}
- m.SetSeqs(a, b)
- return &m
-}
-
-func NewMatcherWithJunk(a, b []string, autoJunk bool,
- isJunk func(string) bool) *SequenceMatcher {
-
- m := SequenceMatcher{IsJunk: isJunk, autoJunk: autoJunk}
- m.SetSeqs(a, b)
- return &m
-}
-
-// Set two sequences to be compared.
-func (m *SequenceMatcher) SetSeqs(a, b []string) {
- m.SetSeq1(a)
- m.SetSeq2(b)
-}
-
-// Set the first sequence to be compared. The second sequence to be compared is
-// not changed.
-//
-// SequenceMatcher computes and caches detailed information about the second
-// sequence, so if you want to compare one sequence S against many sequences,
-// use .SetSeq2(s) once and call .SetSeq1(x) repeatedly for each of the other
-// sequences.
-//
-// See also SetSeqs() and SetSeq2().
-func (m *SequenceMatcher) SetSeq1(a []string) {
- if &a == &m.a {
- return
- }
- m.a = a
- m.matchingBlocks = nil
- m.opCodes = nil
-}
-
-// Set the second sequence to be compared. The first sequence to be compared is
-// not changed.
-func (m *SequenceMatcher) SetSeq2(b []string) {
- if &b == &m.b {
- return
- }
- m.b = b
- m.matchingBlocks = nil
- m.opCodes = nil
- m.fullBCount = nil
- m.chainB()
-}
-
-func (m *SequenceMatcher) chainB() {
- // Populate line -> index mapping
- b2j := map[string][]int{}
- for i, s := range m.b {
- indices := b2j[s]
- indices = append(indices, i)
- b2j[s] = indices
- }
-
- // Purge junk elements
- m.bJunk = map[string]struct{}{}
- if m.IsJunk != nil {
- junk := m.bJunk
- for s, _ := range b2j {
- if m.IsJunk(s) {
- junk[s] = struct{}{}
- }
- }
- for s, _ := range junk {
- delete(b2j, s)
- }
- }
-
- // Purge remaining popular elements
- popular := map[string]struct{}{}
- n := len(m.b)
- if m.autoJunk && n >= 200 {
- ntest := n/100 + 1
- for s, indices := range b2j {
- if len(indices) > ntest {
- popular[s] = struct{}{}
- }
- }
- for s, _ := range popular {
- delete(b2j, s)
- }
- }
- m.bPopular = popular
- m.b2j = b2j
-}
-
-func (m *SequenceMatcher) isBJunk(s string) bool {
- _, ok := m.bJunk[s]
- return ok
-}
-
-// Find longest matching block in a[alo:ahi] and b[blo:bhi].
-//
-// If IsJunk is not defined:
-//
-// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
-// alo <= i <= i+k <= ahi
-// blo <= j <= j+k <= bhi
-// and for all (i',j',k') meeting those conditions,
-// k >= k'
-// i <= i'
-// and if i == i', j <= j'
-//
-// In other words, of all maximal matching blocks, return one that
-// starts earliest in a, and of all those maximal matching blocks that
-// start earliest in a, return the one that starts earliest in b.
-//
-// If IsJunk is defined, first the longest matching block is
-// determined as above, but with the additional restriction that no
-// junk element appears in the block. Then that block is extended as
-// far as possible by matching (only) junk elements on both sides. So
-// the resulting block never matches on junk except as identical junk
-// happens to be adjacent to an "interesting" match.
-//
-// If no blocks match, return (alo, blo, 0).
-func (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Match {
- // CAUTION: stripping common prefix or suffix would be incorrect.
- // E.g.,
- // ab
- // acab
- // Longest matching block is "ab", but if common prefix is
- // stripped, it's "a" (tied with "b"). UNIX(tm) diff does so
- // strip, so ends up claiming that ab is changed to acab by
- // inserting "ca" in the middle. That's minimal but unintuitive:
- // "it's obvious" that someone inserted "ac" at the front.
- // Windiff ends up at the same place as diff, but by pairing up
- // the unique 'b's and then matching the first two 'a's.
- besti, bestj, bestsize := alo, blo, 0
-
- // find longest junk-free match
- // during an iteration of the loop, j2len[j] = length of longest
- // junk-free match ending with a[i-1] and b[j]
- j2len := map[int]int{}
- for i := alo; i != ahi; i++ {
- // look at all instances of a[i] in b; note that because
- // b2j has no junk keys, the loop is skipped if a[i] is junk
- newj2len := map[int]int{}
- for _, j := range m.b2j[m.a[i]] {
- // a[i] matches b[j]
- if j < blo {
- continue
- }
- if j >= bhi {
- break
- }
- k := j2len[j-1] + 1
- newj2len[j] = k
- if k > bestsize {
- besti, bestj, bestsize = i-k+1, j-k+1, k
- }
- }
- j2len = newj2len
- }
-
- // Extend the best by non-junk elements on each end. In particular,
- // "popular" non-junk elements aren't in b2j, which greatly speeds
- // the inner loop above, but also means "the best" match so far
- // doesn't contain any junk *or* popular non-junk elements.
- for besti > alo && bestj > blo && !m.isBJunk(m.b[bestj-1]) &&
- m.a[besti-1] == m.b[bestj-1] {
- besti, bestj, bestsize = besti-1, bestj-1, bestsize+1
- }
- for besti+bestsize < ahi && bestj+bestsize < bhi &&
- !m.isBJunk(m.b[bestj+bestsize]) &&
- m.a[besti+bestsize] == m.b[bestj+bestsize] {
- bestsize += 1
- }
-
- // Now that we have a wholly interesting match (albeit possibly
- // empty!), we may as well suck up the matching junk on each
- // side of it too. Can't think of a good reason not to, and it
- // saves post-processing the (possibly considerable) expense of
- // figuring out what to do with it. In the case of an empty
- // interesting match, this is clearly the right thing to do,
- // because no other kind of match is possible in the regions.
- for besti > alo && bestj > blo && m.isBJunk(m.b[bestj-1]) &&
- m.a[besti-1] == m.b[bestj-1] {
- besti, bestj, bestsize = besti-1, bestj-1, bestsize+1
- }
- for besti+bestsize < ahi && bestj+bestsize < bhi &&
- m.isBJunk(m.b[bestj+bestsize]) &&
- m.a[besti+bestsize] == m.b[bestj+bestsize] {
- bestsize += 1
- }
-
- return Match{A: besti, B: bestj, Size: bestsize}
-}
-
-// Return list of triples describing matching subsequences.
-//
-// Each triple is of the form (i, j, n), and means that
-// a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in
-// i and in j. It's also guaranteed that if (i, j, n) and (i', j', n') are
-// adjacent triples in the list, and the second is not the last triple in the
-// list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe
-// adjacent equal blocks.
-//
-// The last triple is a dummy, (len(a), len(b), 0), and is the only
-// triple with n==0.
-func (m *SequenceMatcher) GetMatchingBlocks() []Match {
- if m.matchingBlocks != nil {
- return m.matchingBlocks
- }
-
- var matchBlocks func(alo, ahi, blo, bhi int, matched []Match) []Match
- matchBlocks = func(alo, ahi, blo, bhi int, matched []Match) []Match {
- match := m.findLongestMatch(alo, ahi, blo, bhi)
- i, j, k := match.A, match.B, match.Size
- if match.Size > 0 {
- if alo < i && blo < j {
- matched = matchBlocks(alo, i, blo, j, matched)
- }
- matched = append(matched, match)
- if i+k < ahi && j+k < bhi {
- matched = matchBlocks(i+k, ahi, j+k, bhi, matched)
- }
- }
- return matched
- }
- matched := matchBlocks(0, len(m.a), 0, len(m.b), nil)
-
- // It's possible that we have adjacent equal blocks in the
- // matching_blocks list now.
- nonAdjacent := []Match{}
- i1, j1, k1 := 0, 0, 0
- for _, b := range matched {
- // Is this block adjacent to i1, j1, k1?
- i2, j2, k2 := b.A, b.B, b.Size
- if i1+k1 == i2 && j1+k1 == j2 {
- // Yes, so collapse them -- this just increases the length of
- // the first block by the length of the second, and the first
- // block so lengthened remains the block to compare against.
- k1 += k2
- } else {
- // Not adjacent. Remember the first block (k1==0 means it's
- // the dummy we started with), and make the second block the
- // new block to compare against.
- if k1 > 0 {
- nonAdjacent = append(nonAdjacent, Match{i1, j1, k1})
- }
- i1, j1, k1 = i2, j2, k2
- }
- }
- if k1 > 0 {
- nonAdjacent = append(nonAdjacent, Match{i1, j1, k1})
- }
-
- nonAdjacent = append(nonAdjacent, Match{len(m.a), len(m.b), 0})
- m.matchingBlocks = nonAdjacent
- return m.matchingBlocks
-}
-
-// Return list of 5-tuples describing how to turn a into b.
-//
-// Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple
-// has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the
-// tuple preceding it, and likewise for j1 == the previous j2.
-//
-// The tags are characters, with these meanings:
-//
-// 'r' (replace): a[i1:i2] should be replaced by b[j1:j2]
-//
-// 'd' (delete): a[i1:i2] should be deleted, j1==j2 in this case.
-//
-// 'i' (insert): b[j1:j2] should be inserted at a[i1:i1], i1==i2 in this case.
-//
-// 'e' (equal): a[i1:i2] == b[j1:j2]
-func (m *SequenceMatcher) GetOpCodes() []OpCode {
- if m.opCodes != nil {
- return m.opCodes
- }
- i, j := 0, 0
- matching := m.GetMatchingBlocks()
- opCodes := make([]OpCode, 0, len(matching))
- for _, m := range matching {
- // invariant: we've pumped out correct diffs to change
- // a[:i] into b[:j], and the next matching block is
- // a[ai:ai+size] == b[bj:bj+size]. So we need to pump
- // out a diff to change a[i:ai] into b[j:bj], pump out
- // the matching block, and move (i,j) beyond the match
- ai, bj, size := m.A, m.B, m.Size
- tag := byte(0)
- if i < ai && j < bj {
- tag = 'r'
- } else if i < ai {
- tag = 'd'
- } else if j < bj {
- tag = 'i'
- }
- if tag > 0 {
- opCodes = append(opCodes, OpCode{tag, i, ai, j, bj})
- }
- i, j = ai+size, bj+size
- // the list of matching blocks is terminated by a
- // sentinel with size 0
- if size > 0 {
- opCodes = append(opCodes, OpCode{'e', ai, i, bj, j})
- }
- }
- m.opCodes = opCodes
- return m.opCodes
-}
-
-// Isolate change clusters by eliminating ranges with no changes.
-//
-// Return a generator of groups with up to n lines of context.
-// Each group is in the same format as returned by GetOpCodes().
-func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode {
- if n < 0 {
- n = 3
- }
- codes := m.GetOpCodes()
- if len(codes) == 0 {
- codes = []OpCode{OpCode{'e', 0, 1, 0, 1}}
- }
- // Fixup leading and trailing groups if they show no changes.
- if codes[0].Tag == 'e' {
- c := codes[0]
- i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
- codes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2}
- }
- if codes[len(codes)-1].Tag == 'e' {
- c := codes[len(codes)-1]
- i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
- codes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)}
- }
- nn := n + n
- groups := [][]OpCode{}
- group := []OpCode{}
- for _, c := range codes {
- i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
- // End the current group and start a new one whenever
- // there is a large range with no changes.
- if c.Tag == 'e' && i2-i1 > nn {
- group = append(group, OpCode{c.Tag, i1, min(i2, i1+n),
- j1, min(j2, j1+n)})
- groups = append(groups, group)
- group = []OpCode{}
- i1, j1 = max(i1, i2-n), max(j1, j2-n)
- }
- group = append(group, OpCode{c.Tag, i1, i2, j1, j2})
- }
- if len(group) > 0 && !(len(group) == 1 && group[0].Tag == 'e') {
- groups = append(groups, group)
- }
- return groups
-}
-
-// Return a measure of the sequences' similarity (float in [0,1]).
-//
-// Where T is the total number of elements in both sequences, and
-// M is the number of matches, this is 2.0*M / T.
-// Note that this is 1 if the sequences are identical, and 0 if
-// they have nothing in common.
-//
-// .Ratio() is expensive to compute if you haven't already computed
-// .GetMatchingBlocks() or .GetOpCodes(), in which case you may
-// want to try .QuickRatio() or .RealQuickRation() first to get an
-// upper bound.
-func (m *SequenceMatcher) Ratio() float64 {
- matches := 0
- for _, m := range m.GetMatchingBlocks() {
- matches += m.Size
- }
- return calculateRatio(matches, len(m.a)+len(m.b))
-}
-
-// Return an upper bound on ratio() relatively quickly.
-//
-// This isn't defined beyond that it is an upper bound on .Ratio(), and
-// is faster to compute.
-func (m *SequenceMatcher) QuickRatio() float64 {
- // viewing a and b as multisets, set matches to the cardinality
- // of their intersection; this counts the number of matches
- // without regard to order, so is clearly an upper bound
- if m.fullBCount == nil {
- m.fullBCount = map[string]int{}
- for _, s := range m.b {
- m.fullBCount[s] = m.fullBCount[s] + 1
- }
- }
-
- // avail[x] is the number of times x appears in 'b' less the
- // number of times we've seen it in 'a' so far ... kinda
- avail := map[string]int{}
- matches := 0
- for _, s := range m.a {
- n, ok := avail[s]
- if !ok {
- n = m.fullBCount[s]
- }
- avail[s] = n - 1
- if n > 0 {
- matches += 1
- }
- }
- return calculateRatio(matches, len(m.a)+len(m.b))
-}
-
-// Return an upper bound on ratio() very quickly.
-//
-// This isn't defined beyond that it is an upper bound on .Ratio(), and
-// is faster to compute than either .Ratio() or .QuickRatio().
-func (m *SequenceMatcher) RealQuickRatio() float64 {
- la, lb := len(m.a), len(m.b)
- return calculateRatio(min(la, lb), la+lb)
-}
-
-// Convert range to the "ed" format
-func formatRangeUnified(start, stop int) string {
- // Per the diff spec at http://www.unix.org/single_unix_specification/
- beginning := start + 1 // lines start numbering with one
- length := stop - start
- if length == 1 {
- return fmt.Sprintf("%d", beginning)
- }
- if length == 0 {
- beginning -= 1 // empty ranges begin at line just before the range
- }
- return fmt.Sprintf("%d,%d", beginning, length)
-}
-
-// Unified diff parameters
-type UnifiedDiff struct {
- A []string // First sequence lines
- FromFile string // First file name
- FromDate string // First file time
- B []string // Second sequence lines
- ToFile string // Second file name
- ToDate string // Second file time
- Eol string // Headers end of line, defaults to LF
- Context int // Number of context lines
-}
-
-// Compare two sequences of lines; generate the delta as a unified diff.
-//
-// Unified diffs are a compact way of showing line changes and a few
-// lines of context. The number of context lines is set by 'n' which
-// defaults to three.
-//
-// By default, the diff control lines (those with ---, +++, or @@) are
-// created with a trailing newline. This is helpful so that inputs
-// created from file.readlines() result in diffs that are suitable for
-// file.writelines() since both the inputs and outputs have trailing
-// newlines.
-//
-// For inputs that do not have trailing newlines, set the lineterm
-// argument to "" so that the output will be uniformly newline free.
-//
-// The unidiff format normally has a header for filenames and modification
-// times. Any or all of these may be specified using strings for
-// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
-// The modification times are normally expressed in the ISO 8601 format.
-func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error {
- buf := bufio.NewWriter(writer)
- defer buf.Flush()
- wf := func(format string, args ...interface{}) error {
- _, err := buf.WriteString(fmt.Sprintf(format, args...))
- return err
- }
- ws := func(s string) error {
- _, err := buf.WriteString(s)
- return err
- }
-
- if len(diff.Eol) == 0 {
- diff.Eol = "\n"
- }
-
- started := false
- m := NewMatcher(diff.A, diff.B)
- for _, g := range m.GetGroupedOpCodes(diff.Context) {
- if !started {
- started = true
- fromDate := ""
- if len(diff.FromDate) > 0 {
- fromDate = "\t" + diff.FromDate
- }
- toDate := ""
- if len(diff.ToDate) > 0 {
- toDate = "\t" + diff.ToDate
- }
- if diff.FromFile != "" || diff.ToFile != "" {
- err := wf("--- %s%s%s", diff.FromFile, fromDate, diff.Eol)
- if err != nil {
- return err
- }
- err = wf("+++ %s%s%s", diff.ToFile, toDate, diff.Eol)
- if err != nil {
- return err
- }
- }
- }
- first, last := g[0], g[len(g)-1]
- range1 := formatRangeUnified(first.I1, last.I2)
- range2 := formatRangeUnified(first.J1, last.J2)
- if err := wf("@@ -%s +%s @@%s", range1, range2, diff.Eol); err != nil {
- return err
- }
- for _, c := range g {
- i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
- if c.Tag == 'e' {
- for _, line := range diff.A[i1:i2] {
- if err := ws(" " + line); err != nil {
- return err
- }
- }
- continue
- }
- if c.Tag == 'r' || c.Tag == 'd' {
- for _, line := range diff.A[i1:i2] {
- if err := ws("-" + line); err != nil {
- return err
- }
- }
- }
- if c.Tag == 'r' || c.Tag == 'i' {
- for _, line := range diff.B[j1:j2] {
- if err := ws("+" + line); err != nil {
- return err
- }
- }
- }
- }
- }
- return nil
-}
-
-// Like WriteUnifiedDiff but returns the diff a string.
-func GetUnifiedDiffString(diff UnifiedDiff) (string, error) {
- w := &bytes.Buffer{}
- err := WriteUnifiedDiff(w, diff)
- return string(w.Bytes()), err
-}
-
-// Convert range to the "ed" format.
-func formatRangeContext(start, stop int) string {
- // Per the diff spec at http://www.unix.org/single_unix_specification/
- beginning := start + 1 // lines start numbering with one
- length := stop - start
- if length == 0 {
- beginning -= 1 // empty ranges begin at line just before the range
- }
- if length <= 1 {
- return fmt.Sprintf("%d", beginning)
- }
- return fmt.Sprintf("%d,%d", beginning, beginning+length-1)
-}
-
-type ContextDiff UnifiedDiff
-
-// Compare two sequences of lines; generate the delta as a context diff.
-//
-// Context diffs are a compact way of showing line changes and a few
-// lines of context. The number of context lines is set by diff.Context
-// which defaults to three.
-//
-// By default, the diff control lines (those with *** or ---) are
-// created with a trailing newline.
-//
-// For inputs that do not have trailing newlines, set the diff.Eol
-// argument to "" so that the output will be uniformly newline free.
-//
-// The context diff format normally has a header for filenames and
-// modification times. Any or all of these may be specified using
-// strings for diff.FromFile, diff.ToFile, diff.FromDate, diff.ToDate.
-// The modification times are normally expressed in the ISO 8601 format.
-// If not specified, the strings default to blanks.
-func WriteContextDiff(writer io.Writer, diff ContextDiff) error {
- buf := bufio.NewWriter(writer)
- defer buf.Flush()
- var diffErr error
- wf := func(format string, args ...interface{}) {
- _, err := buf.WriteString(fmt.Sprintf(format, args...))
- if diffErr == nil && err != nil {
- diffErr = err
- }
- }
- ws := func(s string) {
- _, err := buf.WriteString(s)
- if diffErr == nil && err != nil {
- diffErr = err
- }
- }
-
- if len(diff.Eol) == 0 {
- diff.Eol = "\n"
- }
-
- prefix := map[byte]string{
- 'i': "+ ",
- 'd': "- ",
- 'r': "! ",
- 'e': " ",
- }
-
- started := false
- m := NewMatcher(diff.A, diff.B)
- for _, g := range m.GetGroupedOpCodes(diff.Context) {
- if !started {
- started = true
- fromDate := ""
- if len(diff.FromDate) > 0 {
- fromDate = "\t" + diff.FromDate
- }
- toDate := ""
- if len(diff.ToDate) > 0 {
- toDate = "\t" + diff.ToDate
- }
- if diff.FromFile != "" || diff.ToFile != "" {
- wf("*** %s%s%s", diff.FromFile, fromDate, diff.Eol)
- wf("--- %s%s%s", diff.ToFile, toDate, diff.Eol)
- }
- }
-
- first, last := g[0], g[len(g)-1]
- ws("***************" + diff.Eol)
-
- range1 := formatRangeContext(first.I1, last.I2)
- wf("*** %s ****%s", range1, diff.Eol)
- for _, c := range g {
- if c.Tag == 'r' || c.Tag == 'd' {
- for _, cc := range g {
- if cc.Tag == 'i' {
- continue
- }
- for _, line := range diff.A[cc.I1:cc.I2] {
- ws(prefix[cc.Tag] + line)
- }
- }
- break
- }
- }
-
- range2 := formatRangeContext(first.J1, last.J2)
- wf("--- %s ----%s", range2, diff.Eol)
- for _, c := range g {
- if c.Tag == 'r' || c.Tag == 'i' {
- for _, cc := range g {
- if cc.Tag == 'd' {
- continue
- }
- for _, line := range diff.B[cc.J1:cc.J2] {
- ws(prefix[cc.Tag] + line)
- }
- }
- break
- }
- }
- }
- return diffErr
-}
-
-// Like WriteContextDiff but returns the diff a string.
-func GetContextDiffString(diff ContextDiff) (string, error) {
- w := &bytes.Buffer{}
- err := WriteContextDiff(w, diff)
- return string(w.Bytes()), err
-}
-
-// Split a string on "\n" while preserving them. The output can be used
-// as input for UnifiedDiff and ContextDiff structures.
-func SplitLines(s string) []string {
- lines := strings.SplitAfter(s, "\n")
- lines[len(lines)-1] += "\n"
- return lines
-}
diff --git a/vendor/github.com/russross/blackfriday/.gitignore b/vendor/github.com/russross/blackfriday/.gitignore
deleted file mode 100644
index 75623dcccbb760b54b892fbbf3360ef156c86c5b..0000000000000000000000000000000000000000
--- a/vendor/github.com/russross/blackfriday/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-*.out
-*.swp
-*.8
-*.6
-_obj
-_test*
-markdown
-tags
diff --git a/vendor/github.com/russross/blackfriday/.travis.yml b/vendor/github.com/russross/blackfriday/.travis.yml
deleted file mode 100644
index a1687f17a3fec2653b867457fff19c13726f952a..0000000000000000000000000000000000000000
--- a/vendor/github.com/russross/blackfriday/.travis.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-sudo: false
-language: go
-go:
- - 1.5.4
- - 1.6.2
- - tip
-matrix:
- include:
- - go: 1.2.2
- script:
- - go get -t -v ./...
- - go test -v -race ./...
- - go: 1.3.3
- script:
- - go get -t -v ./...
- - go test -v -race ./...
- - go: 1.4.3
- script:
- - go get -t -v ./...
- - go test -v -race ./...
- allow_failures:
- - go: tip
- fast_finish: true
-install:
- - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step).
-script:
- - go get -t -v ./...
- - diff -u <(echo -n) <(gofmt -d -s .)
- - go tool vet .
- - go test -v -race ./...
diff --git a/vendor/github.com/russross/blackfriday/LICENSE.txt b/vendor/github.com/russross/blackfriday/LICENSE.txt
deleted file mode 100644
index 2885af3602d8207cd71c46b13af5bb64adc86574..0000000000000000000000000000000000000000
--- a/vendor/github.com/russross/blackfriday/LICENSE.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-Blackfriday is distributed under the Simplified BSD License:
-
-> Copyright © 2011 Russ Ross
-> All rights reserved.
->
-> Redistribution and use in source and binary forms, with or without
-> modification, are permitted provided that the following conditions
-> are met:
->
-> 1. Redistributions of source code must retain the above copyright
-> notice, this list of conditions and the following disclaimer.
->
-> 2. Redistributions in binary form must reproduce the above
-> copyright notice, this list of conditions and the following
-> disclaimer in the documentation and/or other materials provided with
-> the distribution.
->
-> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-> "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-> LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-> FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-> COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-> INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-> BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-> LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-> LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-> ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-> POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/russross/blackfriday/README.md b/vendor/github.com/russross/blackfriday/README.md
deleted file mode 100644
index a6c94b79ef0fb6ac3b601a48efae4c202472a4da..0000000000000000000000000000000000000000
--- a/vendor/github.com/russross/blackfriday/README.md
+++ /dev/null
@@ -1,363 +0,0 @@
-Blackfriday
-[![Build Status][BuildSVG]][BuildURL]
-[![Godoc][GodocV2SVG]][GodocV2URL]
-===========
-
-Blackfriday is a [Markdown][1] processor implemented in [Go][2]. It
-is paranoid about its input (so you can safely feed it user-supplied
-data), it is fast, it supports common extensions (tables, smart
-punctuation substitutions, etc.), and it is safe for all utf-8
-(unicode) input.
-
-HTML output is currently supported, along with Smartypants
-extensions.
-
-It started as a translation from C of [Sundown][3].
-
-
-Installation
-------------
-
-Blackfriday is compatible with any modern Go release. With Go and git installed:
-
- go get -u gopkg.in/russross/blackfriday.v2
-
-will download, compile, and install the package into your `$GOPATH` directory
-hierarchy.
-
-
-Versions
---------
-
-Currently maintained and recommended version of Blackfriday is `v2`. It's being
-developed on its own branch: https://github.com/russross/blackfriday/tree/v2 and the
-documentation is available at
-https://godoc.org/gopkg.in/russross/blackfriday.v2.
-
-It is `go get`-able via via [gopkg.in][6] at `gopkg.in/russross/blackfriday.v2`,
-but we highly recommend using package management tool like [dep][7] or
-[Glide][8] and make use of semantic versioning. With package management you
-should import `github.com/russross/blackfriday` and specify that you're using
-version 2.0.0.
-
-Version 2 offers a number of improvements over v1:
-
-* Cleaned up API
-* A separate call to [`Parse`][4], which produces an abstract syntax tree for
- the document
-* Latest bug fixes
-* Flexibility to easily add your own rendering extensions
-
-Potential drawbacks:
-
-* Our benchmarks show v2 to be slightly slower than v1. Currently in the
- ballpark of around 15%.
-* API breakage. If you can't afford modifying your code to adhere to the new API
- and don't care too much about the new features, v2 is probably not for you.
-* Several bug fixes are trailing behind and still need to be forward-ported to
- v2. See issue [#348](https://github.com/russross/blackfriday/issues/348) for
- tracking.
-
-If you are still interested in the legacy `v1`, you can import it from
-`github.com/russross/blackfriday`. Documentation for the legacy v1 can be found
-here: https://godoc.org/github.com/russross/blackfriday
-
-### Known issue with `dep`
-
-There is a known problem with using Blackfriday v1 _transitively_ and `dep`.
-Currently `dep` prioritizes semver versions over anything else, and picks the
-latest one, plus it does not apply a `[[constraint]]` specifier to transitively
-pulled in packages. So if you're using something that uses Blackfriday v1, but
-that something does not use `dep` yet, you will get Blackfriday v2 pulled in and
-your first dependency will fail to build.
-
-There are couple of fixes for it, documented here:
-https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-constrain-a-transitive-dependencys-version
-
-Meanwhile, `dep` team is working on a more general solution to the constraints
-on transitive dependencies problem: https://github.com/golang/dep/issues/1124.
-
-
-Usage
------
-
-### v1
-
-For basic usage, it is as simple as getting your input into a byte
-slice and calling:
-
- output := blackfriday.MarkdownBasic(input)
-
-This renders it with no extensions enabled. To get a more useful
-feature set, use this instead:
-
- output := blackfriday.MarkdownCommon(input)
-
-### v2
-
-For the most sensible markdown processing, it is as simple as getting your input
-into a byte slice and calling:
-
-```go
-output := blackfriday.Run(input)
-```
-
-Your input will be parsed and the output rendered with a set of most popular
-extensions enabled. If you want the most basic feature set, corresponding with
-the bare Markdown specification, use:
-
-```go
-output := blackfriday.Run(input, blackfriday.WithNoExtensions())
-```
-
-### Sanitize untrusted content
-
-Blackfriday itself does nothing to protect against malicious content. If you are
-dealing with user-supplied markdown, we recommend running Blackfriday's output
-through HTML sanitizer such as [Bluemonday][5].
-
-Here's an example of simple usage of Blackfriday together with Bluemonday:
-
-```go
-import (
- "github.com/microcosm-cc/bluemonday"
- "gopkg.in/russross/blackfriday.v2"
-)
-
-// ...
-unsafe := blackfriday.Run(input)
-html := bluemonday.UGCPolicy().SanitizeBytes(unsafe)
-```
-
-### Custom options, v1
-
-If you want to customize the set of options, first get a renderer
-(currently only the HTML output engine), then use it to
-call the more general `Markdown` function. For examples, see the
-implementations of `MarkdownBasic` and `MarkdownCommon` in
-`markdown.go`.
-
-### Custom options, v2
-
-If you want to customize the set of options, use `blackfriday.WithExtensions`,
-`blackfriday.WithRenderer` and `blackfriday.WithRefOverride`.
-
-### `blackfriday-tool`
-
-You can also check out `blackfriday-tool` for a more complete example
-of how to use it. Download and install it using:
-
- go get github.com/russross/blackfriday-tool
-
-This is a simple command-line tool that allows you to process a
-markdown file using a standalone program. You can also browse the
-source directly on github if you are just looking for some example
-code:
-
-*
-
-Note that if you have not already done so, installing
-`blackfriday-tool` will be sufficient to download and install
-blackfriday in addition to the tool itself. The tool binary will be
-installed in `$GOPATH/bin`. This is a statically-linked binary that
-can be copied to wherever you need it without worrying about
-dependencies and library versions.
-
-### Sanitized anchor names
-
-Blackfriday includes an algorithm for creating sanitized anchor names
-corresponding to a given input text. This algorithm is used to create
-anchors for headings when `EXTENSION_AUTO_HEADER_IDS` is enabled. The
-algorithm has a specification, so that other packages can create
-compatible anchor names and links to those anchors.
-
-The specification is located at https://godoc.org/github.com/russross/blackfriday#hdr-Sanitized_Anchor_Names.
-
-[`SanitizedAnchorName`](https://godoc.org/github.com/russross/blackfriday#SanitizedAnchorName) exposes this functionality, and can be used to
-create compatible links to the anchor names generated by blackfriday.
-This algorithm is also implemented in a small standalone package at
-[`github.com/shurcooL/sanitized_anchor_name`](https://godoc.org/github.com/shurcooL/sanitized_anchor_name). It can be useful for clients
-that want a small package and don't need full functionality of blackfriday.
-
-
-Features
---------
-
-All features of Sundown are supported, including:
-
-* **Compatibility**. The Markdown v1.0.3 test suite passes with
- the `--tidy` option. Without `--tidy`, the differences are
- mostly in whitespace and entity escaping, where blackfriday is
- more consistent and cleaner.
-
-* **Common extensions**, including table support, fenced code
- blocks, autolinks, strikethroughs, non-strict emphasis, etc.
-
-* **Safety**. Blackfriday is paranoid when parsing, making it safe
- to feed untrusted user input without fear of bad things
- happening. The test suite stress tests this and there are no
- known inputs that make it crash. If you find one, please let me
- know and send me the input that does it.
-
- NOTE: "safety" in this context means *runtime safety only*. In order to
- protect yourself against JavaScript injection in untrusted content, see
- [this example](https://github.com/russross/blackfriday#sanitize-untrusted-content).
-
-* **Fast processing**. It is fast enough to render on-demand in
- most web applications without having to cache the output.
-
-* **Thread safety**. You can run multiple parsers in different
- goroutines without ill effect. There is no dependence on global
- shared state.
-
-* **Minimal dependencies**. Blackfriday only depends on standard
- library packages in Go. The source code is pretty
- self-contained, so it is easy to add to any project, including
- Google App Engine projects.
-
-* **Standards compliant**. Output successfully validates using the
- W3C validation tool for HTML 4.01 and XHTML 1.0 Transitional.
-
-
-Extensions
-----------
-
-In addition to the standard markdown syntax, this package
-implements the following extensions:
-
-* **Intra-word emphasis supression**. The `_` character is
- commonly used inside words when discussing code, so having
- markdown interpret it as an emphasis command is usually the
- wrong thing. Blackfriday lets you treat all emphasis markers as
- normal characters when they occur inside a word.
-
-* **Tables**. Tables can be created by drawing them in the input
- using a simple syntax:
-
- ```
- Name | Age
- --------|------
- Bob | 27
- Alice | 23
- ```
-
-* **Fenced code blocks**. In addition to the normal 4-space
- indentation to mark code blocks, you can explicitly mark them
- and supply a language (to make syntax highlighting simple). Just
- mark it like this:
-
- ``` go
- func getTrue() bool {
- return true
- }
- ```
-
- You can use 3 or more backticks to mark the beginning of the
- block, and the same number to mark the end of the block.
-
- To preserve classes of fenced code blocks while using the bluemonday
- HTML sanitizer, use the following policy:
-
- ``` go
- p := bluemonday.UGCPolicy()
- p.AllowAttrs("class").Matching(regexp.MustCompile("^language-[a-zA-Z0-9]+$")).OnElements("code")
- html := p.SanitizeBytes(unsafe)
- ```
-
-* **Definition lists**. A simple definition list is made of a single-line
- term followed by a colon and the definition for that term.
-
- Cat
- : Fluffy animal everyone likes
-
- Internet
- : Vector of transmission for pictures of cats
-
- Terms must be separated from the previous definition by a blank line.
-
-* **Footnotes**. A marker in the text that will become a superscript number;
- a footnote definition that will be placed in a list of footnotes at the
- end of the document. A footnote looks like this:
-
- This is a footnote.[^1]
-
- [^1]: the footnote text.
-
-* **Autolinking**. Blackfriday can find URLs that have not been
- explicitly marked as links and turn them into links.
-
-* **Strikethrough**. Use two tildes (`~~`) to mark text that
- should be crossed out.
-
-* **Hard line breaks**. With this extension enabled (it is off by
- default in the `MarkdownBasic` and `MarkdownCommon` convenience
- functions), newlines in the input translate into line breaks in
- the output.
-
-* **Smart quotes**. Smartypants-style punctuation substitution is
- supported, turning normal double- and single-quote marks into
- curly quotes, etc.
-
-* **LaTeX-style dash parsing** is an additional option, where `--`
- is translated into `–`, and `---` is translated into
- `—`. This differs from most smartypants processors, which
- turn a single hyphen into an ndash and a double hyphen into an
- mdash.
-
-* **Smart fractions**, where anything that looks like a fraction
- is translated into suitable HTML (instead of just a few special
- cases like most smartypant processors). For example, `4/5`
- becomes `4 ⁄5 `, which renders as
- 4 ⁄5 .
-
-
-Other renderers
----------------
-
-Blackfriday is structured to allow alternative rendering engines. Here
-are a few of note:
-
-* [github_flavored_markdown](https://godoc.org/github.com/shurcooL/github_flavored_markdown):
- provides a GitHub Flavored Markdown renderer with fenced code block
- highlighting, clickable heading anchor links.
-
- It's not customizable, and its goal is to produce HTML output
- equivalent to the [GitHub Markdown API endpoint](https://developer.github.com/v3/markdown/#render-a-markdown-document-in-raw-mode),
- except the rendering is performed locally.
-
-* [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt,
- but for markdown.
-
-* [LaTeX output](https://bitbucket.org/ambrevar/blackfriday-latex):
- renders output as LaTeX.
-
-
-TODO
-----
-
-* More unit testing
-* Improve Unicode support. It does not understand all Unicode
- rules (about what constitutes a letter, a punctuation symbol,
- etc.), so it may fail to detect word boundaries correctly in
- some instances. It is safe on all UTF-8 input.
-
-
-License
--------
-
-[Blackfriday is distributed under the Simplified BSD License](LICENSE.txt)
-
-
- [1]: https://daringfireball.net/projects/markdown/ "Markdown"
- [2]: https://golang.org/ "Go Language"
- [3]: https://github.com/vmg/sundown "Sundown"
- [4]: https://godoc.org/gopkg.in/russross/blackfriday.v2#Parse "Parse func"
- [5]: https://github.com/microcosm-cc/bluemonday "Bluemonday"
- [6]: https://labix.org/gopkg.in "gopkg.in"
- [7]: https://github.com/golang/dep/ "dep"
- [8]: https://github.com/Masterminds/glide "Glide"
-
- [BuildSVG]: https://travis-ci.org/russross/blackfriday.svg?branch=master
- [BuildURL]: https://travis-ci.org/russross/blackfriday
- [GodocV2SVG]: https://godoc.org/gopkg.in/russross/blackfriday.v2?status.svg
- [GodocV2URL]: https://godoc.org/gopkg.in/russross/blackfriday.v2
diff --git a/vendor/github.com/russross/blackfriday/block.go b/vendor/github.com/russross/blackfriday/block.go
deleted file mode 100644
index 7fc731d54881b1e51d635f1b203f1211422c99be..0000000000000000000000000000000000000000
--- a/vendor/github.com/russross/blackfriday/block.go
+++ /dev/null
@@ -1,1450 +0,0 @@
-//
-// Blackfriday Markdown Processor
-// Available at http://github.com/russross/blackfriday
-//
-// Copyright © 2011 Russ Ross .
-// Distributed under the Simplified BSD License.
-// See README.md for details.
-//
-
-//
-// Functions to parse block-level elements.
-//
-
-package blackfriday
-
-import (
- "bytes"
- "unicode"
-)
-
-// Parse block-level data.
-// Note: this function and many that it calls assume that
-// the input buffer ends with a newline.
-func (p *parser) block(out *bytes.Buffer, data []byte) {
- if len(data) == 0 || data[len(data)-1] != '\n' {
- panic("block input is missing terminating newline")
- }
-
- // this is called recursively: enforce a maximum depth
- if p.nesting >= p.maxNesting {
- return
- }
- p.nesting++
-
- // parse out one block-level construct at a time
- for len(data) > 0 {
- // prefixed header:
- //
- // # Header 1
- // ## Header 2
- // ...
- // ###### Header 6
- if p.isPrefixHeader(data) {
- data = data[p.prefixHeader(out, data):]
- continue
- }
-
- // block of preformatted HTML:
- //
- //
- // ...
- //
- if data[0] == '<' {
- if i := p.html(out, data, true); i > 0 {
- data = data[i:]
- continue
- }
- }
-
- // title block
- //
- // % stuff
- // % more stuff
- // % even more stuff
- if p.flags&EXTENSION_TITLEBLOCK != 0 {
- if data[0] == '%' {
- if i := p.titleBlock(out, data, true); i > 0 {
- data = data[i:]
- continue
- }
- }
- }
-
- // blank lines. note: returns the # of bytes to skip
- if i := p.isEmpty(data); i > 0 {
- data = data[i:]
- continue
- }
-
- // indented code block:
- //
- // func max(a, b int) int {
- // if a > b {
- // return a
- // }
- // return b
- // }
- if p.codePrefix(data) > 0 {
- data = data[p.code(out, data):]
- continue
- }
-
- // fenced code block:
- //
- // ``` go
- // func fact(n int) int {
- // if n <= 1 {
- // return n
- // }
- // return n * fact(n-1)
- // }
- // ```
- if p.flags&EXTENSION_FENCED_CODE != 0 {
- if i := p.fencedCodeBlock(out, data, true); i > 0 {
- data = data[i:]
- continue
- }
- }
-
- // horizontal rule:
- //
- // ------
- // or
- // ******
- // or
- // ______
- if p.isHRule(data) {
- p.r.HRule(out)
- var i int
- for i = 0; data[i] != '\n'; i++ {
- }
- data = data[i:]
- continue
- }
-
- // block quote:
- //
- // > A big quote I found somewhere
- // > on the web
- if p.quotePrefix(data) > 0 {
- data = data[p.quote(out, data):]
- continue
- }
-
- // table:
- //
- // Name | Age | Phone
- // ------|-----|---------
- // Bob | 31 | 555-1234
- // Alice | 27 | 555-4321
- if p.flags&EXTENSION_TABLES != 0 {
- if i := p.table(out, data); i > 0 {
- data = data[i:]
- continue
- }
- }
-
- // an itemized/unordered list:
- //
- // * Item 1
- // * Item 2
- //
- // also works with + or -
- if p.uliPrefix(data) > 0 {
- data = data[p.list(out, data, 0):]
- continue
- }
-
- // a numbered/ordered list:
- //
- // 1. Item 1
- // 2. Item 2
- if p.oliPrefix(data) > 0 {
- data = data[p.list(out, data, LIST_TYPE_ORDERED):]
- continue
- }
-
- // definition lists:
- //
- // Term 1
- // : Definition a
- // : Definition b
- //
- // Term 2
- // : Definition c
- if p.flags&EXTENSION_DEFINITION_LISTS != 0 {
- if p.dliPrefix(data) > 0 {
- data = data[p.list(out, data, LIST_TYPE_DEFINITION):]
- continue
- }
- }
-
- // anything else must look like a normal paragraph
- // note: this finds underlined headers, too
- data = data[p.paragraph(out, data):]
- }
-
- p.nesting--
-}
-
-func (p *parser) isPrefixHeader(data []byte) bool {
- if data[0] != '#' {
- return false
- }
-
- if p.flags&EXTENSION_SPACE_HEADERS != 0 {
- level := 0
- for level < 6 && data[level] == '#' {
- level++
- }
- if data[level] != ' ' {
- return false
- }
- }
- return true
-}
-
-func (p *parser) prefixHeader(out *bytes.Buffer, data []byte) int {
- level := 0
- for level < 6 && data[level] == '#' {
- level++
- }
- i := skipChar(data, level, ' ')
- end := skipUntilChar(data, i, '\n')
- skip := end
- id := ""
- if p.flags&EXTENSION_HEADER_IDS != 0 {
- j, k := 0, 0
- // find start/end of header id
- for j = i; j < end-1 && (data[j] != '{' || data[j+1] != '#'); j++ {
- }
- for k = j + 1; k < end && data[k] != '}'; k++ {
- }
- // extract header id iff found
- if j < end && k < end {
- id = string(data[j+2 : k])
- end = j
- skip = k + 1
- for end > 0 && data[end-1] == ' ' {
- end--
- }
- }
- }
- for end > 0 && data[end-1] == '#' {
- if isBackslashEscaped(data, end-1) {
- break
- }
- end--
- }
- for end > 0 && data[end-1] == ' ' {
- end--
- }
- if end > i {
- if id == "" && p.flags&EXTENSION_AUTO_HEADER_IDS != 0 {
- id = SanitizedAnchorName(string(data[i:end]))
- }
- work := func() bool {
- p.inline(out, data[i:end])
- return true
- }
- p.r.Header(out, work, level, id)
- }
- return skip
-}
-
-func (p *parser) isUnderlinedHeader(data []byte) int {
- // test of level 1 header
- if data[0] == '=' {
- i := skipChar(data, 1, '=')
- i = skipChar(data, i, ' ')
- if data[i] == '\n' {
- return 1
- } else {
- return 0
- }
- }
-
- // test of level 2 header
- if data[0] == '-' {
- i := skipChar(data, 1, '-')
- i = skipChar(data, i, ' ')
- if data[i] == '\n' {
- return 2
- } else {
- return 0
- }
- }
-
- return 0
-}
-
-func (p *parser) titleBlock(out *bytes.Buffer, data []byte, doRender bool) int {
- if data[0] != '%' {
- return 0
- }
- splitData := bytes.Split(data, []byte("\n"))
- var i int
- for idx, b := range splitData {
- if !bytes.HasPrefix(b, []byte("%")) {
- i = idx // - 1
- break
- }
- }
-
- data = bytes.Join(splitData[0:i], []byte("\n"))
- p.r.TitleBlock(out, data)
-
- return len(data)
-}
-
-func (p *parser) html(out *bytes.Buffer, data []byte, doRender bool) int {
- var i, j int
-
- // identify the opening tag
- if data[0] != '<' {
- return 0
- }
- curtag, tagfound := p.htmlFindTag(data[1:])
-
- // handle special cases
- if !tagfound {
- // check for an HTML comment
- if size := p.htmlComment(out, data, doRender); size > 0 {
- return size
- }
-
- // check for an tag
- if size := p.htmlHr(out, data, doRender); size > 0 {
- return size
- }
-
- // check for HTML CDATA
- if size := p.htmlCDATA(out, data, doRender); size > 0 {
- return size
- }
-
- // no special case recognized
- return 0
- }
-
- // look for an unindented matching closing tag
- // followed by a blank line
- found := false
- /*
- closetag := []byte("\n" + curtag + ">")
- j = len(curtag) + 1
- for !found {
- // scan for a closing tag at the beginning of a line
- if skip := bytes.Index(data[j:], closetag); skip >= 0 {
- j += skip + len(closetag)
- } else {
- break
- }
-
- // see if it is the only thing on the line
- if skip := p.isEmpty(data[j:]); skip > 0 {
- // see if it is followed by a blank line/eof
- j += skip
- if j >= len(data) {
- found = true
- i = j
- } else {
- if skip := p.isEmpty(data[j:]); skip > 0 {
- j += skip
- found = true
- i = j
- }
- }
- }
- }
- */
-
- // if not found, try a second pass looking for indented match
- // but not if tag is "ins" or "del" (following original Markdown.pl)
- if !found && curtag != "ins" && curtag != "del" {
- i = 1
- for i < len(data) {
- i++
- for i < len(data) && !(data[i-1] == '<' && data[i] == '/') {
- i++
- }
-
- if i+2+len(curtag) >= len(data) {
- break
- }
-
- j = p.htmlFindEnd(curtag, data[i-1:])
-
- if j > 0 {
- i += j - 1
- found = true
- break
- }
- }
- }
-
- if !found {
- return 0
- }
-
- // the end of the block has been found
- if doRender {
- // trim newlines
- end := i
- for end > 0 && data[end-1] == '\n' {
- end--
- }
- p.r.BlockHtml(out, data[:end])
- }
-
- return i
-}
-
-func (p *parser) renderHTMLBlock(out *bytes.Buffer, data []byte, start int, doRender bool) int {
- // html block needs to end with a blank line
- if i := p.isEmpty(data[start:]); i > 0 {
- size := start + i
- if doRender {
- // trim trailing newlines
- end := size
- for end > 0 && data[end-1] == '\n' {
- end--
- }
- p.r.BlockHtml(out, data[:end])
- }
- return size
- }
- return 0
-}
-
-// HTML comment, lax form
-func (p *parser) htmlComment(out *bytes.Buffer, data []byte, doRender bool) int {
- i := p.inlineHTMLComment(out, data)
- return p.renderHTMLBlock(out, data, i, doRender)
-}
-
-// HTML CDATA section
-func (p *parser) htmlCDATA(out *bytes.Buffer, data []byte, doRender bool) int {
- const cdataTag = "') {
- i++
- }
- i++
- // no end-of-comment marker
- if i >= len(data) {
- return 0
- }
- return p.renderHTMLBlock(out, data, i, doRender)
-}
-
-// HR, which is the only self-closing block tag considered
-func (p *parser) htmlHr(out *bytes.Buffer, data []byte, doRender bool) int {
- if data[0] != '<' || (data[1] != 'h' && data[1] != 'H') || (data[2] != 'r' && data[2] != 'R') {
- return 0
- }
- if data[3] != ' ' && data[3] != '/' && data[3] != '>' {
- // not an tag after all; at least not a valid one
- return 0
- }
-
- i := 3
- for data[i] != '>' && data[i] != '\n' {
- i++
- }
-
- if data[i] == '>' {
- return p.renderHTMLBlock(out, data, i+1, doRender)
- }
-
- return 0
-}
-
-func (p *parser) htmlFindTag(data []byte) (string, bool) {
- i := 0
- for isalnum(data[i]) {
- i++
- }
- key := string(data[:i])
- if _, ok := blockTags[key]; ok {
- return key, true
- }
- return "", false
-}
-
-func (p *parser) htmlFindEnd(tag string, data []byte) int {
- // assume data[0] == '<' && data[1] == '/' already tested
-
- // check if tag is a match
- closetag := []byte("" + tag + ">")
- if !bytes.HasPrefix(data, closetag) {
- return 0
- }
- i := len(closetag)
-
- // check that the rest of the line is blank
- skip := 0
- if skip = p.isEmpty(data[i:]); skip == 0 {
- return 0
- }
- i += skip
- skip = 0
-
- if i >= len(data) {
- return i
- }
-
- if p.flags&EXTENSION_LAX_HTML_BLOCKS != 0 {
- return i
- }
- if skip = p.isEmpty(data[i:]); skip == 0 {
- // following line must be blank
- return 0
- }
-
- return i + skip
-}
-
-func (*parser) isEmpty(data []byte) int {
- // it is okay to call isEmpty on an empty buffer
- if len(data) == 0 {
- return 0
- }
-
- var i int
- for i = 0; i < len(data) && data[i] != '\n'; i++ {
- if data[i] != ' ' && data[i] != '\t' {
- return 0
- }
- }
- return i + 1
-}
-
-func (*parser) isHRule(data []byte) bool {
- i := 0
-
- // skip up to three spaces
- for i < 3 && data[i] == ' ' {
- i++
- }
-
- // look at the hrule char
- if data[i] != '*' && data[i] != '-' && data[i] != '_' {
- return false
- }
- c := data[i]
-
- // the whole line must be the char or whitespace
- n := 0
- for data[i] != '\n' {
- switch {
- case data[i] == c:
- n++
- case data[i] != ' ':
- return false
- }
- i++
- }
-
- return n >= 3
-}
-
-// isFenceLine checks if there's a fence line (e.g., ``` or ``` go) at the beginning of data,
-// and returns the end index if so, or 0 otherwise. It also returns the marker found.
-// If syntax is not nil, it gets set to the syntax specified in the fence line.
-// A final newline is mandatory to recognize the fence line, unless newlineOptional is true.
-func isFenceLine(data []byte, syntax *string, oldmarker string, newlineOptional bool) (end int, marker string) {
- i, size := 0, 0
-
- // skip up to three spaces
- for i < len(data) && i < 3 && data[i] == ' ' {
- i++
- }
-
- // check for the marker characters: ~ or `
- if i >= len(data) {
- return 0, ""
- }
- if data[i] != '~' && data[i] != '`' {
- return 0, ""
- }
-
- c := data[i]
-
- // the whole line must be the same char or whitespace
- for i < len(data) && data[i] == c {
- size++
- i++
- }
-
- // the marker char must occur at least 3 times
- if size < 3 {
- return 0, ""
- }
- marker = string(data[i-size : i])
-
- // if this is the end marker, it must match the beginning marker
- if oldmarker != "" && marker != oldmarker {
- return 0, ""
- }
-
- // TODO(shurcooL): It's probably a good idea to simplify the 2 code paths here
- // into one, always get the syntax, and discard it if the caller doesn't care.
- if syntax != nil {
- syn := 0
- i = skipChar(data, i, ' ')
-
- if i >= len(data) {
- if newlineOptional && i == len(data) {
- return i, marker
- }
- return 0, ""
- }
-
- syntaxStart := i
-
- if data[i] == '{' {
- i++
- syntaxStart++
-
- for i < len(data) && data[i] != '}' && data[i] != '\n' {
- syn++
- i++
- }
-
- if i >= len(data) || data[i] != '}' {
- return 0, ""
- }
-
- // strip all whitespace at the beginning and the end
- // of the {} block
- for syn > 0 && isspace(data[syntaxStart]) {
- syntaxStart++
- syn--
- }
-
- for syn > 0 && isspace(data[syntaxStart+syn-1]) {
- syn--
- }
-
- i++
- } else {
- for i < len(data) && !isspace(data[i]) {
- syn++
- i++
- }
- }
-
- *syntax = string(data[syntaxStart : syntaxStart+syn])
- }
-
- i = skipChar(data, i, ' ')
- if i >= len(data) || data[i] != '\n' {
- if newlineOptional && i == len(data) {
- return i, marker
- }
- return 0, ""
- }
-
- return i + 1, marker // Take newline into account.
-}
-
-// fencedCodeBlock returns the end index if data contains a fenced code block at the beginning,
-// or 0 otherwise. It writes to out if doRender is true, otherwise it has no side effects.
-// If doRender is true, a final newline is mandatory to recognize the fenced code block.
-func (p *parser) fencedCodeBlock(out *bytes.Buffer, data []byte, doRender bool) int {
- var syntax string
- beg, marker := isFenceLine(data, &syntax, "", false)
- if beg == 0 || beg >= len(data) {
- return 0
- }
-
- var work bytes.Buffer
-
- for {
- // safe to assume beg < len(data)
-
- // check for the end of the code block
- newlineOptional := !doRender
- fenceEnd, _ := isFenceLine(data[beg:], nil, marker, newlineOptional)
- if fenceEnd != 0 {
- beg += fenceEnd
- break
- }
-
- // copy the current line
- end := skipUntilChar(data, beg, '\n') + 1
-
- // did we reach the end of the buffer without a closing marker?
- if end >= len(data) {
- return 0
- }
-
- // verbatim copy to the working buffer
- if doRender {
- work.Write(data[beg:end])
- }
- beg = end
- }
-
- if doRender {
- p.r.BlockCode(out, work.Bytes(), syntax)
- }
-
- return beg
-}
-
-func (p *parser) table(out *bytes.Buffer, data []byte) int {
- var header bytes.Buffer
- i, columns := p.tableHeader(&header, data)
- if i == 0 {
- return 0
- }
-
- var body bytes.Buffer
-
- for i < len(data) {
- pipes, rowStart := 0, i
- for ; data[i] != '\n'; i++ {
- if data[i] == '|' {
- pipes++
- }
- }
-
- if pipes == 0 {
- i = rowStart
- break
- }
-
- // include the newline in data sent to tableRow
- i++
- p.tableRow(&body, data[rowStart:i], columns, false)
- }
-
- p.r.Table(out, header.Bytes(), body.Bytes(), columns)
-
- return i
-}
-
-// check if the specified position is preceded by an odd number of backslashes
-func isBackslashEscaped(data []byte, i int) bool {
- backslashes := 0
- for i-backslashes-1 >= 0 && data[i-backslashes-1] == '\\' {
- backslashes++
- }
- return backslashes&1 == 1
-}
-
-func (p *parser) tableHeader(out *bytes.Buffer, data []byte) (size int, columns []int) {
- i := 0
- colCount := 1
- for i = 0; data[i] != '\n'; i++ {
- if data[i] == '|' && !isBackslashEscaped(data, i) {
- colCount++
- }
- }
-
- // doesn't look like a table header
- if colCount == 1 {
- return
- }
-
- // include the newline in the data sent to tableRow
- header := data[:i+1]
-
- // column count ignores pipes at beginning or end of line
- if data[0] == '|' {
- colCount--
- }
- if i > 2 && data[i-1] == '|' && !isBackslashEscaped(data, i-1) {
- colCount--
- }
-
- columns = make([]int, colCount)
-
- // move on to the header underline
- i++
- if i >= len(data) {
- return
- }
-
- if data[i] == '|' && !isBackslashEscaped(data, i) {
- i++
- }
- i = skipChar(data, i, ' ')
-
- // each column header is of form: / *:?-+:? *|/ with # dashes + # colons >= 3
- // and trailing | optional on last column
- col := 0
- for data[i] != '\n' {
- dashes := 0
-
- if data[i] == ':' {
- i++
- columns[col] |= TABLE_ALIGNMENT_LEFT
- dashes++
- }
- for data[i] == '-' {
- i++
- dashes++
- }
- if data[i] == ':' {
- i++
- columns[col] |= TABLE_ALIGNMENT_RIGHT
- dashes++
- }
- for data[i] == ' ' {
- i++
- }
-
- // end of column test is messy
- switch {
- case dashes < 3:
- // not a valid column
- return
-
- case data[i] == '|' && !isBackslashEscaped(data, i):
- // marker found, now skip past trailing whitespace
- col++
- i++
- for data[i] == ' ' {
- i++
- }
-
- // trailing junk found after last column
- if col >= colCount && data[i] != '\n' {
- return
- }
-
- case (data[i] != '|' || isBackslashEscaped(data, i)) && col+1 < colCount:
- // something else found where marker was required
- return
-
- case data[i] == '\n':
- // marker is optional for the last column
- col++
-
- default:
- // trailing junk found after last column
- return
- }
- }
- if col != colCount {
- return
- }
-
- p.tableRow(out, header, columns, true)
- size = i + 1
- return
-}
-
-func (p *parser) tableRow(out *bytes.Buffer, data []byte, columns []int, header bool) {
- i, col := 0, 0
- var rowWork bytes.Buffer
-
- if data[i] == '|' && !isBackslashEscaped(data, i) {
- i++
- }
-
- for col = 0; col < len(columns) && i < len(data); col++ {
- for data[i] == ' ' {
- i++
- }
-
- cellStart := i
-
- for (data[i] != '|' || isBackslashEscaped(data, i)) && data[i] != '\n' {
- i++
- }
-
- cellEnd := i
-
- // skip the end-of-cell marker, possibly taking us past end of buffer
- i++
-
- for cellEnd > cellStart && data[cellEnd-1] == ' ' {
- cellEnd--
- }
-
- var cellWork bytes.Buffer
- p.inline(&cellWork, data[cellStart:cellEnd])
-
- if header {
- p.r.TableHeaderCell(&rowWork, cellWork.Bytes(), columns[col])
- } else {
- p.r.TableCell(&rowWork, cellWork.Bytes(), columns[col])
- }
- }
-
- // pad it out with empty columns to get the right number
- for ; col < len(columns); col++ {
- if header {
- p.r.TableHeaderCell(&rowWork, nil, columns[col])
- } else {
- p.r.TableCell(&rowWork, nil, columns[col])
- }
- }
-
- // silently ignore rows with too many cells
-
- p.r.TableRow(out, rowWork.Bytes())
-}
-
-// returns blockquote prefix length
-func (p *parser) quotePrefix(data []byte) int {
- i := 0
- for i < 3 && data[i] == ' ' {
- i++
- }
- if data[i] == '>' {
- if data[i+1] == ' ' {
- return i + 2
- }
- return i + 1
- }
- return 0
-}
-
-// blockquote ends with at least one blank line
-// followed by something without a blockquote prefix
-func (p *parser) terminateBlockquote(data []byte, beg, end int) bool {
- if p.isEmpty(data[beg:]) <= 0 {
- return false
- }
- if end >= len(data) {
- return true
- }
- return p.quotePrefix(data[end:]) == 0 && p.isEmpty(data[end:]) == 0
-}
-
-// parse a blockquote fragment
-func (p *parser) quote(out *bytes.Buffer, data []byte) int {
- var raw bytes.Buffer
- beg, end := 0, 0
- for beg < len(data) {
- end = beg
- // Step over whole lines, collecting them. While doing that, check for
- // fenced code and if one's found, incorporate it altogether,
- // irregardless of any contents inside it
- for data[end] != '\n' {
- if p.flags&EXTENSION_FENCED_CODE != 0 {
- if i := p.fencedCodeBlock(out, data[end:], false); i > 0 {
- // -1 to compensate for the extra end++ after the loop:
- end += i - 1
- break
- }
- }
- end++
- }
- end++
-
- if pre := p.quotePrefix(data[beg:]); pre > 0 {
- // skip the prefix
- beg += pre
- } else if p.terminateBlockquote(data, beg, end) {
- break
- }
-
- // this line is part of the blockquote
- raw.Write(data[beg:end])
- beg = end
- }
-
- var cooked bytes.Buffer
- p.block(&cooked, raw.Bytes())
- p.r.BlockQuote(out, cooked.Bytes())
- return end
-}
-
-// returns prefix length for block code
-func (p *parser) codePrefix(data []byte) int {
- if data[0] == ' ' && data[1] == ' ' && data[2] == ' ' && data[3] == ' ' {
- return 4
- }
- return 0
-}
-
-func (p *parser) code(out *bytes.Buffer, data []byte) int {
- var work bytes.Buffer
-
- i := 0
- for i < len(data) {
- beg := i
- for data[i] != '\n' {
- i++
- }
- i++
-
- blankline := p.isEmpty(data[beg:i]) > 0
- if pre := p.codePrefix(data[beg:i]); pre > 0 {
- beg += pre
- } else if !blankline {
- // non-empty, non-prefixed line breaks the pre
- i = beg
- break
- }
-
- // verbatim copy to the working buffeu
- if blankline {
- work.WriteByte('\n')
- } else {
- work.Write(data[beg:i])
- }
- }
-
- // trim all the \n off the end of work
- workbytes := work.Bytes()
- eol := len(workbytes)
- for eol > 0 && workbytes[eol-1] == '\n' {
- eol--
- }
- if eol != len(workbytes) {
- work.Truncate(eol)
- }
-
- work.WriteByte('\n')
-
- p.r.BlockCode(out, work.Bytes(), "")
-
- return i
-}
-
-// returns unordered list item prefix
-func (p *parser) uliPrefix(data []byte) int {
- i := 0
-
- // start with up to 3 spaces
- for i < 3 && data[i] == ' ' {
- i++
- }
-
- // need a *, +, or - followed by a space
- if (data[i] != '*' && data[i] != '+' && data[i] != '-') ||
- data[i+1] != ' ' {
- return 0
- }
- return i + 2
-}
-
-// returns ordered list item prefix
-func (p *parser) oliPrefix(data []byte) int {
- i := 0
-
- // start with up to 3 spaces
- for i < 3 && data[i] == ' ' {
- i++
- }
-
- // count the digits
- start := i
- for data[i] >= '0' && data[i] <= '9' {
- i++
- }
-
- // we need >= 1 digits followed by a dot and a space
- if start == i || data[i] != '.' || data[i+1] != ' ' {
- return 0
- }
- return i + 2
-}
-
-// returns definition list item prefix
-func (p *parser) dliPrefix(data []byte) int {
- i := 0
-
- // need a : followed by a spaces
- if data[i] != ':' || data[i+1] != ' ' {
- return 0
- }
- for data[i] == ' ' {
- i++
- }
- return i + 2
-}
-
-// parse ordered or unordered list block
-func (p *parser) list(out *bytes.Buffer, data []byte, flags int) int {
- i := 0
- flags |= LIST_ITEM_BEGINNING_OF_LIST
- work := func() bool {
- for i < len(data) {
- skip := p.listItem(out, data[i:], &flags)
- i += skip
-
- if skip == 0 || flags&LIST_ITEM_END_OF_LIST != 0 {
- break
- }
- flags &= ^LIST_ITEM_BEGINNING_OF_LIST
- }
- return true
- }
-
- p.r.List(out, work, flags)
- return i
-}
-
-// Parse a single list item.
-// Assumes initial prefix is already removed if this is a sublist.
-func (p *parser) listItem(out *bytes.Buffer, data []byte, flags *int) int {
- // keep track of the indentation of the first line
- itemIndent := 0
- for itemIndent < 3 && data[itemIndent] == ' ' {
- itemIndent++
- }
-
- i := p.uliPrefix(data)
- if i == 0 {
- i = p.oliPrefix(data)
- }
- if i == 0 {
- i = p.dliPrefix(data)
- // reset definition term flag
- if i > 0 {
- *flags &= ^LIST_TYPE_TERM
- }
- }
- if i == 0 {
- // if in defnition list, set term flag and continue
- if *flags&LIST_TYPE_DEFINITION != 0 {
- *flags |= LIST_TYPE_TERM
- } else {
- return 0
- }
- }
-
- // skip leading whitespace on first line
- for data[i] == ' ' {
- i++
- }
-
- // find the end of the line
- line := i
- for i > 0 && data[i-1] != '\n' {
- i++
- }
-
- // get working buffer
- var raw bytes.Buffer
-
- // put the first line into the working buffer
- raw.Write(data[line:i])
- line = i
-
- // process the following lines
- containsBlankLine := false
- sublist := 0
-
-gatherlines:
- for line < len(data) {
- i++
-
- // find the end of this line
- for data[i-1] != '\n' {
- i++
- }
-
- // if it is an empty line, guess that it is part of this item
- // and move on to the next line
- if p.isEmpty(data[line:i]) > 0 {
- containsBlankLine = true
- raw.Write(data[line:i])
- line = i
- continue
- }
-
- // calculate the indentation
- indent := 0
- for indent < 4 && line+indent < i && data[line+indent] == ' ' {
- indent++
- }
-
- chunk := data[line+indent : i]
-
- // evaluate how this line fits in
- switch {
- // is this a nested list item?
- case (p.uliPrefix(chunk) > 0 && !p.isHRule(chunk)) ||
- p.oliPrefix(chunk) > 0 ||
- p.dliPrefix(chunk) > 0:
-
- if containsBlankLine {
- // end the list if the type changed after a blank line
- if indent <= itemIndent &&
- ((*flags&LIST_TYPE_ORDERED != 0 && p.uliPrefix(chunk) > 0) ||
- (*flags&LIST_TYPE_ORDERED == 0 && p.oliPrefix(chunk) > 0)) {
-
- *flags |= LIST_ITEM_END_OF_LIST
- break gatherlines
- }
- *flags |= LIST_ITEM_CONTAINS_BLOCK
- }
-
- // to be a nested list, it must be indented more
- // if not, it is the next item in the same list
- if indent <= itemIndent {
- break gatherlines
- }
-
- // is this the first item in the nested list?
- if sublist == 0 {
- sublist = raw.Len()
- }
-
- // is this a nested prefix header?
- case p.isPrefixHeader(chunk):
- // if the header is not indented, it is not nested in the list
- // and thus ends the list
- if containsBlankLine && indent < 4 {
- *flags |= LIST_ITEM_END_OF_LIST
- break gatherlines
- }
- *flags |= LIST_ITEM_CONTAINS_BLOCK
-
- // anything following an empty line is only part
- // of this item if it is indented 4 spaces
- // (regardless of the indentation of the beginning of the item)
- case containsBlankLine && indent < 4:
- if *flags&LIST_TYPE_DEFINITION != 0 && i < len(data)-1 {
- // is the next item still a part of this list?
- next := i
- for data[next] != '\n' {
- next++
- }
- for next < len(data)-1 && data[next] == '\n' {
- next++
- }
- if i < len(data)-1 && data[i] != ':' && data[next] != ':' {
- *flags |= LIST_ITEM_END_OF_LIST
- }
- } else {
- *flags |= LIST_ITEM_END_OF_LIST
- }
- break gatherlines
-
- // a blank line means this should be parsed as a block
- case containsBlankLine:
- *flags |= LIST_ITEM_CONTAINS_BLOCK
- }
-
- containsBlankLine = false
-
- // add the line into the working buffer without prefix
- raw.Write(data[line+indent : i])
-
- line = i
- }
-
- // If reached end of data, the Renderer.ListItem call we're going to make below
- // is definitely the last in the list.
- if line >= len(data) {
- *flags |= LIST_ITEM_END_OF_LIST
- }
-
- rawBytes := raw.Bytes()
-
- // render the contents of the list item
- var cooked bytes.Buffer
- if *flags&LIST_ITEM_CONTAINS_BLOCK != 0 && *flags&LIST_TYPE_TERM == 0 {
- // intermediate render of block item, except for definition term
- if sublist > 0 {
- p.block(&cooked, rawBytes[:sublist])
- p.block(&cooked, rawBytes[sublist:])
- } else {
- p.block(&cooked, rawBytes)
- }
- } else {
- // intermediate render of inline item
- if sublist > 0 {
- p.inline(&cooked, rawBytes[:sublist])
- p.block(&cooked, rawBytes[sublist:])
- } else {
- p.inline(&cooked, rawBytes)
- }
- }
-
- // render the actual list item
- cookedBytes := cooked.Bytes()
- parsedEnd := len(cookedBytes)
-
- // strip trailing newlines
- for parsedEnd > 0 && cookedBytes[parsedEnd-1] == '\n' {
- parsedEnd--
- }
- p.r.ListItem(out, cookedBytes[:parsedEnd], *flags)
-
- return line
-}
-
-// render a single paragraph that has already been parsed out
-func (p *parser) renderParagraph(out *bytes.Buffer, data []byte) {
- if len(data) == 0 {
- return
- }
-
- // trim leading spaces
- beg := 0
- for data[beg] == ' ' {
- beg++
- }
-
- // trim trailing newline
- end := len(data) - 1
-
- // trim trailing spaces
- for end > beg && data[end-1] == ' ' {
- end--
- }
-
- work := func() bool {
- p.inline(out, data[beg:end])
- return true
- }
- p.r.Paragraph(out, work)
-}
-
-func (p *parser) paragraph(out *bytes.Buffer, data []byte) int {
- // prev: index of 1st char of previous line
- // line: index of 1st char of current line
- // i: index of cursor/end of current line
- var prev, line, i int
-
- // keep going until we find something to mark the end of the paragraph
- for i < len(data) {
- // mark the beginning of the current line
- prev = line
- current := data[i:]
- line = i
-
- // did we find a blank line marking the end of the paragraph?
- if n := p.isEmpty(current); n > 0 {
- // did this blank line followed by a definition list item?
- if p.flags&EXTENSION_DEFINITION_LISTS != 0 {
- if i < len(data)-1 && data[i+1] == ':' {
- return p.list(out, data[prev:], LIST_TYPE_DEFINITION)
- }
- }
-
- p.renderParagraph(out, data[:i])
- return i + n
- }
-
- // an underline under some text marks a header, so our paragraph ended on prev line
- if i > 0 {
- if level := p.isUnderlinedHeader(current); level > 0 {
- // render the paragraph
- p.renderParagraph(out, data[:prev])
-
- // ignore leading and trailing whitespace
- eol := i - 1
- for prev < eol && data[prev] == ' ' {
- prev++
- }
- for eol > prev && data[eol-1] == ' ' {
- eol--
- }
-
- // render the header
- // this ugly double closure avoids forcing variables onto the heap
- work := func(o *bytes.Buffer, pp *parser, d []byte) func() bool {
- return func() bool {
- pp.inline(o, d)
- return true
- }
- }(out, p, data[prev:eol])
-
- id := ""
- if p.flags&EXTENSION_AUTO_HEADER_IDS != 0 {
- id = SanitizedAnchorName(string(data[prev:eol]))
- }
-
- p.r.Header(out, work, level, id)
-
- // find the end of the underline
- for data[i] != '\n' {
- i++
- }
- return i
- }
- }
-
- // if the next line starts a block of HTML, then the paragraph ends here
- if p.flags&EXTENSION_LAX_HTML_BLOCKS != 0 {
- if data[i] == '<' && p.html(out, current, false) > 0 {
- // rewind to before the HTML block
- p.renderParagraph(out, data[:i])
- return i
- }
- }
-
- // if there's a prefixed header or a horizontal rule after this, paragraph is over
- if p.isPrefixHeader(current) || p.isHRule(current) {
- p.renderParagraph(out, data[:i])
- return i
- }
-
- // if there's a fenced code block, paragraph is over
- if p.flags&EXTENSION_FENCED_CODE != 0 {
- if p.fencedCodeBlock(out, current, false) > 0 {
- p.renderParagraph(out, data[:i])
- return i
- }
- }
-
- // if there's a definition list item, prev line is a definition term
- if p.flags&EXTENSION_DEFINITION_LISTS != 0 {
- if p.dliPrefix(current) != 0 {
- return p.list(out, data[prev:], LIST_TYPE_DEFINITION)
- }
- }
-
- // if there's a list after this, paragraph is over
- if p.flags&EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK != 0 {
- if p.uliPrefix(current) != 0 ||
- p.oliPrefix(current) != 0 ||
- p.quotePrefix(current) != 0 ||
- p.codePrefix(current) != 0 {
- p.renderParagraph(out, data[:i])
- return i
- }
- }
-
- // otherwise, scan to the beginning of the next line
- for data[i] != '\n' {
- i++
- }
- i++
- }
-
- p.renderParagraph(out, data[:i])
- return i
-}
-
-// SanitizedAnchorName returns a sanitized anchor name for the given text.
-//
-// It implements the algorithm specified in the package comment.
-func SanitizedAnchorName(text string) string {
- var anchorName []rune
- futureDash := false
- for _, r := range text {
- switch {
- case unicode.IsLetter(r) || unicode.IsNumber(r):
- if futureDash && len(anchorName) > 0 {
- anchorName = append(anchorName, '-')
- }
- futureDash = false
- anchorName = append(anchorName, unicode.ToLower(r))
- default:
- futureDash = true
- }
- }
- return string(anchorName)
-}
diff --git a/vendor/github.com/russross/blackfriday/doc.go b/vendor/github.com/russross/blackfriday/doc.go
deleted file mode 100644
index 9656c42a1916ec8e5a613fbc24701b873a49b494..0000000000000000000000000000000000000000
--- a/vendor/github.com/russross/blackfriday/doc.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Package blackfriday is a Markdown processor.
-//
-// It translates plain text with simple formatting rules into HTML or LaTeX.
-//
-// Sanitized Anchor Names
-//
-// Blackfriday includes an algorithm for creating sanitized anchor names
-// corresponding to a given input text. This algorithm is used to create
-// anchors for headings when EXTENSION_AUTO_HEADER_IDS is enabled. The
-// algorithm is specified below, so that other packages can create
-// compatible anchor names and links to those anchors.
-//
-// The algorithm iterates over the input text, interpreted as UTF-8,
-// one Unicode code point (rune) at a time. All runes that are letters (category L)
-// or numbers (category N) are considered valid characters. They are mapped to
-// lower case, and included in the output. All other runes are considered
-// invalid characters. Invalid characters that preceed the first valid character,
-// as well as invalid character that follow the last valid character
-// are dropped completely. All other sequences of invalid characters
-// between two valid characters are replaced with a single dash character '-'.
-//
-// SanitizedAnchorName exposes this functionality, and can be used to
-// create compatible links to the anchor names generated by blackfriday.
-// This algorithm is also implemented in a small standalone package at
-// github.com/shurcooL/sanitized_anchor_name. It can be useful for clients
-// that want a small package and don't need full functionality of blackfriday.
-package blackfriday
-
-// NOTE: Keep Sanitized Anchor Name algorithm in sync with package
-// github.com/shurcooL/sanitized_anchor_name.
-// Otherwise, users of sanitized_anchor_name will get anchor names
-// that are incompatible with those generated by blackfriday.
diff --git a/vendor/github.com/russross/blackfriday/html.go b/vendor/github.com/russross/blackfriday/html.go
deleted file mode 100644
index c917c7d3f9b0e5cf9d1112dce5f462c354503529..0000000000000000000000000000000000000000
--- a/vendor/github.com/russross/blackfriday/html.go
+++ /dev/null
@@ -1,950 +0,0 @@
-//
-// Blackfriday Markdown Processor
-// Available at http://github.com/russross/blackfriday
-//
-// Copyright © 2011 Russ Ross .
-// Distributed under the Simplified BSD License.
-// See README.md for details.
-//
-
-//
-//
-// HTML rendering backend
-//
-//
-
-package blackfriday
-
-import (
- "bytes"
- "fmt"
- "regexp"
- "strconv"
- "strings"
-)
-
-// Html renderer configuration options.
-const (
- HTML_SKIP_HTML = 1 << iota // skip preformatted HTML blocks
- HTML_SKIP_STYLE // skip embedded